emacs-diffs
[Top][All Lists]
Advanced

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

scratch/command eae00de: Clean up the M-x predicate stuff slightly


From: Lars Ingebrigtsen
Subject: scratch/command eae00de: Clean up the M-x predicate stuff slightly
Date: Thu, 11 Feb 2021 12:42:48 -0500 (EST)

branch: scratch/command
commit eae00de90bba861567581736b2c9ae37b0975d27
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Clean up the M-x predicate stuff slightly
---
 lisp/simple.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index ce52fb9..5307f5e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1910,7 +1910,7 @@ to get different commands to edit and resubmit."
 
 (defun read-extended-command ()
   "Read command name to invoke in `execute-extended-command'."
-  (let ((current-major-mode major-mode))
+  (let ((current-buffer (current-buffer)))
     (minibuffer-with-setup-hook
         (lambda ()
           (add-hook 'post-self-insert-hook
@@ -1960,16 +1960,17 @@ to get different commands to edit and resubmit."
               (category . command))
            (complete-with-action action obarray string pred)))
        (lambda (sym)
-         (command-for-mode-p current-major-mode sym))
+         (with-current-buffer current-buffer
+           (funcall read-extended-command-predicate sym)))
        t nil 'extended-command-history))))
 
-(defun command-for-mode-p (mode symbol)
+(defun command-for-mode-p (symbol)
   "Say whether SYMBOL should be offered as a completion.
 This is true if it's a command and the command is applicable to
 the current major mode."
   (and (commandp symbol)
        (or (null (command-modes symbol))
-           (apply #'provided-mode-derived-p mode (command-modes symbol)))))
+           (apply #'derived-mode-p (command-modes symbol)))))
 
 (defun read-extended-command--affixation (command-names)
   (with-selected-window (or (minibuffer-selected-window) (selected-window))



reply via email to

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