# HG changeset patch # User Richard M. Stallman # Date 844642207 0 # Node ID f73d53a1b448cc55f74fc13bd67958bd89b74f83 # Parent 71e49abd59064e13d86c72bce845f8d5abb478b2 (Info-read-subfile): Allow a file name as arg. (Info-search): Restore previous subfile correctly. diff -r 71e49abd5906 -r f73d53a1b448 lisp/info.el --- a/lisp/info.el Sun Oct 06 22:49:28 1996 +0000 +++ b/lisp/info.el Sun Oct 06 22:50:07 1996 +0000 @@ -549,28 +549,34 @@ (setq default-directory Info-dir-contents-directory)) (defun Info-read-subfile (nodepos) - (set-buffer (marker-buffer Info-tag-table-marker)) - (goto-char (point-min)) - (search-forward "\n\^_") + ;; NODEPOS is either a position (in the Info file as a whole, + ;; not relative to a subfile) or the name of a subfile. (let (lastfilepos lastfilename) - (forward-line 2) - (catch 'foo - (while (not (looking-at "\^_")) - (if (not (eolp)) - (let ((beg (point)) - thisfilepos thisfilename) - (search-forward ": ") - (setq thisfilename (buffer-substring beg (- (point) 2))) - (setq thisfilepos (read (current-buffer))) - ;; read in version 19 stops at the end of number. - ;; Advance to the next line. - (forward-line 1) - (if (> thisfilepos nodepos) - (throw 'foo t)) - (setq lastfilename thisfilename) - (setq lastfilepos thisfilepos)) - (forward-line 1)))) + (if (numberp nodepos) + (save-excursion + (set-buffer (marker-buffer Info-tag-table-marker)) + (goto-char (point-min)) + (search-forward "\n\^_") + (forward-line 2) + (catch 'foo + (while (not (looking-at "\^_")) + (if (not (eolp)) + (let ((beg (point)) + thisfilepos thisfilename) + (search-forward ": ") + (setq thisfilename (buffer-substring beg (- (point) 2))) + (setq thisfilepos (read (current-buffer))) + ;; read in version 19 stops at the end of number. + ;; Advance to the next line. + (forward-line 1) + (if (> thisfilepos nodepos) + (throw 'foo t)) + (setq lastfilename thisfilename) + (setq lastfilepos thisfilepos)) + (forward-line 1))))) + (setq lastfilename nodepos) + (setq lastfilepos 0)) (set-buffer (get-buffer "*info*")) (or (equal Info-current-subfile lastfilename) (let ((buffer-read-only nil)) @@ -582,7 +588,8 @@ (setq Info-current-subfile lastfilename))) (goto-char (point-min)) (search-forward "\n\^_") - (+ (- nodepos lastfilepos) (point)))) + (if (numberp nodepos) + (+ (- nodepos lastfilepos) (point))))) ;; Select the info node that point is in. (defun Info-select-node () @@ -727,6 +734,7 @@ (onode Info-current-node) (ofile Info-current-file) (opoint (point)) + (ostart (window-start)) (osubfile Info-current-subfile)) (save-excursion (save-restriction @@ -771,9 +779,10 @@ (message "") (signal 'search-failed (list regexp)))) (if (not found) - (progn (Info-read-subfile opoint) + (progn (Info-read-subfile osubfile) (goto-char opoint) - (Info-select-node))))) + (Info-select-node) + (set-window-start (selected-window) ostart))))) (widen) (goto-char found) (Info-select-node)