changeset 34182:3f2ee9f3d8bf

(Info-scroll-prefer-subnodes): New defcustom. (Info-scroll-up): If Info-scroll-prefer-subnodes is nil, don't visit the first subnode until the bottom of the current node is visible.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 04 Dec 2000 16:36:44 +0000
parents 8f8830861b15
children fd0f15c05bfe
files lisp/info.el
diffstat 1 files changed, 28 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/info.el	Mon Dec 04 16:19:04 2000 +0000
+++ b/lisp/info.el	Mon Dec 04 16:36:44 2000 +0000
@@ -126,6 +126,19 @@
   :type '(repeat directory)
   :group 'info)
 
+(defcustom Info-scroll-prefer-subnodes t
+  "*If non-nil, \\<Info-mode-map>\\[Info-scroll-up] in a menu visits subnodes.
+If this is non-nil, and you scroll far enough in a node that its menu
+appears on the screen, the next \\<Info-mode-map>\\[Info-scroll-up]
+moves to a subnode indicated by the following menu item.  This means
+that you visit a subnode before getting to the end of the menu.
+
+Setting this option to nil results in behavior similar to the stand-alone
+Info reader program, which visits the first subnode from the menu only
+when you hit the end of the current node."
+  :type 'boolean
+  :group 'info)
+
 (defvar Info-current-file nil
   "Info file that Info is now looking at, or nil.
 This is the name that was specified in Info, not the actual file name.
@@ -1619,13 +1632,16 @@
 (defun Info-scroll-up ()
   "Scroll one screenful forward in Info, considering all nodes as one sequence.
 Once you scroll far enough in a node that its menu appears on the screen
-but after point, the next scroll moves into its first subnode.
+but after point, the next scroll moves into its first subnode, unless
+`Info-scroll-prefer-subnodes' is nil.
 
-When you scroll past the end of a node, that goes to the next node; if
-this node has no successor, it moves to the parent node's successor,
-and so on.  If point is inside the menu of a node, it moves to
-subnode indicated by the following menu item.  (That case won't
-normally result from this command, but can happen in other ways.)"
+When you scroll past the end of a node, that goes to the next node if
+`Info-scroll-prefer-subnodes' is non-nil and to the first subnode otherwise;
+if this node has no successor, it moves to the parent node's successor,
+and so on.  If `Info-scroll-prefer-subnodes' is non-nil and point is inside
+the menu of a node, it moves to subnode indicated by the following menu
+item.  (That case won't normally result from this command, but can happen
+in other ways.)"
 
   (interactive)
   (if (or (< (window-start) (point-min))
@@ -1634,12 +1650,16 @@
   (let* ((case-fold-search t)
 	 (virtual-end (save-excursion
 			(goto-char (point-min))
-			(if (search-forward "\n* Menu:" nil t)
+			(if (and Info-scroll-prefer-subnodes
+				 (search-forward "\n* Menu:" nil t))
 			    (point)
 			  (point-max)))))
     (if (or (< virtual-end (window-start))
 	    (pos-visible-in-window-p virtual-end))
-	(Info-next-preorder)
+	(cond
+	 (Info-scroll-prefer-subnodes (Info-next-preorder))
+	 ((Info-no-error (Info-goto-node (Info-extract-menu-counting 1))))
+	 (t (Info-next-preorder)))
       (scroll-up))))
 
 (defun Info-scroll-down ()