comparison lisp/info.el @ 12156:1620a60ab7ca

(Info-mode): Doco fix. (Info-next-preorder): Renamed from Info-next-preorder-1. Old definition deleted. After moving up, go to end of node. (Info-last-preorder): If no menu, try the previous node. After going down thru menu or to previous, position at end of node and recenter. After moving up, position at start of menu. (Info-follow-nearest-node, Info-mouse-follow-nearest-node): Use Info-next-preorder. (Info-scroll-up, Info-scroll-down): Doc fix.
author Karl Heuer <kwzh@gnu.org>
date Fri, 09 Jun 1995 01:26:00 +0000
parents 0b8b8be6a3fd
children 3631443c706e
comparison
equal deleted inserted replaced
12155:63887def546f 12156:1620a60ab7ca
1105 1105
1106 (defmacro Info-no-error (&rest body) 1106 (defmacro Info-no-error (&rest body)
1107 (list 'condition-case nil (cons 'progn (append body '(t))) '(error nil))) 1107 (list 'condition-case nil (cons 'progn (append body '(t))) '(error nil)))
1108 1108
1109 (defun Info-next-preorder () 1109 (defun Info-next-preorder ()
1110 "Go to the next subnode, popping up a level if there is none."
1111 (interactive)
1112 (cond ((Info-no-error (Info-next-menu-item)))
1113 ((Info-no-error (Info-up))
1114 (forward-line 1)
1115 (and (re-search-forward "^\\*" nil t) (beginning-of-line)))
1116 (t
1117 (error "No more nodes"))))
1118
1119 (defun Info-next-preorder-1 ()
1120 "Go to the next subnode or the next node, or go up a level." 1110 "Go to the next subnode or the next node, or go up a level."
1121 (interactive) 1111 (interactive)
1122 (cond ((Info-no-error (Info-next-menu-item))) 1112 (cond ((Info-no-error (Info-next-menu-item)))
1123 ((Info-no-error (Info-next))) 1113 ((Info-no-error (Info-next)))
1124 ((Info-no-error (Info-up)) 1114 ((Info-no-error (Info-up))
1125 (forward-line 1) 1115 ;; Since we have already gone thru all the items in this menu,
1126 (and (re-search-forward "^\\*" nil t) (beginning-of-line))) 1116 ;; go up to the end of this node.
1117 (goto-char (point-max)))
1127 (t 1118 (t
1128 (error "No more nodes")))) 1119 (error "No more nodes"))))
1129 1120
1130 (defun Info-last-preorder () 1121 (defun Info-last-preorder ()
1131 "Go to the last node, popping up a level if there is none." 1122 "Go to the last node, popping up a level if there is none."
1132 (interactive) 1123 (interactive)
1133 (cond ((Info-no-error 1124 (cond ((Info-no-error
1134 (Info-last-menu-item) 1125 (Info-last-menu-item)
1135 ;; If we go down a menu item, go to the end of the node 1126 ;; If we go down a menu item, go to the end of the node
1136 ;; so we can scroll back through it. 1127 ;; so we can scroll back through it.
1137 (goto-char (point-max)))) 1128 (goto-char (point-max)))
1138 ((Info-no-error (Info-up)) (forward-line -1)) 1129 (recenter -1))
1139 (t (error "No previous nodes")))) 1130 ((Info-no-error (Info-prev))
1131 (goto-char (point-max))
1132 (recenter -1))
1133 ((Info-no-error (Info-up))
1134 (goto-char (point-min))
1135 (or (search-forward "\n* Menu:" nil t)
1136 (goto-char (point-max))))
1137 (t (error "No previous nodes"))))
1140 1138
1141 (defun Info-scroll-up () 1139 (defun Info-scroll-up ()
1142 "Scroll one screenful forward in Info, considering all nodes as one sequence. 1140 "Scroll one screenful forward in Info, considering all nodes as one sequence.
1143 Once you scroll far enough in a node that its menu appears on the screen, 1141 Once you scroll far enough in a node that its menu appears on the screen,
1144 the next scroll moves into its first subnode. When you scroll past 1142 the next scroll moves into its first subnode. When you scroll past
1145 the end of a node, that goes back to the parent node." 1143 the end of a node, that goes to the next node or back up to the parent node."
1146 (interactive) 1144 (interactive)
1147 (if (or (< (window-start) (point-min)) 1145 (if (or (< (window-start) (point-min))
1148 (> (window-start) (point-max))) 1146 (> (window-start) (point-max)))
1149 (set-window-start (selected-window) (point))) 1147 (set-window-start (selected-window) (point)))
1150 (let ((virtual-end (save-excursion 1148 (let ((virtual-end (save-excursion
1157 (Info-next-preorder) 1155 (Info-next-preorder)
1158 (scroll-up)))) 1156 (scroll-up))))
1159 1157
1160 (defun Info-scroll-down () 1158 (defun Info-scroll-down ()
1161 "Scroll one screenful back in Info, considering all nodes as one sequence. 1159 "Scroll one screenful back in Info, considering all nodes as one sequence.
1162 If you are within the menu of a node, this follows the previous 1160 Within the menu of a node, this goes to its last subnode.
1163 menu item, so that you scroll through all the subnodes, ordered 1161 When you scroll past the beginning of a node, that goes to the
1164 as if they appeared in place of the menu. When you scroll past 1162 previous node or back up to the parent node."
1165 the beginning of a node, that goes back to the parent node."
1166 (interactive) 1163 (interactive)
1167 (if (or (< (window-start) (point-min)) 1164 (if (or (< (window-start) (point-min))
1168 (> (window-start) (point-max))) 1165 (> (window-start) (point-max)))
1169 (set-window-start (selected-window) (point))) 1166 (set-window-start (selected-window) (point)))
1170 (let ((virtual-end (save-excursion 1167 (let ((virtual-end (save-excursion
1378 (pos (car (cdr start)))) 1375 (pos (car (cdr start))))
1379 (select-window window) 1376 (select-window window)
1380 (goto-char pos)) 1377 (goto-char pos))
1381 (and (not (Info-try-follow-nearest-node)) 1378 (and (not (Info-try-follow-nearest-node))
1382 (save-excursion (forward-line 1) (eobp)) 1379 (save-excursion (forward-line 1) (eobp))
1383 (Info-next-preorder-1))) 1380 (Info-next-preorder)))
1384 1381
1385 (defun Info-follow-nearest-node () 1382 (defun Info-follow-nearest-node ()
1386 "\\<Info-mode-map>Follow a node reference near point. 1383 "\\<Info-mode-map>Follow a node reference near point.
1387 Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where point is. 1384 Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where point is.
1388 If no reference to follow, moves to the next node, or up if none." 1385 If no reference to follow, moves to the next node, or up if none."
1389 (interactive) 1386 (interactive)
1390 (or (Info-try-follow-nearest-node) 1387 (or (Info-try-follow-nearest-node)
1391 (Info-next-preorder-1))) 1388 (Info-next-preorder)))
1392 1389
1393 ;; Common subroutine. 1390 ;; Common subroutine.
1394 (defun Info-try-follow-nearest-node () 1391 (defun Info-try-follow-nearest-node ()
1395 "Follow a node reference near point. Return non-nil if successful." 1392 "Follow a node reference near point. Return non-nil if successful."
1396 (let (node) 1393 (let (node)
1503 \\[Info-goto-node] Move to node specified by name. 1500 \\[Info-goto-node] Move to node specified by name.
1504 You may include a filename as well, as (FILENAME)NODENAME. 1501 You may include a filename as well, as (FILENAME)NODENAME.
1505 \\[universal-argument] \\[info] Move to new Info file with completion. 1502 \\[universal-argument] \\[info] Move to new Info file with completion.
1506 \\[Info-search] Search through this Info file for specified regexp, 1503 \\[Info-search] Search through this Info file for specified regexp,
1507 and select the node in which the next occurrence is found. 1504 and select the node in which the next occurrence is found.
1508 \\[Info-next-preorder] Next-preorder; that is, try to go to the next menu item,
1509 and if that fails try to move up, and if that fails, tell user
1510 he/she is done reading.
1511 \\[Info-next-reference] Move cursor to next cross-reference or menu item. 1505 \\[Info-next-reference] Move cursor to next cross-reference or menu item.
1512 \\[Info-prev-reference] Move cursor to previous cross-reference or menu item." 1506 \\[Info-prev-reference] Move cursor to previous cross-reference or menu item."
1513 (kill-all-local-variables) 1507 (kill-all-local-variables)
1514 (setq major-mode 'Info-mode) 1508 (setq major-mode 'Info-mode)
1515 (setq mode-name "Info") 1509 (setq mode-name "Info")