diff options
author | Martin Rudalics <rudalics@gmx.at> | 2008-10-10 13:47:49 +0000 |
---|---|---|
committer | Martin Rudalics <rudalics@gmx.at> | 2008-10-10 13:47:49 +0000 |
commit | c24d482671e94c63a9408f0cb11f232fb57aef26 (patch) | |
tree | 46cb0c44c532fb7e4b290c64909d757911ed2152 /lisp | |
parent | d64d5ff59e3c16ad7e692bd225e7c113e4618f98 (diff) | |
download | emacs-c24d482671e94c63a9408f0cb11f232fb57aef26.tar.gz emacs-c24d482671e94c63a9408f0cb11f232fb57aef26.tar.bz2 emacs-c24d482671e94c63a9408f0cb11f232fb57aef26.zip |
(Info-extract-menu-counting): New argment no-detail to
skip detailed node listings.
(Info-forward-node): New argument not-up to inhibit going up.
(Info-final-node): Call Info-extract-menu-counting and
Info-forward-node with the new arguments set to avoid infinite
looping. (Bug#1116)
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 9 | ||||
-rw-r--r-- | lisp/info.el | 31 |
2 files changed, 28 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cb4bd363f8c..562f43f1f75 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2008-10-10 Martin Rudalics <rudalics@gmx.at> + + * info.el (Info-extract-menu-counting): New argment no-detail to + skip detailed node listings. + (Info-forward-node): New argument not-up to inhibit going up. + (Info-final-node): Call Info-extract-menu-counting and + Info-forward-node with the new arguments set to avoid infinite + looping. (Bug#1116) + 2008-10-10 Eli Zaretskii <eliz@gnu.org> * startup.el (command-line): Don't invoke tool-bar-mode if it is diff --git a/lisp/info.el b/lisp/info.el index 3b7603a2f83..19604424970 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -2412,17 +2412,21 @@ new buffer." (Info-extract-menu-node-name nil (Info-index-node)))))) ;; If COUNT is nil, use the last item in the menu. -(defun Info-extract-menu-counting (count) +(defun Info-extract-menu-counting (count &optional no-detail) (let ((case-fold-search t)) (save-excursion - (let ((case-fold-search t)) + (let ((case-fold-search t) + (bound (when (and no-detail + (re-search-forward + "^[ \t-]*The Detailed Node Listing" nil t)) + (match-beginning 0)))) (goto-char (point-min)) - (or (search-forward "\n* menu:" nil t) + (or (search-forward "\n* menu:" bound t) (error "No menu in this node")) (if count - (or (search-forward "\n* " nil t count) + (or (search-forward "\n* " bound t count) (error "Too few items in menu")) - (while (search-forward "\n* " nil t) + (while (search-forward "\n* " bound t) nil)) (Info-extract-menu-node-name nil (Info-index-node)))))) @@ -2445,17 +2449,19 @@ N is the digit argument used to invoke this command." (Info-goto-node "Top") (let ((Info-history nil) (case-fold-search t)) - ;; Go to the last node in the menu of Top. - (Info-goto-node (Info-extract-menu-counting nil)) + ;; Go to the last node in the menu of Top. But don't delve into + ;; detailed node listings. + (Info-goto-node (Info-extract-menu-counting nil t)) ;; If the last node in the menu is not last in pointer structure, - ;; move forward until we can't go any farther. - (while (Info-forward-node t t) nil) + ;; move forward (but not down- or upward - see bug#1116) until we + ;; can't go any farther. + (while (Info-forward-node t t t) nil) ;; Then keep moving down to last subnode, unless we reach an index. (while (and (not (Info-index-node)) (save-excursion (search-forward "\n* Menu:" nil t))) (Info-goto-node (Info-extract-menu-counting nil))))) -(defun Info-forward-node (&optional not-down no-error) +(defun Info-forward-node (&optional not-down not-up no-error) "Go forward one node, considering all nodes as forming one sequence." (interactive) (goto-char (point-min)) @@ -2473,7 +2479,8 @@ N is the digit argument used to invoke this command." ((save-excursion (search-backward "next:" nil t)) (Info-next) t) - ((and (save-excursion (search-backward "up:" nil t)) + ((and (not not-up) + (save-excursion (search-backward "up:" nil t)) ;; Use string-equal, not equal, to ignore text props. (not (string-equal (downcase (Info-extract-pointer "up")) "top"))) @@ -2481,7 +2488,7 @@ N is the digit argument used to invoke this command." (Info-up) (let (Info-history success) (unwind-protect - (setq success (Info-forward-node t no-error)) + (setq success (Info-forward-node t nil no-error)) (or success (Info-goto-node old-node)))))) (no-error nil) (t (error "No pointer forward from this node"))))) |