changeset 49678:0ae2b48491f7

(Info-follow-nearest-node): Implement new behavior.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 10 Feb 2003 11:41:09 +0000
parents 5c2d8e3b81b4
children 5c5e9d0710b3
files lisp/info.el
diffstat 1 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/info.el	Mon Feb 10 11:31:36 2003 +0000
+++ b/lisp/info.el	Mon Feb 10 11:41:09 2003 +0000
@@ -2113,12 +2113,22 @@
        (Info-next-preorder)))
 
 (defun Info-follow-nearest-node ()
-  "\\<Info-mode-map>Follow a node reference near point.
-Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where point is.
-If no reference to follow, moves to the next node, or up if none."
+  "Follow a node reference near point.
+If point is on a reference, follow that reference.  Otherwise,
+if point is in a menu item description, follow that menu item."
   (interactive)
   (or (Info-try-follow-nearest-node)
-      (Info-next-preorder)))
+      (when (save-excursion
+	      (search-backward "\n* menu:" nil t))
+	(save-excursion
+	  (beginning-of-line)
+	  (while (not (or (bobp) (looking-at "[^ \t]\\|[ \t]*$")))
+	    (beginning-of-line 0))
+	  (when (looking-at "\\* +\\([^\t\n]*\\):")
+	    (Info-goto-node
+	     (Info-extract-menu-item (match-string-no-properties 1)))
+	    t)))
+      (error "Point neither on reference nor in menu item description")))
 
 ;; Common subroutine.
 (defun Info-try-follow-nearest-node ()