aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2020-08-19 15:52:08 +0200
committerLars Ingebrigtsen2020-08-19 15:52:08 +0200
commit33a72465b53fd1dc71856ea4ad3376a05da35c73 (patch)
tree6d272a49427b455a3471332baa08e300f99466c8
parentbdc5d38c7cdff3e5a66ca6369f1027d550afc7a7 (diff)
downloademacs-33a72465b53fd1dc71856ea4ad3376a05da35c73.tar.gz
emacs-33a72465b53fd1dc71856ea4ad3376a05da35c73.zip
Allow searching interactively over completions in `M-x'
* 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.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/simple.el12
2 files changed, 15 insertions, 3 deletions
diff --git a/etc/NEWS b/etc/NEWS
index a1255a6f423..34d078b485f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -820,6 +820,12 @@ window after starting). This variable defaults to nil.
820** Miscellaneous 820** Miscellaneous
821 821
822--- 822---
823*** 'C-s' in 'M-x' now searches over completions again.
824In Emacs 23, typing 'M-x' ('read-extended-command') and then 'C-s' (to
825do an interactive search) would search over possible completions.
826This was lost in Emacs 24, but is now back again.
827
828---
823*** 'M-x report-emacs-bug' will no longer include "Recent messages" section. 829*** 'M-x report-emacs-bug' will no longer include "Recent messages" section.
824These were taken from the "*Messages*" buffer, and may inadvertently 830These were taken from the "*Messages*" buffer, and may inadvertently
825leak information from the reporting user. 831leak information from the reporting user.
diff --git a/lisp/simple.el b/lisp/simple.el
index 755d700cd4b..5f1338abb0c 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1847,9 +1847,15 @@ to get different commands to edit and resubmit."
1847 (lambda () 1847 (lambda ()
1848 ;; Get a command name at point in the original buffer 1848 ;; Get a command name at point in the original buffer
1849 ;; to propose it after M-n. 1849 ;; to propose it after M-n.
1850 (with-current-buffer (window-buffer (minibuffer-selected-window)) 1850 (let ((def (with-current-buffer
1851 (and (commandp (function-called-at-point)) 1851 (window-buffer (minibuffer-selected-window))
1852 (format "%S" (function-called-at-point))))))) 1852 (and (commandp (function-called-at-point))
1853 (format "%S" (function-called-at-point)))))
1854 (all (sort (minibuffer-default-add-completions)
1855 (lambda (a b) (string< a b)))))
1856 (if def
1857 (cons def (delete def all))
1858 all)))))
1853 ;; Read a string, completing from and restricting to the set of 1859 ;; Read a string, completing from and restricting to the set of
1854 ;; all defined commands. Don't provide any initial input. 1860 ;; all defined commands. Don't provide any initial input.
1855 ;; Save the command read on the extended-command history list. 1861 ;; Save the command read on the extended-command history list.