unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71718: Unicode symbols to represent which key special keys
@ 2024-06-22  9:01 प्रद्युम्न परांजपे
  2024-06-22 18:17 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-23 15:29 ` bug#71718: Unicode symbols to represent which key special keys, " Robert Pluim
  0 siblings, 2 replies; 6+ messages in thread
From: प्रद्युम्न परांजपे @ 2024-06-22  9:01 UTC (permalink / raw)
  To: 71718


[-- Attachment #1.1: Type: text/plain, Size: 1495 bytes --]

Tags: patch

This patch corresponds to the pull request #372
<https://github.com/justbur/emacs-which-key/pull/372>.

This is a proposed feature enhancement in which-key to allow
propertized special key: a single user-defined unicode character that
will replace special keys such as SPC, TAB, RET, ESC, DEL, backspace, ...

Commit:

    Unicode symbols to represent which key special keys

    * lisp/which-key.el (which-key-speical-keys):Use
    symbols to represent special keys.  If value of
    ``which-key-special-keys`` is an *alist* of cons
    cells, whose cars are special keys such as SPC,
    TAB,  ... and the cdrs are symbol strings, replace
    the special keys with corresponding symbols.

    For backward-compatibility, if
    ``which-key-special-keys`` is an ordinary list of
    keys, old logic of truncation to single character
    works.


In GNU Emacs 29.3.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.42, cairo version 1.18.0) of 2024-06-04 built on
 ekadanta.anubandha.home
Repository revision: 00360258caddc0d8cf29ba3d9971125a06f8959b
Repository branch: emacs-29
System Description: Arch Linux

Configured using:
 'configure --prefix=/home/pradyumna/.local --with-native-compilation
 --with-imagemagick --with-gnutls --with-gif --with-tree-sitter
 --with-mailutils --with-harfbuzz --with-modules --with-cairo
 --with-jpeg --with-rsvg --with-xft --with-xpm --with-png --with-pgtk
 --with-dbus --with-tiff --with-webp --with-json'


-- 
Pradyumna Swanand Paranjape

[-- Attachment #1.2: Type: text/html, Size: 1839 bytes --]

[-- Attachment #2: which-key-symbolize.diff --]
[-- Type: text/x-patch, Size: 2612 bytes --]

diff --git a/lisp/which-key.el b/lisp/which-key.el
index 1de599e5497..7d986b7cb05 100644
--- a/lisp/which-key.el
+++ b/lisp/which-key.el
@@ -239,12 +239,20 @@ which-key-highlighted-command-list
   :package-version "1.0" :version "30.1")
 
 (defcustom which-key-special-keys '()
-  "These keys will automatically be truncated to one character.
+  "These keys will be truncated to first character or provided unicode symbol.
 They also have `which-key-special-key-face' applied to them.  This
