Subject: bug#19152: 25.0.50; Suggestions for M-x commands

From: Ivan Shmakov <[email-masked]>
Date: Tue, 25 Nov 2014 18:10:40 +0000

>>>>> Eli Zaretskii <[email-masked]> writes:
>>>>> From: Ivan Shmakov  Date: Tue, 25 Nov 2014 15:45:18 +0000
>>>>> Stefan Monnier <[email-masked]> writes:

 >>>>> An option to turn the feature off is fine.  An option to choose
 >>>>> the number of chars we have to gain is not.

 >>>> Why not?

 >>> Because that exposes too much irrelevant details.

 >> I see no big difference between suggest-key-bindings’ seconds and
 >> the suggested suggest-shorter-command-limit’s characters.

 > Would you please rework your patch to make the option a simple
 > predicate that turns this feature on and off,

	Sure…

 > and call it some name that begins with extended-command?

	… Even though that’s inconsistent with the name of the existing
	suggest-key-bindings option?…

 > I think there's a consensus that such an option is OK.

 > Thanks.

	… Please consider the patch MIMEd.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A
--- a/lisp/simple.el	2014-11-21 09:21:50 +0000
+++ b/lisp/simple.el
@@ -1598,6 +1598,11 @@
                  (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 ""))
@@ -1680,7 +1685,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 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.