From: Ivan Shmakov Date: Sat, 30 Apr 2016 15:24:57 +0000 (+0200) Subject: Add a variable to control "shorter command" suggestions X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/6f86ec8050c12b131b5a8d54a42fef04445f9482 Add a variable to control "shorter command" suggestions * lisp/simple.el (extended-command-suggest-shorter): New variable (bug#19152). (execute-extended-command): Use it. --- diff --git a/lisp/simple.el b/lisp/simple.el index 849cbd6863..fca739636c 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1634,6 +1634,11 @@ If the value is non-nil and not a number, we wait 2 seconds." (integer :tag "time" 2) (other :tag "on"))) +(defcustom extended-command-suggest-shorter t + "Non-nil means show a shorter M-x invocation when there is one." + :group 'keyboard + :type 'boolean) + (defun execute-extended-command--shorter-1 (name length) (cond ((zerop length) (list "")) @@ -1716,7 +1721,8 @@ invoking, give a prefix argument to `execute-extended-command'." ((numberp suggest-key-bindings) suggest-key-bindings) (t 2)))))) (when (and waited (not (consp unread-command-events))) - (unless (or binding executing-kbd-macro (not (symbolp function)) + (unless (or (not extended-command-suggest-shorter) + binding executing-kbd-macro (not (symbolp function)) (<= (length (symbol-name function)) 2)) ;; There's no binding for CMD. Let's try and find the shortest ;; string to use in M-x.