unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Justin Burkett <justin@burkett.cc>
Cc: 71648@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>, jb@jeremybryant.net
Subject: bug#71648: 30.0.50; Allow which-key to report on translation bindings
Date: Mon, 24 Jun 2024 15:14:34 +0200	[thread overview]
Message-ID: <87a5jabhz9.fsf@gmail.com> (raw)
In-Reply-To: <CAF8XuLhpqodTh0STTDhcCS+QDoze7N_KmydU_pqHwoUeR2Y=RA@mail.gmail.com> (Justin Burkett's message of "Thu, 20 Jun 2024 11:40:57 -0400")

[-- Attachment #1: Type: text/plain, Size: 444 bytes --]

>>>>> On Thu, 20 Jun 2024 11:40:57 -0400, Justin Burkett <justin@burkett.cc> said:

    Justin> That seems reasonable enough. How about doing both? Add the option and
    Justin> use key-translation-map for the default value.

Patch against emacs-30 attached. Since which-key is new in emacs-30,
Iʼm assuming a NEWS entry is not required for this specific change.

Eli, let me know if it should go to master instead.

Robert
-- 


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Show-entries-from-key-translation-map-in-which-key-m.patch --]
[-- Type: text/x-diff, Size: 1889 bytes --]

From d6dd58a0c75affb9ff18b4974ca5f4cd56eb2604 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
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


  reply	other threads:[~2024-06-24 13:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19 12:04 bug#71648: 30.0.50; Allow which-key to report on translation bindings Robert Pluim
2024-06-19 13:12 ` Eli Zaretskii
2024-06-19 15:09   ` Justin Burkett
2024-06-19 15:16     ` Robert Pluim
2024-06-19 15:42       ` Justin Burkett
2024-06-19 21:13       ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-19 15:34     ` Eli Zaretskii
2024-06-19 15:48       ` Justin Burkett
2024-06-20  8:27         ` Robert Pluim
2024-06-20 14:20           ` Justin Burkett
2024-06-20 14:56             ` Robert Pluim
2024-06-20 15:40               ` Justin Burkett
2024-06-24 13:14                 ` Robert Pluim [this message]
2024-06-24 13:30                   ` Eli Zaretskii
2024-06-24 17:20                     ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a5jabhz9.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=71648@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jb@jeremybryant.net \
    --cc=justin@burkett.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).