Function: Info-try-follow-nearest-node

Info-try-follow-nearest-node is a byte-compiled function defined in info.el.gz.

Signature

(Info-try-follow-nearest-node &optional FORK)

Documentation

Follow a node reference near point. Return non-nil if successful.

If FORK is non-nil, it is passed to Info-goto-node.

Source Code

;; Defined in /usr/src/emacs/lisp/info.el.gz
;; Common subroutine.
(defun Info-try-follow-nearest-node (&optional fork)
  "Follow a node reference near point.  Return non-nil if successful.
If FORK is non-nil, it is passed to `Info-goto-node'."
  (let (node)
    (cond
     ((setq node (Info-get-token (point) "\\(?:f\\(?:ile\\|tp\\)\\|https?\\)://"
				 "\\(\\(?:f\\(?:ile\\|tp\\)\\|https?\\)://[^ \t\n\"`‘({<>})’']+\\)"))
      (browse-url node)
      (setq node t))
     ((setq node (Info-get-token (point) "\\*note[ \n\t]+"
				 "\\*note[ \n\t]+\\([^:]*\\):\\(:\\|[ \n\t]*(\\)?"))
      (Info-follow-reference node fork))
     ;; footnote
     ((setq node (Info-get-token (point) "(" "\\(([0-9]+)\\)"))
      (let ((old-point (point)) new-point)
	(save-excursion
	  (goto-char (point-min))
	  (when (re-search-forward "^[ \t]*-+ Footnotes -+$" nil t)
	    (setq new-point (if (< old-point (point))
				;; Go to footnote reference
				(and (search-forward node nil t)
				     ;; Put point at beginning of link
				     (match-beginning 0))
			      ;; Go to footnote definition
			      (search-backward node nil t)))))
	(if new-point
	    (progn
	      (goto-char new-point)
	      (setq node t))
	  (setq node nil))))
     ;; menu item: node name
     ((setq node (Info-get-token (point) "\\* +" "\\* +\\([^:]*\\)::"))
      (Info-goto-node node fork))
     ;; menu item: node name or index entry
     ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ")
      (beginning-of-line)
      (forward-char 2)
      (setq node (Info-extract-menu-node-name nil (Info-index-node)))
      (Info-goto-node node fork))
     ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))
      (Info-goto-node node fork))
     ((setq node (Info-get-token (point) "Next: " "Next: \\([^,\n\t]*\\)"))
      (Info-goto-node node fork))
     ((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)"))
      (Info-goto-node "Top" fork))
     ((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)"))
      (Info-goto-node node fork)))
    node))