Function: describe-map-tree

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

Signature

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

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 NOMENU 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.

Any inserted text ends in two newlines (used by help-make-xrefs).

Source Code

;; Defined in /usr/src/emacs/lisp/help.el.gz
(defun describe-map-tree (startmap partial shadow prefix title no-menu
                                   transl always-title mention-shadow)
  "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 NOMENU 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.

Any inserted text ends in two newlines (used by
`help-make-xrefs')."
  (let* ((amaps (accessible-keymaps startmap prefix))
         (orig-maps (if no-menu
                        (progn
                          ;; 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)))
    ;; Print title.
    (when print-title
      (insert (concat (if title
                          (concat title
                                  (if prefix
                                      (concat " Starting With "
                                              (help--key-description-fontified prefix)))
                                  ":\n"))
                      "key             binding\n"
                      "---             -------\n")))
    ;; 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)))
      (setq maps (cdr maps)))
    (when print-title
      (insert "\n"))))