Function: Info-virtual-index-find-node

Info-virtual-index-find-node is a byte-compiled function defined in info.el.gz.

Signature

(Info-virtual-index-find-node FILENAME NODENAME &optional NO-GOING-BACK)

Documentation

Index-specific implementation of Info-find-node-2.

Source Code

;; Defined in /usr/src/emacs/lisp/info.el.gz
(defun Info-virtual-index-find-node (filename nodename &optional _no-going-back)
  "Index-specific implementation of `Info-find-node-2'."
  ;; Generate Index-like menu of matches
  (if (string-match "^\\*Index for ‘\\(.+\\)’\\*$" nodename)
      ;; Generate Index-like menu of matches
      (let* ((topic (match-string 1 nodename))
	     (matches (cdr (assoc (cons (or filename Info-current-file) topic)
				  Info-virtual-index-nodes))))
	(insert (format "\n\^_\nFile: %s,  Node: %s,  Up: *Index*\n\n"
			(or filename Info-current-file) nodename))
	(insert "Info Virtual Index\n")
	(insert "******************\n\n")
	(insert "Index entries that match ‘" topic "’:\n\n")
	(insert "\0\b[index\0\b]\n")
	(if (null matches)
	    (insert "No matches found.\n")
	  (insert "* Menu:\n\n")
	  (dolist (entry matches)
	    (insert (format "* %-38s %s.%s\n"
			    (format "%s [%s]:" (nth 0 entry) (nth 2 entry))
			    (nth 1 entry)
			    (if (nth 3 entry)
				(format " (line %s)" (nth 3 entry))
			      ""))))))
    ;; Else, Generate a list of previous search results
    (let ((nodes (reverse Info-virtual-index-nodes)))
      (insert (format "\n\^_\nFile: %s,  Node: %s,  Up: Top\n\n"
		      (or filename Info-current-file) nodename))
      (insert "Info Virtual Index\n")
      (insert "******************\n\n")
      (insert "This is a list of search results produced by\n"
	      "‘Info-virtual-index’ for the current manual.\n\n")
      (insert "* Menu:\n\n")
      (dolist (nodeinfo nodes)
	(when (equal (car (nth 0 nodeinfo)) (or filename Info-current-file))
	  (insert
	   (format "* %-20s %s.\n"
		   (format "*Index for ‘%s’*::" (cdr (nth 0 nodeinfo)))
		   (cdr (nth 0 nodeinfo)))))))))