]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow searching interactively over completions in `M-x'
authorJuri Linkov <juri@jurta.org>
Wed, 19 Aug 2020 13:52:08 +0000 (15:52 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 19 Aug 2020 13:52:08 +0000 (15:52 +0200)
* lisp/simple.el (read-extended-command): Allow doing interactive
searches over the completions (bug#12490).  This restores the
behaviour from Emacs 23 that was lost in Emacs 24.

etc/NEWS
lisp/simple.el

index a1255a6f42352f0efe5015426b94e7bcf7eb20e7..34d078b485f19d2a3cda635f34b16fe66a5e5567 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -819,6 +819,12 @@ window after starting).  This variable defaults to nil.
 
 ** Miscellaneous
 
+---
+*** 'C-s' in 'M-x' now searches over completions again.
+In Emacs 23, typing 'M-x' ('read-extended-command') and then 'C-s' (to
+do an interactive search) would search over possible completions.
+This was lost in Emacs 24, but is now back again.
+
 ---
 *** 'M-x report-emacs-bug' will no longer include "Recent messages" section.
 These were taken from the "*Messages*" buffer, and may inadvertently
index 755d700cd4be1c45c4513927bc383b861190faa4..5f1338abb0c88b0035c725ec768e34999ab1abdb 100644 (file)
@@ -1847,9 +1847,15 @@ to get different commands to edit and resubmit."
             (lambda ()
               ;; Get a command name at point in the original buffer
               ;; to propose it after M-n.
-              (with-current-buffer (window-buffer (minibuffer-selected-window))
-                (and (commandp (function-called-at-point))
-                     (format "%S" (function-called-at-point)))))))
+              (let ((def (with-current-buffer
+                             (window-buffer (minibuffer-selected-window))
+                           (and (commandp (function-called-at-point))
+                                (format "%S" (function-called-at-point)))))
+                    (all (sort (minibuffer-default-add-completions)
+                               (lambda (a b) (string< a b)))))
+                (if def
+                    (cons def (delete def all))
+                  all)))))
     ;; Read a string, completing from and restricting to the set of
     ;; all defined commands.  Don't provide any initial input.
     ;; Save the command read on the extended-command history list.