From d6dd58a0c75affb9ff18b4974ca5f4cd56eb2604 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Mon, 24 Jun 2024 15:09:00 +0200 Subject: [PATCH] Show entries from key-translation-map in which-key mode To: emacs-devel@gnu.org * lisp/which-key.el (which-key-extra-keymaps): New user option. (which-key--get-current-bindings): Consult it. (Bug#71648) --- lisp/which-key.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lisp/which-key.el b/lisp/which-key.el index 91007ce4ada..a5075b3ba69 100644 --- a/lisp/which-key.el +++ b/lisp/which-key.el @@ -233,6 +233,15 @@ which-key-show-docstrings (const :tag "Replace command name with docstring" docstring-only)) :package-version "1.0" :version "30.1") +(defcustom which-key-extra-keymaps '(key-translation-map) + "List of extra keymaps to show entries from. +The default is to check `key-translation-map', which contains the +\\='C-x 8' bindings for entering common characters." + :type '(choice (list :tag "Translation map" (const key-translation-map)) + (const :tag "None" nil) + (repeat :tag "Custom" symbol)) + :package-version "1.0" :version "30.1") + (defcustom which-key-highlighted-command-list '() "Rules used to highlight certain commands. If the element is a string, assume it is a regexp pattern for @@ -1942,8 +1951,10 @@ which-key--get-keymap-bindings (defun which-key--get-current-bindings (&optional prefix filter) "Generate a list of current active bindings." - (let (bindings) - (dolist (map (current-active-maps t) bindings) + (let (bindings + (maps (nconc (current-active-maps t) + (mapcar #'symbol-value which-key-extra-keymaps)))) + (dolist (map maps bindings) (when (cdr map) (setq bindings (which-key--get-keymap-bindings -- 2.39.2