emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/consult 73ba8ba: consult-mode-command: Respect read-ext


From: ELPA Syncer
Subject: [elpa] externals/consult 73ba8ba: consult-mode-command: Respect read-extended-command-predicate on Emacs 28
Date: Wed, 14 Jul 2021 15:57:06 -0400 (EDT)

branch: externals/consult
commit 73ba8ba503511b7212aca7d98151c87fd0e2f401
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    consult-mode-command: Respect read-extended-command-predicate on Emacs 28
---
 consult.el | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/consult.el b/consult.el
index 6025177..321041d 100644
--- a/consult.el
+++ b/consult.el
@@ -2894,7 +2894,8 @@ narrowing and the settings `consult-goto-line-numbers' and
 
 The list of features is searched for files belonging to the modes.
 From these files, the commands are extracted."
-  (let* ((command-filter (consult--regexp-filter (seq-filter #'stringp 
consult-mode-command-filter)))
+  (let* ((buffer (current-buffer))
+         (command-filter (consult--regexp-filter (seq-filter #'stringp 
consult-mode-command-filter)))
          (feature-filter (seq-filter #'symbolp consult-mode-command-filter))
          (minor-hash (consult--string-hash minor-mode-list))
          (minor-local-modes (seq-filter (lambda (m)
@@ -2932,16 +2933,21 @@ From these files, the commands are extracted."
                       ?g))))
           (when key
             (dolist (cmd (cdr feature))
-              (when (and (consp cmd)
-                         (eq (car cmd) 'defun)
-                         (commandp (cdr cmd))
-                         (not (get (cdr cmd) 'byte-obsolete-info)))
-                (let ((name (symbol-name (cdr cmd))))
+              (let ((sym (cdr-safe cmd)))
+                (when (and (consp cmd)
+                           (eq (car cmd) 'defun)
+                           (commandp sym)
+                           (not (get sym 'byte-obsolete-info))
+                           ;; Emacs 28 has a `read-extended-command-predicate'
+                           (if (bound-and-true-p 
read-extended-command-predicate)
+                               (funcall read-extended-command-predicate sym 
buffer)
+                             t))
+                (let ((name (symbol-name sym)))
                   (unless (string-match-p command-filter name)
                     (push (propertize name
-                                      'consult--candidate (cdr cmd)
+                                      'consult--candidate sym
                                       'consult--type key)
-                          commands)))))))))))
+                          commands))))))))))))
 
 ;;;###autoload
 (defun consult-mode-command (&rest modes)



reply via email to

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