Function: Info-find-emacs-command-nodes

Info-find-emacs-command-nodes is a byte-compiled function defined in info.el.gz.

Signature

(Info-find-emacs-command-nodes COMMAND)

Documentation

Return a list of locations documenting COMMAND.

The info-file property of COMMAND says which Info manual to search. If COMMAND has no property, the variable Info-file-list-for-emacs defines heuristics for which Info manual to try. The locations are of the format used in the variable Info-history(var)/Info-history(fun), i.e.
(FILENAME NODENAME BUFFERPOS), where BUFFERPOS is the line number
in the first element of the returned list (which is treated specially in Info-goto-emacs-command-node), and 0 for the rest elements of a list.

Source Code

;; Defined in /usr/src/emacs/lisp/info.el.gz
(defun Info-find-emacs-command-nodes (command)
  "Return a list of locations documenting COMMAND.
The `info-file' property of COMMAND says which Info manual to search.
If COMMAND has no property, the variable `Info-file-list-for-emacs'
defines heuristics for which Info manual to try.
The locations are of the format used in the variable `Info-history', i.e.
\(FILENAME NODENAME BUFFERPOS), where BUFFERPOS is the line number
in the first element of the returned list (which is treated specially in
`Info-goto-emacs-command-node'), and 0 for the rest elements of a list."
  (let ((where '()) line-number
	(cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command))
			  "\\( <[0-9]+>\\)?:\\s *\\(.*\\)\\."
			  "\\(?:[ \t\n]+(line +\\([0-9]+\\))\\)?"))
	(info-file "emacs"))		;default
    ;; Determine which Info file this command is documented in.
    (if (get command 'info-file)
	(setq info-file (get command 'info-file))
      ;; If it doesn't say explicitly, test its name against
      ;; various prefixes that we know.
      (let ((file-list Info-file-list-for-emacs))
	(while file-list
	  (let* ((elt (car file-list))
		 (name (if (consp elt)
			   (car elt)
			 elt))
		 (file (if (consp elt) (cdr elt) elt))
		 (case-fold-search nil)
		 (regexp (concat "\\`" (regexp-quote name)
				 "\\(\\'\\|-\\)")))
	    (if (string-match regexp (symbol-name command))
		(setq info-file file file-list nil))
	    (setq file-list (cdr file-list))))))
    (Info-find-node info-file "Top")
    ;; Bind Info-history to nil, to prevent the index nodes from
    ;; getting into the node history.
    (let ((Info-history nil)
          (Info-history-list nil)
	  node (nodes (Info-index-nodes)))
      (Info-goto-node (car nodes))
      (while
	  (progn
	    (goto-char (point-min))
	    (while (re-search-forward cmd-desc nil t)
	      (setq where
		    (cons (list Info-current-file
				(match-string-no-properties 2)
				0)
			  where))
	      (setq line-number (and (match-beginning 3)
				     (string-to-number (match-string 3)))))
	    (and (setq nodes (cdr nodes) node (car nodes))))
	(Info-goto-node node)))
    (if (and line-number where)
	(cons (list (nth 0 (car where)) (nth 1 (car where)) line-number)
	      (cdr where))
      where)))