mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-29 07:58:28 +00:00
Fix display of menu-bar bindings of commands in *Help* buffers
* lisp/help-fns.el (help-fns--insert-menu-bindings): Propertize with 'help-key-binding' face only the menu items, not the arrows between successive items. This is because 'char-displayable-p' is unreliable when we propertize the character with an arbitrary face: that face could specify a font which doesn't support the character after all, while 'char-displayable-p' assumes there are no restrictions on fonts that can be used for displaying the character. Also, make the code more efficient by avoiding the call to 'char-displayable-p' inside the loop.
This commit is contained in:
parent
ecdd3a9efa
commit
9ac1259278
@ -592,22 +592,22 @@ the C sources, too."
|
|||||||
;; First collect all the printed representations of menus.
|
;; First collect all the printed representations of menus.
|
||||||
(dolist (menu menus)
|
(dolist (menu menus)
|
||||||
(let ((map (lookup-key global-map (seq-take menu 1)))
|
(let ((map (lookup-key global-map (seq-take menu 1)))
|
||||||
(string nil))
|
(string nil)
|
||||||
|
(sep (if (char-displayable-p ?→) " → " " => ")))
|
||||||
(seq-do-indexed
|
(seq-do-indexed
|
||||||
(lambda (entry level)
|
(lambda (entry level)
|
||||||
(when (symbolp map)
|
(when (symbolp map)
|
||||||
(setq map (symbol-function map)))
|
(setq map (symbol-function map)))
|
||||||
(when-let ((elem (assq entry (cdr map))))
|
(when-let ((elem (assq entry (cdr map))))
|
||||||
(when (> level 0)
|
(when (> level 0)
|
||||||
(push (if (char-displayable-p ?→)
|
(push sep string))
|
||||||
" → "
|
|
||||||
" => ")
|
|
||||||
string))
|
|
||||||
(if (eq (nth 1 elem) 'menu-item)
|
(if (eq (nth 1 elem) 'menu-item)
|
||||||
(progn
|
(progn
|
||||||
(push (nth 2 elem) string)
|
(push (propertize (nth 2 elem) 'face 'help-key-binding)
|
||||||
|
string)
|
||||||
(setq map (cadddr elem)))
|
(setq map (cadddr elem)))
|
||||||
(push (nth 1 elem) string)
|
(push (propertize (nth 1 elem) 'face 'help-key-binding)
|
||||||
|
string)
|
||||||
(setq map (cddr elem)))))
|
(setq map (cddr elem)))))
|
||||||
(cdr (seq-into menu 'list)))
|
(cdr (seq-into menu 'list)))
|
||||||
(when string
|
(when string
|
||||||
@ -622,8 +622,7 @@ the C sources, too."
|
|||||||
(cond ((zerop i) "")
|
(cond ((zerop i) "")
|
||||||
((= i (1- (length menus))) " and ")
|
((= i (1- (length menus))) " and ")
|
||||||
(t ", "))
|
(t ", "))
|
||||||
(propertize (string-join (nreverse string))
|
(string-join (nreverse string))))
|
||||||
'face 'help-key-binding)))
|
|
||||||
strings))))
|
strings))))
|
||||||
|
|
||||||
(defun help-fns--compiler-macro (function)
|
(defun help-fns--compiler-macro (function)
|
||||||
|
Loading…
Reference in New Issue
Block a user