-is disabled by default.  An example configuration is
-
-\(setq which-key-special-keys \\='(\"SPC\" \"TAB\" \"RET\" \"ESC\" \"DEL\")\)"
-  :type '(repeat string)
+is disabled by default.  Example configurations are
+
+\(setq which-key-special-keys \\='(\"SPC\" \"TAB\" \"RET\" \"ESC\" \"DEL\")\) OR
+
+\(setq which-key-special-keys
+      \\='((\"SPC\" . \"␣\")
+        (\"TAB\" . \"↹\")
+        (\"RET\" . \"⏎\")
+        (\"ESC\" . \"⎋\")
+        (\"DEL\" . \"⌦\")
+        (\"backspace\" . \"⌫\"))\)"
+  :type '(repeat (choice string cons))
   :package-version "1.0" :version "30.1")
 
 (defcustom which-key-buffer-name " *which-key*"
@@ -1686,7 +1694,10 @@ which-key--propertize-key
 `which-key-special-key-face'."
   (let ((key-w-face (which-key--propertize key 'face 'which-key-key-face))
         (regexp (concat "\\("
-                        (mapconcat #'identity which-key-special-keys
+                        (mapconcat #'identity
+                                   (if (consp (car which-key-special-keys))
+                                       (mapcar #'car which-key-special-keys)
+                                     which-key-special-keys)
                                    "\\|")
                         "\\)"))
         (case-fold-search nil))
@@ -1695,8 +1706,12 @@ which-key--propertize-key
                (string-match regexp key))
           (let ((beg (match-beginning 0)) (end (match-end 0)))
             (concat (substring key-w-face 0 beg)
-                    (which-key--propertize (substring key-w-face beg (1+ beg))
-                                           'face 'which-key-special-key-face)
+                    (which-key--propertize
+                     (or (cdr
+                          (assoc (substring key-w-face beg end)
+                                 which-key-special-keys #'string=))
+                         (substring key-w-face beg (1+ beg)))
+                     'face 'which-key-special-key-face)
                     (substring key-w-face end
                                (which-key--string-width key-w-face))))
         key-w-face))))

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#71718: Unicode symbols to represent which key special keys
  2024-06-22  9:01 bug#71718: Unicode symbols to represent which key special keys प्रद्युम्न परांजपे
@ 2024-06-22 18:17 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-23 15:29 ` bug#71718: Unicode symbols to represent which key special keys, " Robert Pluim
  1 sibling, 0 replies; 6+ messages in thread
From: Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-22 18:17 UTC (permalink / raw)
  To: प्रद्युम्न परांजपे
  Cc: Justin Burkett, 71718

प्रद्युम्न परांजपे <pradyparanjpe@gmail.com> writes:

> Tags: patch
>
> This patch corresponds to the pull request #372
> <https://github.com/justbur/emacs-which-key/pull/372>.

Adding Justin as the author of which-key.  I see from the discussion it
was requested to be moved to this bug tracker, so he is aware.

> This is a proposed feature enhancement in which-key to allow
> propertized special key: a single user-defined unicode character that
> will replace special keys such as SPC, TAB, RET, ESC, DEL, backspace,
> ...
>
> Commit:
>
>     Unicode symbols to represent which key special keys
>    
>     * lisp/which-key.el (which-key-speical-keys):Use

There is a typo above in the commit message `special-keys'.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#71718: Unicode symbols to represent which key special keys, bug#71718: Unicode symbols to represent which key special keys
  2024-06-22  9:01 bug#71718: Unicode symbols to represent which key special keys प्रद्युम्न परांजपे
  2024-06-22 18:17 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-23 15:29 ` Robert Pluim
  2024-06-28  6:13   ` प्रद्युम्न परांजपे
  1 sibling, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2024-06-23 15:29 UTC (permalink / raw)
  To: प्रद्युम्न परांजपे
  Cc: Jeremy Bryant, Justin Burkett, 71718

>>>>> On Sat, 22 Jun 2024 14:31:15 +0530, प्रद्युम्न परांजपे <pradyparanjpe@gmail.com> said:


    प्रद्युम्न>     Unicode symbols to represent which key special keys

'which-key'

    प्रद्युम्न>     * lisp/which-key.el (which-key-speical-keys):Use
    प्रद्युम्न>     symbols to represent special keys.  If value of
    प्रद्युम्न>     ``which-key-special-keys`` is an *alist* of cons
    प्रद्युम्न>     cells, whose cars are special keys such as SPC,
    प्रद्युम्न>     TAB,  ... and the cdrs are symbol strings, replace
    प्रद्युम्न>     the special keys with corresponding symbols.

    प्रद्युम्न>     For backward-compatibility, if
    प्रद्युम्न>     ``which-key-special-keys`` is an ordinary list of
    प्रद्युम्न>     keys, old logic of truncation to single character
    प्रद्युम्न>     works.

Quoting in commit messages is done 'like' 'this' for symbols such as
variable and function names.

Please put a reference to the bug number somewhere in the commit
message, in the form (Bug#71718).

    प्रद्युम्न>   :package-version "1.0" :version "30.1")
    प्रद्युम्न> 
    प्रद्युम्न> (defcustom which-key-special-keys '()
    प्रद्युम्न>-  "These keys will automatically be truncated to one character.
    प्रद्युम्न>+  "These keys will be truncated to first character or provided unicode symbol.
    प्रद्युम्न> They also have `which-key-special-key-face' applied to them.  This
    प्रद्युम्न>-is disabled by default.  An example configuration is
    प्रद्युम्न>-
    प्रद्युम्न>-\(setq which-key-special-keys \\='(\"SPC\" \"TAB\" \"RET\" \"ESC\" \"DEL\")\)"
    प्रद्युम्न>-  :type '(repeat string)
    प्रद्युम्न>+is disabled by default.  Example configurations are
    प्रद्युम्न>+
    प्रद्युम्न>+\(setq which-key-special-keys \\='(\"SPC\" \"TAB\" \"RET\" \"ESC\" \"DEL\")\) OR
    प्रद्युम्न>+
    प्रद्युम्न>+\(setq which-key-special-keys
    प्रद्युम्न>+      \\='((\"SPC\" . \"␣\")
    प्रद्युम्न>+        (\"TAB\" . \"↹\")
    प्रद्युम्न>+        (\"RET\" . \"⏎\")
    प्रद्युम्न>+        (\"ESC\" . \"⎋\")
    प्रद्युम्न>+        (\"DEL\" . \"⌦\")
    प्रद्युम्न>+        (\"backspace\" . \"⌫\"))\)"
    प्रद्युम्न>+  :type '(repeat (choice string cons))
    प्रद्युम्न>   :package-version "1.0" :version "30.1")
    प्रद्युम्न>

`defcustom' has an alist type you could perhaps use here, since with
the current type it would be possible to create an improper alist.

Please donʼt recommend `setq' in the docstrings for user
options. Ideally youʼd offer preconfigured values for common setups
for the user to select. That would also make it easier to select other
replacement characters than the ones you mention.

(Perhaps itʼs too late because of backwards compatibility, but the
first value you describe above could be implemented using the form
used by the second value:

     '(("SPC" . "S")
       ("TAB" . "T") etc
)

Robert
-- 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#71718: Unicode symbols to represent which key special keys, bug#71718: Unicode symbols to represent which key special keys
  2024-06-23 15:29 ` bug#71718: Unicode symbols to represent which key special keys, " Robert Pluim
@ 2024-06-28  6:13   ` प्रद्युम्न परांजपे
  2024-06-28  7:40     ` Robert Pluim
  0 siblings, 1 reply; 6+ messages in thread
From: प्रद्युम्न परांजपे @ 2024-06-28  6:13 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Jeremy Bryant, Justin Burkett, 71718

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

I am unaware of the protocol here.

I submitted the PR as a bug as advised by the owner of the repository on
github.

I agree with, and accept both suggestions (from Robert and Jeremy).
How do I proceed with including the suggestions?

I am afraid I, being ignorant, might end up opening multiple bug reports
messing up things.
So I am not actively doing anything right now.
Please guide me through.

N.B. You may correct them without my intervention if you can.

--
Prady



रवि, २३, जून २०२४ रोजी ८:५९ PM वाजता रोजी Robert Pluim नी <rpluim@gmail.com>
लिहिले:

> >>>>> On Sat, 22 Jun 2024 14:31:15 +0530, प्रद्युम्न परांजपे <
> pradyparanjpe@gmail.com> said:
>
>
>     प्रद्युम्न>     Unicode symbols to represent which key special keys
>
> 'which-key'
>
>     प्रद्युम्न>     * lisp/which-key.el (which-key-speical-keys):Use
>     प्रद्युम्न>     symbols to represent special keys.  If value of
>     प्रद्युम्न>     ``which-key-special-keys`` is an *alist* of cons
>     प्रद्युम्न>     cells, whose cars are special keys such as SPC,
>     प्रद्युम्न>     TAB,  ... and the cdrs are symbol strings, replace
>     प्रद्युम्न>     the special keys with corresponding symbols.
>
>     प्रद्युम्न>     For backward-compatibility, if
>     प्रद्युम्न>     ``which-key-special-keys`` is an ordinary list of
>     प्रद्युम्न>     keys, old logic of truncation to single character
>     प्रद्युम्न>     works.
>
> Quoting in commit messages is done 'like' 'this' for symbols such as
> variable and function names.
>
> Please put a reference to the bug number somewhere in the commit
> message, in the form (Bug#71718).
>
>     प्रद्युम्न>   :package-version "1.0" :version "30.1")
>     प्रद्युम्न>
>     प्रद्युम्न> (defcustom which-key-special-keys '()
>     प्रद्युम्न>-  "These keys will automatically be truncated to one
> character.
>     प्रद्युम्न>+  "These keys will be truncated to first character or
> provided unicode symbol.
>     प्रद्युम्न> They also have `which-key-special-key-face' applied to
> them.  This
>     प्रद्युम्न>-is disabled by default.  An example configuration is
>     प्रद्युम्न>-
>     प्रद्युम्न>-\(setq which-key-special-keys \\='(\"SPC\" \"TAB\" \"RET\"
> \"ESC\" \"DEL\")\)"
>     प्रद्युम्न>-  :type '(repeat string)
>     प्रद्युम्न>+is disabled by default.  Example configurations are
>     प्रद्युम्न>+
>     प्रद्युम्न>+\(setq which-key-special-keys \\='(\"SPC\" \"TAB\" \"RET\"
> \"ESC\" \"DEL\")\) OR
>     प्रद्युम्न>+
>     प्रद्युम्न>+\(setq which-key-special-keys
>     प्रद्युम्न>+      \\='((\"SPC\" . \"␣\")
>     प्रद्युम्न>+        (\"TAB\" . \"↹\")
>     प्रद्युम्न>+        (\"RET\" . \"⏎\")
>     प्रद्युम्न>+        (\"ESC\" . \"⎋\")
>     प्रद्युम्न>+        (\"DEL\" . \"⌦\")
>     प्रद्युम्न>+        (\"backspace\" . \"⌫\"))\)"
>     प्रद्युम्न>+  :type '(repeat (choice string cons))
>     प्रद्युम्न>   :package-version "1.0" :version "30.1")
>     प्रद्युम्न>
>
> `defcustom' has an alist type you could perhaps use here, since with
> the current type it would be possible to create an improper alist.
>
> Please donʼt recommend `setq' in the docstrings for user
> options. Ideally youʼd offer preconfigured values for common setups
> for the user to select. That would also make it easier to select other
> replacement characters than the ones you mention.
>
> (Perhaps itʼs too late because of backwards compatibility, but the
> first value you describe above could be implemented using the form
> used by the second value:
>
>      '(("SPC" . "S")
>        ("TAB" . "T") etc
> )
>
> Robert
> --
>


-- 

प्रद्युम्न स्वानंद परांजपे
Pradyumna Swanand Paranjape
CSIR-SRF,
Centre for Cellular and Molecular Biology,
Hyderabad 500007
India
+91 9581261180

[-- Attachment #2: Type: text/html, Size: 7283 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#71718: Unicode symbols to represent which key special keys, bug#71718: Unicode symbols to represent which key special keys
  2024-06-28  6:13   ` प्रद्युम्न परांजपे
@ 2024-06-28  7:40     ` Robert Pluim
  2024-06-28 17:59       ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2024-06-28  7:40 UTC (permalink / raw)
  To: प्रद्युम्न परांजपे
  Cc: Jeremy Bryant, Justin Burkett, 71718

>>>>> On Fri, 28 Jun 2024 11:43:58 +0530, प्रद्युम्न परांजपे <pradyparanjpe@gmail.com> said:

    Prady> I am unaware of the protocol here.
    Prady> I submitted the PR as a bug as advised by the owner of the repository on
    Prady> github.

    Prady> I agree with, and accept both suggestions (from Robert and Jeremy).
    Prady> How do I proceed with including the suggestions?

Change your code to match the suggestions, ensure that all the changes
are in 1 commit, then reply to this email with the file produced by

     git format-patch -1

as an attachment. See "** Getting involved with development" in
CONTRIBUTE in the emacs sources for more info.

    Prady> I am afraid I, being ignorant, might end up opening multiple bug reports
    Prady> messing up things.
    Prady> So I am not actively doing anything right now.
    Prady> Please guide me through.

As long as you just reply to '71718@debbugs.gnu.org' and the other
people in the email headers, you wonʼt end up creating multiple
reports.

Robert
-- 





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#71718: Unicode symbols to represent which key special keys, bug#71718: Unicode symbols to represent which key special keys
  2024-06-28  7:40     ` Robert Pluim
@ 2024-06-28 17:59       ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 6+ messages in thread
From: Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-28 17:59 UTC (permalink / raw)
  To: Robert Pluim
  Cc: प्रद्युम्न परांजपे,
	Justin Burkett, 71718

Robert Pluim <rpluim@gmail.com> writes:

>>>>>> On Fri, 28 Jun 2024 11:43:58 +0530, प्रद्युम्न परांजपे <pradyparanjpe@gmail.com> said:
>
>     Prady> I am unaware of the protocol here.
>     Prady> I submitted the PR as a bug as advised by the owner of the repository on
>     Prady> github.
>
>     Prady> I agree with, and accept both suggestions (from Robert and Jeremy).
>     Prady> How do I proceed with including the suggestions?
>
> Change your code to match the suggestions, ensure that all the changes
> are in 1 commit, then reply to this email with the file produced by
>
>      git format-patch -1
>
> as an attachment. See "** Getting involved with development" in
> CONTRIBUTE in the emacs sources for more info.
>
>     Prady> I am afraid I, being ignorant, might end up opening multiple bug reports
>     Prady> messing up things.
>     Prady> So I am not actively doing anything right now.
>     Prady> Please guide me through.
>
> As long as you just reply to '71718@debbugs.gnu.org' and the other
> people in the email headers, you wonʼt end up creating multiple
> reports.
>
> Robert

Indeed.


Prady, to explain the recent change, please note that the original repo was archived on github,
recently on the 25th, just after your initial PR.

which-key is now developed as part of Emacs, so please continue to
submit patches and bug reports here.






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-28 17:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-22  9:01 bug#71718: Unicode symbols to represent which key special keys प्रद्युम्न परांजपे
2024-06-22 18:17 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-23 15:29 ` bug#71718: Unicode symbols to represent which key special keys, " Robert Pluim
2024-06-28  6:13   ` प्रद्युम्न परांजपे
2024-06-28  7:40     ` Robert Pluim
2024-06-28 17:59       ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).