]> code.delx.au - gnu-emacs/commitdiff
Add a variable to control "shorter command" suggestions
authorIvan Shmakov <ivan@siamics.net>
Sat, 30 Apr 2016 15:24:57 +0000 (17:24 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 30 Apr 2016 15:24:57 +0000 (17:24 +0200)
* lisp/simple.el (extended-command-suggest-shorter): New variable (bug#19152).
(execute-extended-command): Use it.

lisp/simple.el

index 849cbd6863ae34d12f0849d6d880c9608c3b16c1..fca739636c61335499b2d0b0c0b4124f246a59fd 100644 (file)
@@ -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.