aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-08-09 01:41:08 +0000
committerRichard M. Stallman1994-08-09 01:41:08 +0000
commit0a56332b9703a9a6f562e68d7a0010bb2cbacc0b (patch)
tree5fbd263f6c4cb30d841edb65be4904b7c949a41b
parenta06d7943417d274c4cfd28514a17ec5f76c73b6a (diff)
downloademacs-0a56332b9703a9a6f562e68d7a0010bb2cbacc0b.tar.gz
emacs-0a56332b9703a9a6f562e68d7a0010bb2cbacc0b.zip
(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.
-rw-r--r--lisp/info.el45
1 files changed, 34 insertions, 11 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 7464e22c765..a9feb3b2281 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1073,10 +1073,14 @@ N is the digit argument used to invoke this command."
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)))
@@ -1103,23 +1107,42 @@ N is the digit argument used to invoke this command."
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."