diff options
| author | Lars Ingebrigtsen | 2022-07-26 15:21:28 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-07-26 15:21:28 +0200 |
| commit | 015cf7824ea511180329dabcb67c533661da3fff (patch) | |
| tree | 8dee93d01eab4ae2574ba77f24abedf2c71e19df | |
| parent | a1384cd65d2f9dbb702b31fdfe06d7b8643ef978 (diff) | |
| download | emacs-015cf7824ea511180329dabcb67c533661da3fff.tar.gz emacs-015cf7824ea511180329dabcb67c533661da3fff.zip | |
Don't bind `M-X' when doing general completion
* lisp/minibuffer.el (minibuffer-local-must-match-map): Remove the
M-X binding here, because it's nonsensical outside
read-extended-command (bug#56741).
* lisp/simple.el (read-extended-command-mode-map)
(read-extended-command-mode): New minor mode to bind `M-X' in
read-extended-command.
(read-extended-command-1): Use it.
| -rw-r--r-- | lisp/minibuffer.el | 1 | ||||
| -rw-r--r-- | lisp/simple.el | 15 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index d139e094eb2..bdf6d852a95 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el | |||
| @@ -2760,7 +2760,6 @@ The completion method is determined by `completion-at-point-functions'." | |||
| 2760 | (defvar-keymap minibuffer-local-must-match-map | 2760 | (defvar-keymap minibuffer-local-must-match-map |
| 2761 | :doc "Local keymap for minibuffer input with completion, for exact match." | 2761 | :doc "Local keymap for minibuffer input with completion, for exact match." |
| 2762 | :parent minibuffer-local-completion-map | 2762 | :parent minibuffer-local-completion-map |
| 2763 | "M-X" #'execute-extended-command-cycle | ||
| 2764 | "RET" #'minibuffer-complete-and-exit | 2763 | "RET" #'minibuffer-complete-and-exit |
| 2765 | "C-j" #'minibuffer-complete-and-exit) | 2764 | "C-j" #'minibuffer-complete-and-exit) |
| 2766 | 2765 | ||
diff --git a/lisp/simple.el b/lisp/simple.el index 5443d961e13..e4fdb610764 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -2229,9 +2229,20 @@ See `extended-command-versions'." | |||
| 2229 | "Alist of prompts and what the extended command predicate should be. | 2229 | "Alist of prompts and what the extended command predicate should be. |
| 2230 | This is used by the \\<minibuffer-local-must-match-map>\\[execute-extended-command-cycle] command when reading an extended command.") | 2230 | This is used by the \\<minibuffer-local-must-match-map>\\[execute-extended-command-cycle] command when reading an extended command.") |
| 2231 | 2231 | ||
| 2232 | (defvar-keymap read-extended-command-mode-map | ||
| 2233 | :doc "Local keymap added to the current map when reading an extended command." | ||
| 2234 | "M-X" #'execute-extended-command-cycle) | ||
| 2235 | |||
| 2236 | (define-minor-mode read-extended-command-mode | ||
| 2237 | "Minor mode when doing completion in `read-extended-command'.") | ||
| 2238 | |||
| 2232 | (defun read-extended-command (&optional prompt) | 2239 | (defun read-extended-command (&optional prompt) |
| 2233 | "Read command name to invoke in `execute-extended-command'. | 2240 | "Read command name to invoke in `execute-extended-command'. |
| 2234 | This function uses the `read-extended-command-predicate' user option." | 2241 | This function uses the `read-extended-command-predicate' user |
| 2242 | option. | ||
| 2243 | |||
| 2244 | When reading the command name, the `read-extended-command-mode' | ||
| 2245 | minor mode is activated." | ||
| 2235 | (let ((default-predicate read-extended-command-predicate) | 2246 | (let ((default-predicate read-extended-command-predicate) |
| 2236 | (read-extended-command-predicate read-extended-command-predicate) | 2247 | (read-extended-command-predicate read-extended-command-predicate) |
| 2237 | already-typed ret) | 2248 | already-typed ret) |
| @@ -2270,6 +2281,8 @@ This function uses the `read-extended-command-predicate' user option." | |||
| 2270 | (setq execute-extended-command--last-typed | 2281 | (setq execute-extended-command--last-typed |
| 2271 | (minibuffer-contents))) | 2282 | (minibuffer-contents))) |
| 2272 | nil 'local) | 2283 | nil 'local) |
| 2284 | ;; This is so that we define the `M-X' toggling command. | ||
| 2285 | (read-extended-command-mode) | ||
| 2273 | (setq-local minibuffer-default-add-function | 2286 | (setq-local minibuffer-default-add-function |
| 2274 | (lambda () | 2287 | (lambda () |
| 2275 | ;; Get a command name at point in the original buffer | 2288 | ;; Get a command name at point in the original buffer |