Function: help--describe-map-tree

help--describe-map-tree is a byte-compiled function defined in help.el.gz.

Signature

(help--describe-map-tree STARTMAP &optional PARTIAL SHADOW PREFIX TITLE NO-MENU TRANSL ALWAYS-TITLE MENTION-SHADOW BUFFER)

Documentation

Insert a description of the key bindings in STARTMAP.

This is followed by the key bindings of all maps reachable through STARTMAP.

If PARTIAL is non-nil, omit certain uninteresting commands
(such as undefined).

If SHADOW is non-nil, it is a list of maps; don't mention keys which would be shadowed by any of them.

If PREFIX is non-nil, mention only keys that start with PREFIX.

If TITLE is non-nil, is a string to insert at the beginning. TITLE should not end with a colon or a newline; we supply that.

If NO-MENU is non-nil, then omit menu-bar commands.

If TRANSL is non-nil, the definitions are actually key translations so print strings and vectors differently.

If ALWAYS-TITLE is non-nil, print the title even if there are no maps to look through.

If MENTION-SHADOW is non-nil, then when something is shadowed by SHADOW, don't omit it; instead, mention it but say it is shadowed.

If BUFFER, lookup keys while in that buffer. This only affects things like :filters for menu bindings.

Aliases

describe-map-tree (obsolete since 30.1)

Source Code

;; Defined in /usr/src/emacs/lisp/help.el.gz
(defun help--describe-map-tree (startmap &optional partial shadow prefix title
                                         no-menu transl always-title mention-shadow
                                         buffer)
  "Insert a description of the key bindings in STARTMAP.
This is followed by the key bindings of all maps reachable
through STARTMAP.

If PARTIAL is non-nil, omit certain uninteresting commands
\(such as `undefined').

If SHADOW is non-nil, it is a list of maps; don't mention keys
which would be shadowed by any of them.

If PREFIX is non-nil, mention only keys that start with PREFIX.

If TITLE is non-nil, is a string to insert at the beginning.
TITLE should not end with a colon or a newline; we supply that.

If NO-MENU is non-nil, then omit menu-bar commands.

If TRANSL is non-nil, the definitions are actually key
translations so print strings and vectors differently.

If ALWAYS-TITLE is non-nil, print the title even if there are no
maps to look through.

If MENTION-SHADOW is non-nil, then when something is shadowed by
SHADOW, don't omit it; instead, mention it but say it is
shadowed.

If BUFFER, lookup keys while in that buffer.  This only affects
things like :filters for menu bindings."
  (let* ((amaps (accessible-keymaps startmap prefix))
         (orig-maps (if no-menu
                        ;; Delete from MAPS each element that is for
                        ;; the menu bar.
                        (let* ((tail amaps)
                               result)
                          (while tail
                            (let ((elem (car tail)))
                              (when (not (and (>= (length (car elem)) 1)
                                              (eq (elt (car elem) 0) 'menu-bar)))
                                (setq result (append result (list elem)))))
                            (setq tail (cdr tail)))
                          result)
                      amaps))
         (maps orig-maps)
         (print-title (or maps always-title))
         (start-point (point)))
    ;; Describe key bindings.
    (setq help--keymaps-seen nil)
    (while (consp maps)
      (let* ((elt (car maps))
             (elt-prefix (car elt))
             (sub-shadows (lookup-key shadow elt-prefix t)))
        (when (if (natnump sub-shadows)
                  (prog1 t (setq sub-shadows nil))
                ;; Describe this map iff elt_prefix is bound to a
                ;; keymap, since otherwise it completely shadows this
                ;; map.
                (or (keymapp sub-shadows)
                    (null sub-shadows)
                    (and (consp sub-shadows)
                         (keymapp (car sub-shadows)))))
          ;; Maps we have already listed in this loop shadow this map.
          (let ((tail orig-maps))
            (while (not (equal tail maps))
              (when (equal (car (car tail)) elt-prefix)
                (setq sub-shadows (cons (cdr (car tail)) sub-shadows)))
              (setq tail (cdr tail))))
          (describe-map (cdr elt) elt-prefix transl partial
                        sub-shadows no-menu mention-shadow
                        buffer)))
      (setq maps (cdr maps)))
    ;; Print title...
    (when (and print-title
               ;; ... unless the keymap was empty.
               (/= (point) start-point))
      (save-excursion
        (goto-char start-point)
        (when (eolp)
          (delete-region (point) (1+ (point))))
        (insert
         (concat
          (if title
              (concat title
                      (if prefix
                          (concat " Starting With "
                                  (help--key-description-fontified prefix)))
                      ":\n"))
          "\nKey             Binding\n"
          (make-separator-line)))))))