summaryrefslogtreecommitdiff
path: root/lisp/simple.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2020-08-19 15:52:08 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-08-19 15:52:08 +0200
commit33a72465b53fd1dc71856ea4ad3376a05da35c73 (patch)
tree6d272a49427b455a3471332baa08e300f99466c8 /lisp/simple.el
parentbdc5d38c7cdff3e5a66ca6369f1027d550afc7a7 (diff)
downloademacs-33a72465b53fd1dc71856ea4ad3376a05da35c73.tar.gz
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.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r--lisp/simple.el12
1 files changed, 9 insertions, 3 deletions
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."
(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.