Commit 3820edeb authored by Juri Linkov's avatar Juri Linkov

* 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
parent fd317ddf
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
......
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment