Function: Texinfo-insert-node

Texinfo-insert-node is an interactive and byte-compiled function defined in tex-info.el.

Signature

(Texinfo-insert-node)

Documentation

Insert a Texinfo node in the current buffer.

That means, insert the string @node and prompt for current, next, previous and upper node. If there is an active region, use this for the current node and inhibit the prompt for it. Insert a comment on the following line indicating the order of arguments for @node.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/tex-info.el
(defun Texinfo-insert-node ()
  "Insert a Texinfo node in the current buffer.
That means, insert the string `@node' and prompt for current,
next, previous and upper node.  If there is an active region, use
this for the current node and inhibit the prompt for it.  Insert
a comment on the following line indicating the order of arguments
for @node."
  (interactive)
  (let ((active-mark (and (TeX-active-mark) (not (eq (mark) (point)))))
        (nodes (Texinfo-make-node-list))
        node-name next-node previous-node up-node)
    (unless active-mark
      (setq node-name (Texinfo-nodename-escape
                       (TeX-read-string "Node name: "))))
    ;; FIXME: What if key binding for `minibuffer-complete' was changed?
    ;; `substitute-command-keys' doesn't return the correct value.
    (setq next-node (Texinfo-nodename-escape
                     (completing-read "Next node (TAB completes): " nodes)))
    (setq previous-node
          (Texinfo-nodename-escape
           (completing-read "Previous node (TAB completes): " nodes)))
    (setq up-node (Texinfo-nodename-escape
                   (completing-read "Upper node (TAB completes): " nodes)))
    (when (and active-mark
               (< (mark) (point)))
      (exchange-point-and-mark))
    (insert "@node ")
    (if active-mark
        (goto-char (mark))
      (insert node-name))
    (insert ", " next-node ", " previous-node ", " up-node
            "\n@comment  node-name,  next,  previous,  up\n")
    ;; Position point at first empty field.
    (unless (and (or (> (length node-name) 0) active-mark)
                 (> (length next-node) 0)
                 (> (length previous-node) 0)
                 (> (length  up-node) 0))
      (forward-line -2)
      (forward-char 6)
      (catch 'break
        (if (or (> (length node-name) 0) active-mark)
            (progn (skip-chars-forward "^,") (forward-char 2))
          (throw 'break nil))
        (dolist (node (list next-node previous-node up-node))
          (if (> (length node) 0)
              (progn (skip-chars-forward "^,") (forward-char 2))
            (throw 'break nil)))))))