1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-28 10:56:36 +00:00

* lisp/help.el (describe-map-tree, describe-map): Simplify.

This commit is contained in:
Stefan Kangas 2022-08-03 17:32:52 +02:00
parent 21afc26d4d
commit eb2f394289

View File

@ -1323,7 +1323,6 @@ If BUFFER, lookup keys while in that buffer. This only affects
things like :filters for menu bindings." things like :filters for menu bindings."
(let* ((amaps (accessible-keymaps startmap prefix)) (let* ((amaps (accessible-keymaps startmap prefix))
(orig-maps (if no-menu (orig-maps (if no-menu
(progn
;; Delete from MAPS each element that is for ;; Delete from MAPS each element that is for
;; the menu bar. ;; the menu bar.
(let* ((tail amaps) (let* ((tail amaps)
@ -1334,7 +1333,7 @@ things like :filters for menu bindings."
(eq (elt (car elem) 0) 'menu-bar))) (eq (elt (car elem) 0) 'menu-bar)))
(setq result (append result (list elem))))) (setq result (append result (list elem)))))
(setq tail (cdr tail))) (setq tail (cdr tail)))
result)) result)
amaps)) amaps))
(maps orig-maps) (maps orig-maps)
(print-title (or maps always-title)) (print-title (or maps always-title))
@ -1448,8 +1447,7 @@ prefix keys PREFIX (a string or vector).
TRANSL, PARTIAL, SHADOW, NOMENU, MENTION-SHADOW and BUFFER are as TRANSL, PARTIAL, SHADOW, NOMENU, MENTION-SHADOW and BUFFER are as
in `describe-map-tree'." in `describe-map-tree'."
;; Converted from describe_map in keymap.c. ;; Converted from describe_map in keymap.c.
(let* ((suppress (and partial 'suppress-keymap)) (let* ((map (keymap-canonicalize map))
(map (keymap-canonicalize map))
(tail map) (tail map)
(first t) (first t)
done vect) done vect)
@ -1480,7 +1478,7 @@ in `describe-map-tree'."
;; commands. ;; commands.
(setq definition (keymap--get-keyelt (cdr (car tail)) nil)) (setq definition (keymap--get-keyelt (cdr (car tail)) nil))
(or (not (symbolp definition)) (or (not (symbolp definition))
(null (get definition suppress))) (not (get definition (when partial 'suppress-keymap))))
;; Don't show a command that isn't really ;; Don't show a command that isn't really
;; visible because a local definition of the ;; visible because a local definition of the
;; same key shadows it. ;; same key shadows it.
@ -1513,7 +1511,7 @@ in `describe-map-tree'."
(push (cons tail prefix) help--keymaps-seen))))) (push (cons tail prefix) help--keymaps-seen)))))
(setq tail (cdr tail))) (setq tail (cdr tail)))
;; If we found some sparse map events, sort them. ;; If we found some sparse map events, sort them.
(let ((vect (sort vect 'help--describe-map-compare)) (let ((vect (sort vect #'help--describe-map-compare))
(columns ()) (columns ())
line-start key-end column) line-start key-end column)
;; Now output them in sorted order. ;; Now output them in sorted order.