branch: externals/hyperbole
commit 70cabbdea2e1280a5e096191c25ee9108b51c097
Author: Bob Weiner <r...@gnu.org>
Commit: Bob Weiner <r...@gnu.org>

    hkey-set-key: Turn into a command with interactive calling support
---
 ChangeLog    |  5 +++++
 hyperbole.el | 15 +++++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 693819ad56..4d49f1cddd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-04-24  Bob Weiner  <r...@gnu.org>
+
+* hyperbole.el (hkey-set-key): Turn into a command with interactive
+    calling support.
+
 2022-04-24  Mats Lidell  <ma...@gnu.org>
 
 * test/hui-tests.el (hui--delimited-selectable-thing--in-cell-return-ref)
diff --git a/hyperbole.el b/hyperbole.el
index 2c0e27e43e..10e8952790 100644
--- a/hyperbole.el
+++ b/hyperbole.el
@@ -5,7 +5,7 @@
 ;; Author:           Bob Weiner
 ;; Maintainer:       Bob Weiner <r...@gnu.org>, Mats Lidell <ma...@gnu.org>
 ;; Created:          06-Oct-92 at 11:52:51
-;; Last-Mod:     17-Apr-22 at 17:35:31 by Bob Weiner
+;; Last-Mod:     24-Apr-22 at 13:36:22 by Bob Weiner
 ;; Released:         03-May-21
 ;; Version:          8.0.0pre
 ;; Keywords:         comm, convenience, files, frames, hypermedia, languages, 
mail, matching, mouse, multimedia, outlines, tools, wp
@@ -211,7 +211,18 @@ Third argument NO-ADD is ignored."
 
 (defun hkey-set-key (key command)
   "Define a Hyperbole global minor mode KEY bound to COMMAND."
-  (define-key hyperbole-mode-map key command))
+  (interactive
+   (let* ((menu-prompting nil)
+          (key (read-key-sequence "Set Hyperbole key: " nil t)))
+     (list key
+           (read-command (format "Set key %s to command: "
+                                 (key-description key))))))
+  (or (vectorp key) (stringp key)
+      (signal 'wrong-type-argument (list 'arrayp key)))
+  (prog1 (define-key hyperbole-mode-map key command)
+    (when (called-interactively-p 'interactive)
+      (message "{%s} set to invoke `%s' when Hyperbole is active"
+              (key-description key) command))))
 
 (defvar hmouse-middle-flag)
 (defvar hmouse-bindings-flag)

Reply via email to