[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Propertize some navigational keybindings
From: |
Ihor Radchenko |
Subject: |
Re: Propertize some navigational keybindings |
Date: |
Sat, 08 Oct 2022 15:03:28 +0800 |
Rudolf Adamkovič <salutis@me.com> writes:
> Howdy, howdy!
>
> Please review the attached patch that propertizes (i.e. adds style to)
> the navigational keybindings displayed in the header of the Org Export
> dispatch UI.
Thanks!
> + (setq cursor-type nil)
> + (setq header-line-format
> + (apply 'format
> + (cons "Use %s, %s, %s, or %s to navigate."
> + (mapcar (lambda (key)
> + (propertize key 'face
> 'help-key-binding))
> + (list "SPC" "DEL" "C-n" "C-p")))))
I think that the most thorough way to add this feature is following what
`help--key-description-fontified' does (we should not call this internal
function though):
(defun help--key-description-fontified (keys &optional prefix)
"Like `key-description' but add face for \"*Help*\" buffers.
KEYS is the return value of `(where-is-internal \\='foo-cmd nil t)'.
Return nil if KEYS is nil."
(when keys
;; We add both the `font-lock-face' and `face' properties here, as this
;; seems to be the only way to get this to work reliably in any
;; buffer.
(propertize (key-description keys prefix)
'font-lock-face 'help-key-binding
'face 'help-key-binding)))
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>