[Top][All Lists]

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

[elpa] externals/which-key 77586e6 04/51: Add which-key-dump-bindings

From: Stefan Monnier
Subject: [elpa] externals/which-key 77586e6 04/51: Add which-key-dump-bindings
Date: Tue, 8 Sep 2020 10:26:15 -0400 (EDT)

branch: externals/which-key
commit 77586e62b6d306bae07e4e3e093ba488724f4131
Author: Justin Burkett <justin@burkett.cc>
Commit: Justin Burkett <justin@burkett.cc>

    Add which-key-dump-bindings
    Fixes #209
 which-key.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/which-key.el b/which-key.el
index 6980b78..f4b15c4 100644
--- a/which-key.el
+++ b/which-key.el
@@ -2279,6 +2279,21 @@ current evil state. "
       (message "which-key: No map named %s" map-sym))))
+(defun which-key-dump-bindings (prefix buffer-name)
+  "Dump bindings from PREFIX into buffer named BUFFER-NAME.
+PREFIX should be a string suitable for `kbd'."
+  (interactive "sPrefix: \nB")
+  (let* ((buffer (get-buffer-create buffer-name))
+         (keys (which-key--get-bindings (kbd prefix))))
+    (with-current-buffer buffer
+      (point-max)
+      (save-excursion
+        (dolist (key keys)
+          (insert (apply #'format "%s%s%s\n" key)))))
+    (switch-to-buffer-other-window buffer)))
 (defun which-key-undo-key (&optional _)
   "Undo last keypress and force which-key update."

reply via email to

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