(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.
This commit is contained in:
parent
a06d794341
commit
0a56332b97
1 changed files with 34 additions and 11 deletions
45
lisp/info.el
45
lisp/info.el
|
@ -1073,10 +1073,14 @@ N is the digit argument used to invoke this command."
|
|||
(interactive)
|
||||
(save-excursion
|
||||
(forward-line 1)
|
||||
(search-backward "\n* menu:" nil t)
|
||||
(or (search-backward "\n* " nil t)
|
||||
(error "No previous items in menu"))
|
||||
(Info-goto-node (Info-extract-menu-node-name))))
|
||||
(let ((beg (save-excursion
|
||||
(and (search-backward "\n* menu:" nil t)
|
||||
(point)))))
|
||||
(or (and beg (search-backward "\n* " beg t))
|
||||
(error "No previous items in menu")))
|
||||
(Info-goto-node (save-excursion
|
||||
(goto-char (match-end 0))
|
||||
(Info-extract-menu-node-name)))))
|
||||
|
||||
(defmacro Info-no-error (&rest body)
|
||||
(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."
|
|||
(defun Info-last-preorder ()
|
||||
"Go to the last node, popping up a level if there is none."
|
||||
(interactive)
|
||||
(cond ((Info-no-error (Info-last-menu-item)) )
|
||||
(cond ((Info-no-error
|
||||
(Info-last-menu-item)
|
||||
;; If we go down a menu item, go to the end of the node
|
||||
;; so we can scroll back through it.
|
||||
(goto-char (point-max))))
|
||||
((Info-no-error (Info-up)) (forward-line -1))
|
||||
(t (error "No previous nodes"))))
|
||||
|
||||
(defun Info-scroll-up ()
|
||||
"Read the next screen. If end of buffer is visible, go to next entry."
|
||||
(interactive)
|
||||
(if (pos-visible-in-window-p (point-max))
|
||||
(Info-next-preorder)
|
||||
(scroll-up)))
|
||||
(if (or (< (window-start) (point-min))
|
||||
(> (window-start) (point-max)))
|
||||
(set-window-start (selected-window) (point)))
|
||||
(let ((virtual-end (save-excursion
|
||||
(goto-char (point-min))
|
||||
(if (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)
|
||||
(scroll-up))))
|
||||
|
||||
(defun Info-scroll-down ()
|
||||
"Read the previous screen. If start of buffer is visible, go to last entry."
|
||||
(interactive)
|
||||
(if (pos-visible-in-window-p (point-min))
|
||||
(Info-last-preorder)
|
||||
(scroll-down)))
|
||||
(if (or (< (window-start) (point-min))
|
||||
(> (window-start) (point-max)))
|
||||
(set-window-start (selected-window) (point)))
|
||||
(let ((virtual-end (save-excursion
|
||||
(goto-char (point-min))
|
||||
(search-forward "\n* Menu:" nil t))))
|
||||
(if (or virtual-end (pos-visible-in-window-p (point-min)))
|
||||
(Info-last-preorder)
|
||||
(scroll-down))))
|
||||
|
||||
(defun Info-next-reference ()
|
||||
"Move cursor to the next cross-reference or menu item in the node."
|
||||
|
|
Loading…
Add table
Reference in a new issue