Function: texinfo-insert-menu

texinfo-insert-menu is a byte-compiled function defined in texnfo-upd.el.gz.

Signature

(texinfo-insert-menu MENU-LIST NODE-NAME)

Documentation

Insert formatted menu at point.

Indents the first line of descriptions, if any, to the value of texinfo-column-for-description. Indenting leaves trailing whitespace in a menu that lacks descriptions, so descriptions will format well. In general, a menu should contain descriptions, because node names and section titles are often too short to explain a node well.

MENU-LIST has form:

    (("node-name1" . "description")
     ("node-name2" . "description") ... )

However, the description field might be nil.

Also, the node-name field might itself be a dotted pair (call it P) of strings instead of just a string. In that case, the car of P is the menu entry name, and the cdr of P is the node name.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/texnfo-upd.el.gz
(defun texinfo-insert-menu (menu-list node-name)
  "Insert formatted menu at point.
Indents the first line of descriptions, if any, to the value of
texinfo-column-for-description.  Indenting leaves trailing whitespace
in a menu that lacks descriptions, so descriptions will format well.
In general, a menu should contain descriptions, because node names and
section titles are often too short to explain a node well.

MENU-LIST has form:

    ((\"node-name1\" . \"description\")
     (\"node-name2\" . \"description\") ... )

However, the description field might be nil.

Also, the node-name field might itself be a dotted pair (call it P) of
strings instead of just a string.  In that case, the car of P
is the menu entry name, and the cdr of P is the node name."

  (insert "@menu\n")
  (dolist (menu menu-list)
    ;; Every menu entry starts with a star and a space.
    (insert "* ")

    ;; Insert the node name (and menu entry name, if present).
    (let ((node-part (car menu)))
      (if (stringp node-part)
	  ;; "Double colon" entry line; menu entry and node name are the same,
	  (insert (format "%s::" node-part))
	;; "Single colon" entry line; menu entry and node name are different.
	(insert (format "%s: %s." (car node-part) (cdr node-part)))))

    ;; Insert the description, if present.
    (when (> (length (cdr menu)) 0)
      ;; Move to right place.
      (indent-to texinfo-column-for-description 2)
      ;; Insert description.
      (insert (format "%s" (cdr menu))))

    (insert "\n")) ; end this menu entry
  (insert "@end menu")
  (let ((level (texinfo-hierarchic-level)))
    (message
     "Updated level \"%s\" menu following node: %s ... " level node-name)))