aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMountain Man <43313373+MountainMan1312@users.noreply.github.com>2023-05-29 23:47:23 -0400
committerMountain Man <43313373+MountainMan1312@users.noreply.github.com>2023-05-29 23:47:23 -0400
commitf63e6d04893e3f5026fd33f69b5cadebda7c549a (patch)
treedf2744827b4f1d47974d92051fd2b5cfdf41e4d6
parentIgnore `tramp` file (diff)
downloadmmosmacs-f63e6d04893e3f5026fd33f69b5cadebda7c549a.tar.gz
mmosmacs-f63e6d04893e3f5026fd33f69b5cadebda7c549a.tar.bz2
mmosmacs-f63e6d04893e3f5026fd33f69b5cadebda7c549a.zip
Add function and keybinds to list all bindings for KEY
-rw-r--r--init.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/init.el b/init.el
index b2b0bf8..5f5fdfb 100644
--- a/init.el
+++ b/init.el
@@ -1001,6 +1001,25 @@
1001;; minibuffer or a popup window. 1001;; minibuffer or a popup window.
1002;; --------------------------------- 1002;; ---------------------------------
1003 1003
1004;; Define function and keybind to list all bindings of a certain key
1005(defun mm/print-all-bindings-for-key (key)
1006 "Output all bindings for KEY in *MESSAGES*."
1007 (interactive "kEnter key sequence: ")
1008 (mapc (lambda (pair)
1009 (when (cdr pair)
1010 (message "%S: %S" (car pair) (cdr pair))))
1011 (mapcar (lambda (keymap)
1012 (cons keymap
1013 (let ((binding (lookup-key (eval keymap) key)))
1014 (and (not (numberp binding)) binding))))
1015 (let (atoms)
1016 (mapatoms (lambda (a)
1017 (when (keymapp (and (boundp a) (eval a)))
1018 (push a atoms))))
1019 atoms))))
1020(global-set-key (kbd "C-h C-u k") 'mm/print-all-bindings-for-key)
1021
1022
1004;; Define fixed version of `keyboard-escape-quit' which does not close 1023;; Define fixed version of `keyboard-escape-quit' which does not close
1005;; windows or change their layout. 1024;; windows or change their layout.
1006(defun mm/keyboard-escape-quit-keep-windows () 1025(defun mm/keyboard-escape-quit-keep-windows ()