emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 015cf7824e: Don't bind `M-X' when doing general completion


From: Lars Ingebrigtsen
Subject: master 015cf7824e: Don't bind `M-X' when doing general completion
Date: Tue, 26 Jul 2022 09:27:27 -0400 (EDT)

branch: master
commit 015cf7824ea511180329dabcb67c533661da3fff
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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.
---
 lisp/minibuffer.el |  1 -
 lisp/simple.el     | 15 ++++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index d139e094eb..bdf6d852a9 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2760,7 +2760,6 @@ The completion method is determined by 
`completion-at-point-functions'."
 (defvar-keymap minibuffer-local-must-match-map
   :doc "Local keymap for minibuffer input with completion, for exact match."
   :parent minibuffer-local-completion-map
-  "M-X" #'execute-extended-command-cycle
   "RET" #'minibuffer-complete-and-exit
   "C-j" #'minibuffer-complete-and-exit)
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 5443d961e1..e4fdb61076 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2229,9 +2229,20 @@ See `extended-command-versions'."
   "Alist of prompts and what the extended command predicate should be.
 This is used by the 
\\<minibuffer-local-must-match-map>\\[execute-extended-command-cycle] command 
when reading an extended command.")
 
+(defvar-keymap read-extended-command-mode-map
+  :doc "Local keymap added to the current map when reading an extended 
command."
+  "M-X" #'execute-extended-command-cycle)
+
+(define-minor-mode read-extended-command-mode
+  "Minor mode when doing completion in `read-extended-command'.")
+
 (defun read-extended-command (&optional prompt)
   "Read command name to invoke in `execute-extended-command'.
-This function uses the `read-extended-command-predicate' user option."
+This function uses the `read-extended-command-predicate' user
+option.
+
+When reading the command name, the `read-extended-command-mode'
+minor mode is activated."
   (let ((default-predicate read-extended-command-predicate)
         (read-extended-command-predicate read-extended-command-predicate)
         already-typed ret)
@@ -2270,6 +2281,8 @@ This function uses the `read-extended-command-predicate' 
user option."
                       (setq execute-extended-command--last-typed
                             (minibuffer-contents)))
                     nil 'local)
+          ;; This is so that we define the `M-X' toggling command.
+          (read-extended-command-mode)
           (setq-local minibuffer-default-add-function
                      (lambda ()
                        ;; Get a command name at point in the original buffer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]