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

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

[elpa] externals/hyperbole 82653d5 06/25: hib-kbd.el: Recognize helm-M-x


From: Stefan Monnier
Subject: [elpa] externals/hyperbole 82653d5 06/25: hib-kbd.el: Recognize helm-M-x or counsel-M-x bound to M-x
Date: Tue, 22 Sep 2020 10:29:26 -0400 (EDT)

branch: externals/hyperbole
commit 82653d5e920b42bebfa7c7e52dea1f4a552f439a
Author: Bob Weiner <Bob.Weiner@DuffandPhelps.com>
Commit: Bob Weiner <Bob.Weiner@DuffandPhelps.com>

    hib-kbd.el: Recognize helm-M-x or counsel-M-x bound to M-x
---
 hib-kbd.el | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/hib-kbd.el b/hib-kbd.el
index b3736cc..b01951f 100644
--- a/hib-kbd.el
+++ b/hib-kbd.el
@@ -29,6 +29,7 @@
 ;;; ************************************************************************
 
 (require 'hactypes)
+(require 'seq)
 
 (defvar kbd-key:named-key-list
   '("add" "backspace" "begin" "bs" "clear" "decimal" "delete" "del"
@@ -263,12 +264,13 @@ For an approximate inverse of this, see 
`key-description'."
          (setq times (string-to-number (substring word 0 (match-end 1))))
          (setq word (substring word (1+ (match-end 1)))))
        (cond ((string-match "^<<.+>>$" word)
-              (setq key (vconcat (if (eq (key-binding [?\M-x])
-                                         'execute-extended-command)
-                                     [?\M-x]
-                                   (or (car (where-is-internal
-                                             'execute-extended-command))
-                                       [?\M-x]))
+              (setq key (vconcat (cond ((memq (key-binding [?\M-x])
+                                              
kbd-key:extended-command-binding-list)
+                                        [?\M-x])
+                                       ((seq-filter
+                                         (lambda (elt) (car (where-is-internal 
elt)))
+                                         kbd-key:extended-command-binding-list)
+                                        [?\M-x]))
                                  (substring word 2 -2) "\r")))
              ((and (string-match "^\\(\\([ACHMsS]-\\)*\\)<\\(.+\\)>$" word)
                    (progn
@@ -409,8 +411,11 @@ a M-x extended command,
 ;;; ************************************************************************
 
 (defconst kbd-key:extended-command-prefix
-  (kbd-key:normalize (key-description (where-is-internal 
'execute-extended-command (current-global-map) t)))
-  "Normalized prefix string that invokes an extended command; typically ESC 
x.")
+  (format "\\_<%s\\_>" (kbd-key:normalize "M-x"))
+  "Normalized prefix regular expression that invokes an extended command; by 
default, M-x.")
+
+(defconst kbd-key:extended-command-binding-list '(execute-extended-command 
helm-M-x counsel-M-x)
+  "List of commands that may be bound to M-x to invoke extended/named 
commands.")
 
 (defvar kbd-key:mini-menu-key nil
   "The key sequence that invokes the Hyperbole minibuffer menu.")



reply via email to

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