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

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

[elpa] externals/consult 6d442c8 2/2: consult-mode-command: Show major-m


From: ELPA Syncer
Subject: [elpa] externals/consult 6d442c8 2/2: consult-mode-command: Show major-mode
Date: Thu, 8 Jul 2021 17:57:07 -0400 (EDT)

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

    consult-mode-command: Show major-mode
---
 consult.el | 40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/consult.el b/consult.el
index d96c131..78f3c60 100644
--- a/consult.el
+++ b/consult.el
@@ -2925,11 +2925,6 @@ From these files, the commands are extracted."
                                       'consult--type key)
                           commands)))))))))))
 
-(defconst consult--mode-command-narrow
-  '((?m . "Major")
-    (?l . "Local Minor")
-    (?g . "Global Minor")))
-
 ;;;###autoload
 (defun consult-mode-command (&rest modes)
   "Run a command from any of the given MODES.
@@ -2941,22 +2936,25 @@ If no MODES are specified, use currently active major 
and minor modes."
                       (seq-filter (lambda (m)
                                     (and (boundp m) (symbol-value m)))
                                   minor-mode-list))))
-  (command-execute
-   (consult--read
-    (consult--mode-command-candidates modes)
-    :prompt "Mode command: "
-    :predicate
-    (lambda (cand)
-      (let ((key (get-text-property 0 'consult--type cand)))
-        (if consult--narrow
-            (= key consult--narrow)
-          (/= key ?g))))
-    :lookup #'consult--lookup-candidate
-    :group (consult--type-group consult--mode-command-narrow)
-    :narrow consult--mode-command-narrow
-    :require-match t
-    :history 'consult--mode-command-history
-    :category 'command)))
+  (let ((narrow `((?m . ,(format "Major: %s" major-mode))
+                  (?l . "Local Minor")
+                  (?g . "Global Minor"))))
+    (command-execute
+     (consult--read
+      (consult--mode-command-candidates modes)
+      :prompt "Mode command: "
+      :predicate
+      (lambda (cand)
+        (let ((key (get-text-property 0 'consult--type cand)))
+          (if consult--narrow
+              (= key consult--narrow)
+            (/= key ?g))))
+      :lookup #'consult--lookup-candidate
+      :group (consult--type-group narrow)
+      :narrow narrow
+      :require-match t
+      :history 'consult--mode-command-history
+      :category 'command))))
 
 ;;;;; Command: consult-yank
 



reply via email to

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