diff options
author | Juri Linkov <juri@jurta.org> | 2011-09-20 23:16:42 +0300 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2011-09-20 23:16:42 +0300 |
commit | 3820edebb4037162ddc7b4f6ccf528806185aedc (patch) | |
tree | d83d118087907657f45bb35ce6baca810e07e77f | |
parent | fd317ddfc9ff0628af84aa1e9d298cea6a208d19 (diff) | |
download | emacs-3820edebb4037162ddc7b4f6ccf528806185aedc.tar.gz |
* lisp/info.el (Info-history-skip-intermediate-nodes): New defcustom.
(Info-forward-node, Info-backward-node, Info-next-preorder)
(Info-last-preorder): Use it.
Fixes: debbugs:9528
-rw-r--r-- | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/info.el | 40 |
2 files changed, 36 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7e0da8727e1..0c16a44722a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,11 @@ 2011-09-20 Juri Linkov <juri@jurta.org> + * info.el (Info-history-skip-intermediate-nodes): New defcustom. + (Info-forward-node, Info-backward-node, Info-next-preorder) + (Info-last-preorder): Use it. (Bug#9528) + +2011-09-20 Juri Linkov <juri@jurta.org> + * info.el (Info-last-preorder): Visit last menu item only when `Info-scroll-prefer-subnodes' is non-nil (third test-case of bug#9528). diff --git a/lisp/info.el b/lisp/info.el index 3fa35bb4d03..ea23cf35568 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -52,6 +52,15 @@ Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).") "List of all Info nodes user has visited. Each element of the list is a list (FILENAME NODENAME).") +(defcustom Info-history-skip-intermediate-nodes t + "Non-nil means don't record intermediate Info nodes to the history. +Intermediate Info nodes are nodes visited by Info internally in the process of +searching the node to display. Intermediate nodes are not presented +to the user." + :type 'boolean + :group 'info + :version "24.1") + (defcustom Info-enable-edit nil "Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info can edit the current node. This is convenient if you want to write Info files by hand. @@ -2668,10 +2677,13 @@ N is the digit argument used to invoke this command." "top"))) (let ((old-node Info-current-node)) (Info-up) - (let (Info-history success) + (let ((old-history Info-history) + success) (unwind-protect (setq success (Info-forward-node t nil no-error)) - (or success (Info-goto-node old-node)))))) + (or success (Info-goto-node old-node))) + (if Info-history-skip-intermediate-nodes + (setq Info-history old-history))))) (no-error nil) (t (error "No pointer forward from this node"))))) @@ -2693,10 +2705,12 @@ N is the digit argument used to invoke this command." ;; If we move back at the same level, ;; go down to find the last subnode*. (Info-prev) - (let (Info-history) + (let ((old-history Info-history)) (while (and (not (Info-index-node)) (save-excursion (search-forward "\n* Menu:" nil t))) - (Info-goto-node (Info-extract-menu-counting nil))))) + (Info-goto-node (Info-extract-menu-counting nil))) + (if Info-history-skip-intermediate-nodes + (setq Info-history old-history)))) (t (error "No pointer backward from this node"))))) @@ -2752,8 +2766,10 @@ N is the digit argument used to invoke this command." ;; Since logically we are done with the node with that menu, ;; move on from it. But don't add intermediate nodes ;; to the history on recursive calls. - (let (Info-history) - (Info-next-preorder))) + (let ((old-history Info-history)) + (Info-next-preorder) + (if Info-history-skip-intermediate-nodes + (setq Info-history old-history)))) (t (error "No more nodes")))) @@ -2767,24 +2783,28 @@ N is the digit argument used to invoke this command." ;; so we can scroll back through it. (goto-char (point-max)))) ;; Keep going down, as long as there are nested menu nodes. - (let (Info-history) ; Don't add intermediate nodes to the history. + (let ((old-history Info-history)) (while (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))))) + (goto-char (point-max)))) + (if Info-history-skip-intermediate-nodes + (setq Info-history old-history))) (recenter -1)) ((and (Info-no-error (Info-extract-pointer "prev")) (not (equal (Info-extract-pointer "up") (Info-extract-pointer "prev")))) (Info-no-error (Info-prev)) (goto-char (point-max)) - (let (Info-history) ; Don't add intermediate nodes to the history. + (let ((old-history Info-history)) (while (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))))) + (goto-char (point-max)))) + (if Info-history-skip-intermediate-nodes + (setq Info-history old-history))) (recenter -1)) ((Info-no-error (Info-up t)) (goto-char (point-min)) |