emacs-diffs
[Top][All Lists]
Advanced

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

scratch/command 7452c96: Allow the user to easily customize what `M-x' c


From: Lars Ingebrigtsen
Subject: scratch/command 7452c96: Allow the user to easily customize what `M-x' completes over
Date: Thu, 11 Feb 2021 11:07:47 -0500 (EST)

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

    Allow the user to easily customize what `M-x' completes over
---
 lisp/simple.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index fbd23a0..4ca4d85 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1900,6 +1900,14 @@ to get different commands to edit and resubmit."
 (defvar extended-command-history nil)
 (defvar execute-extended-command--last-typed nil)
 
+(defcustom read-extended-command-predicate #'command-for-mode-p
+  "Predicate to use to determine which commands to include when completing."
+  :version "28.1"
+  :type '(choice (const :tag "Exclude commands not relevant to this mode"
+                        #'command-for-mode-p)
+                 (const :tag "All commands" #'commandp)
+                 (function :tag "Other function")))
+
 (defun read-extended-command ()
   "Read command name to invoke in `execute-extended-command'."
   (minibuffer-with-setup-hook
@@ -1948,7 +1956,7 @@ to get different commands to edit and resubmit."
             (affixation-function . read-extended-command--affixation)
             (category . command))
          (complete-with-action action obarray string pred)))
-     #'command-for-mode-p t nil 'extended-command-history)))
+     read-extended-command-predicate t nil 'extended-command-history)))
 
 (defun command-for-mode-p (symbol)
   "Say whether SYMBOL should be offered as a completion.



reply via email to

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