Subject: bug#71718: Unicode symbols to represent which key special keys, bug#71718: Unicode symbols to represent which key special keys

From: Robert Pluim <[email-masked]>
Date: Sun, 23 Jun 2024 17:29:11 +0200

>>>>> On Sat, 22 Jun 2024 14:31:15 +0530, प्रद्युम्न परांजपे <[email-masked]> 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
--