comparison lisp/info.el @ 8489:c6088e3005cf

(Info-last-menu-item): Fix gross logic errors. (Info-last-preorder): After going thru menu item, go to end. (Info-scroll-up): Set window-start if it's out of range. Once menu start is on or above screen, start using menu items. (Info-scroll-down): Set window-start if it's out of range. If there's a menu item, always use menu.
author Richard M. Stallman <rms@gnu.org>
date Tue, 09 Aug 1994 01:41:08 +0000
parents 7f28030d9529
children ca09c53c16a6
comparison
equal deleted inserted replaced
8488:ddd8e250a65d 8489:c6088e3005cf
1071 1071
1072 (defun Info-last-menu-item () 1072 (defun Info-last-menu-item ()
1073 (interactive) 1073 (interactive)
1074 (save-excursion 1074 (save-excursion
1075 (forward-line 1) 1075 (forward-line 1)
1076 (search-backward "\n* menu:" nil t) 1076 (let ((beg (save-excursion
1077 (or (search-backward "\n* " nil t) 1077 (and (search-backward "\n* menu:" nil t)
1078 (error "No previous items in menu")) 1078 (point)))))
1079 (Info-goto-node (Info-extract-menu-node-name)))) 1079 (or (and beg (search-backward "\n* " beg t))
1080 (error "No previous items in menu")))
1081 (Info-goto-node (save-excursion
1082 (goto-char (match-end 0))
1083 (Info-extract-menu-node-name)))))
1080 1084
1081 (defmacro Info-no-error (&rest body) 1085 (defmacro Info-no-error (&rest body)
1082 (list 'condition-case nil (cons 'progn (append body '(t))) '(error nil))) 1086 (list 'condition-case nil (cons 'progn (append body '(t))) '(error nil)))
1083 1087
1084 (defun Info-next-preorder () 1088 (defun Info-next-preorder ()
1101 (error "No more nodes")))) 1105 (error "No more nodes"))))
1102 1106
1103 (defun Info-last-preorder () 1107 (defun Info-last-preorder ()
1104 "Go to the last node, popping up a level if there is none." 1108 "Go to the last node, popping up a level if there is none."
1105 (interactive) 1109 (interactive)
1106 (cond ((Info-no-error (Info-last-menu-item)) ) 1110 (cond ((Info-no-error
1111 (Info-last-menu-item)
1112 ;; If we go down a menu item, go to the end of the node
1113 ;; so we can scroll back through it.
1114 (goto-char (point-max))))
1107 ((Info-no-error (Info-up)) (forward-line -1)) 1115 ((Info-no-error (Info-up)) (forward-line -1))
1108 (t (error "No previous nodes")))) 1116 (t (error "No previous nodes"))))
1109 1117
1110 (defun Info-scroll-up () 1118 (defun Info-scroll-up ()
1111 "Read the next screen. If end of buffer is visible, go to next entry." 1119 "Read the next screen. If end of buffer is visible, go to next entry."
1112 (interactive) 1120 (interactive)
1113 (if (pos-visible-in-window-p (point-max)) 1121 (if (or (< (window-start) (point-min))
1114 (Info-next-preorder) 1122 (> (window-start) (point-max)))
1115 (scroll-up))) 1123 (set-window-start (selected-window) (point)))
1124 (let ((virtual-end (save-excursion
1125 (goto-char (point-min))
1126 (if (search-forward "\n* Menu:" nil t)
1127 (point)
1128 (point-max)))))
1129 (if (or (< virtual-end (window-start))
1130 (pos-visible-in-window-p virtual-end))
1131 (Info-next-preorder)
1132 (scroll-up))))
1116 1133
1117 (defun Info-scroll-down () 1134 (defun Info-scroll-down ()
1118 "Read the previous screen. If start of buffer is visible, go to last entry." 1135 "Read the previous screen. If start of buffer is visible, go to last entry."
1119 (interactive) 1136 (interactive)
1120 (if (pos-visible-in-window-p (point-min)) 1137 (if (or (< (window-start) (point-min))
1121 (Info-last-preorder) 1138 (> (window-start) (point-max)))
1122 (scroll-down))) 1139 (set-window-start (selected-window) (point)))
1140 (let ((virtual-end (save-excursion
1141 (goto-char (point-min))
1142 (search-forward "\n* Menu:" nil t))))
1143 (if (or virtual-end (pos-visible-in-window-p (point-min)))
1144 (Info-last-preorder)
1145 (scroll-down))))
1123 1146
1124 (defun Info-next-reference () 1147 (defun Info-next-reference ()
1125 "Move cursor to the next cross-reference or menu item in the node." 1148 "Move cursor to the next cross-reference or menu item in the node."
1126 (interactive) 1149 (interactive)
1127 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:") 1150 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:")