diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-04-26 13:23:51 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-04-26 13:23:51 +0200 |
commit | dd5ca0eaf2604bcf712c91e43bde723687a64e29 (patch) | |
tree | 59cd783b7f0314af9a18816c08969b1b9488987b /lisp/help-fns.el | |
parent | ae877d551155000dffdbcd1b90d682967c6988d0 (diff) | |
download | emacs-dd5ca0eaf2604bcf712c91e43bde723687a64e29.tar.gz emacs-dd5ca0eaf2604bcf712c91e43bde723687a64e29.tar.bz2 emacs-dd5ca0eaf2604bcf712c91e43bde723687a64e29.zip |
Make new menu *Help* output be more resilient
* lisp/help-fns.el (help-fns--insert-menu-bindings): Only insert
the heading if it turns out that we actually find the menu.
(help-fns--insert-bindings): Tweak calling convention.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r-- | lisp/help-fns.el | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 45999801667..67045bb4d67 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -565,11 +565,10 @@ the C sources, too." (insert "\n")) (when menus (let ((start (point))) - (insert (concat "It can " - (and keys "also ") - "be invoked from the menu: ")) - (help-fns--insert-menu-bindings menus) - (insert ".") + (help-fns--insert-menu-bindings + menus + (concat "It can " (and keys "also ") + "be invoked from the menu: ")) (fill-region-as-paragraph start (point)))) (ensure-empty-lines))))))) @@ -582,7 +581,7 @@ the C sources, too." (insert (help--key-description-fontified key))) keys)) -(defun help-fns--insert-menu-bindings (menus) +(defun help-fns--insert-menu-bindings (menus heading) (seq-do-indexed (lambda (menu i) (insert @@ -593,12 +592,15 @@ the C sources, too." (start (point))) (seq-do-indexed (lambda (entry level) - (when (> level 0) - (insert - (if (char-displayable-p ?→) - " → " - " => "))) - (let ((elem (assq entry (cdr map)))) + (when-let ((elem (assq entry (cdr map)))) + (when heading + (insert heading) + (setq heading nil)) + (when (> level 0) + (insert + (if (char-displayable-p ?→) + " → " + " => "))) (if (eq (nth 1 elem) 'menu-item) (progn (insert (nth 2 elem)) |