1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-05 11:45:45 +00:00

Add which-key-dump-bindings

Fixes #209
This commit is contained in:
Justin Burkett 2019-05-17 21:57:18 -04:00
parent 187ac0eb89
commit 77586e62b6

View File

@ -2278,6 +2278,21 @@ current evil state. "
"Major-mode bindings")
(message "which-key: No map named %s" map-sym))))
;;;###autoload
(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)))
;;;###autoload
(defun which-key-undo-key (&optional _)
"Undo last keypress and force which-key update."