--- a/lisp/simple.el 2014-11-21 09:21:50 +0000 +++ b/lisp/simple.el 2014-11-23 11:34:08 +0000 @@ -1598,6 +1598,13 @@ (integer :tag "time" 2) (other :tag "on"))) +(defcustom suggest-shorter-command-limit 5 + "Only suggest the equivalent M-x invocation when shorter by this amount. +If the value is nil, do not suggest shorter M-x key-bindings at all." + :group 'keyboard + :type '(choice (const :tag "off" nil) + (integer :tag "characters"))) + (defun execute-extended-command--shorter-1 (name length) (cond ((zerop length) (list "")) @@ -1623,7 +1630,7 @@ defun execute-extended-command--shorter (name typed) name len))) ;; Don't show the help message if the binding isn't ;; significantly shorter than the M-x command the user typed. - (< len (- max 5)))) + (< len (- max suggest-shorter-command-limit)))) (let ((candidate (pop candidates))) (when (equal name (car-safe (completion-try-completion @@ -1680,7 +1687,8 @@ defun execute-extended-command (prefixarg &optional command-name typed) ((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 suggest-shorter-command-limit) + 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.