aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/info.el55
1 files changed, 32 insertions, 23 deletions
diff --git a/lisp/info.el b/lisp/info.el
index 39908c90713..efbd3e0fcf4 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -549,28 +549,34 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
549 (setq default-directory Info-dir-contents-directory)) 549 (setq default-directory Info-dir-contents-directory))
550 550
551(defun Info-read-subfile (nodepos) 551(defun Info-read-subfile (nodepos)
552 (set-buffer (marker-buffer Info-tag-table-marker)) 552 ;; NODEPOS is either a position (in the Info file as a whole,
553 (goto-char (point-min)) 553 ;; not relative to a subfile) or the name of a subfile.
554 (search-forward "\n\^_")
555 (let (lastfilepos 554 (let (lastfilepos
556 lastfilename) 555 lastfilename)
557 (forward-line 2) 556 (if (numberp nodepos)
558 (catch 'foo 557 (save-excursion
559 (while (not (looking-at "\^_")) 558 (set-buffer (marker-buffer Info-tag-table-marker))
560 (if (not (eolp)) 559 (goto-char (point-min))
561 (let ((beg (point)) 560 (search-forward "\n\^_")
562 thisfilepos thisfilename) 561 (forward-line 2)
563 (search-forward ": ") 562 (catch 'foo
564 (setq thisfilename (buffer-substring beg (- (point) 2))) 563 (while (not (looking-at "\^_"))
565 (setq thisfilepos (read (current-buffer))) 564 (if (not (eolp))
566 ;; read in version 19 stops at the end of number. 565 (let ((beg (point))
567 ;; Advance to the next line. 566 thisfilepos thisfilename)
568 (forward-line 1) 567 (search-forward ": ")
569 (if (> thisfilepos nodepos) 568 (setq thisfilename (buffer-substring beg (- (point) 2)))
570 (throw 'foo t)) 569 (setq thisfilepos (read (current-buffer)))
571 (setq lastfilename thisfilename) 570 ;; read in version 19 stops at the end of number.
572 (setq lastfilepos thisfilepos)) 571 ;; Advance to the next line.
573 (forward-line 1)))) 572 (forward-line 1)
573 (if (> thisfilepos nodepos)
574 (throw 'foo t))
575 (setq lastfilename thisfilename)
576 (setq lastfilepos thisfilepos))
577 (forward-line 1)))))
578 (setq lastfilename nodepos)
579 (setq lastfilepos 0))
574 (set-buffer (get-buffer "*info*")) 580 (set-buffer (get-buffer "*info*"))
575 (or (equal Info-current-subfile lastfilename) 581 (or (equal Info-current-subfile lastfilename)
576 (let ((buffer-read-only nil)) 582 (let ((buffer-read-only nil))
@@ -582,7 +588,8 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
582 (setq Info-current-subfile lastfilename))) 588 (setq Info-current-subfile lastfilename)))
583 (goto-char (point-min)) 589 (goto-char (point-min))
584 (search-forward "\n\^_") 590 (search-forward "\n\^_")
585 (+ (- nodepos lastfilepos) (point)))) 591 (if (numberp nodepos)
592 (+ (- nodepos lastfilepos) (point)))))
586 593
587;; Select the info node that point is in. 594;; Select the info node that point is in.
588(defun Info-select-node () 595(defun Info-select-node ()
@@ -727,6 +734,7 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
727 (onode Info-current-node) 734 (onode Info-current-node)
728 (ofile Info-current-file) 735 (ofile Info-current-file)
729 (opoint (point)) 736 (opoint (point))
737 (ostart (window-start))
730 (osubfile Info-current-subfile)) 738 (osubfile Info-current-subfile))
731 (save-excursion 739 (save-excursion
732 (save-restriction 740 (save-restriction
@@ -771,9 +779,10 @@ In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself."
771 (message "") 779 (message "")
772 (signal 'search-failed (list regexp)))) 780 (signal 'search-failed (list regexp))))
773 (if (not found) 781 (if (not found)
774 (progn (Info-read-subfile opoint) 782 (progn (Info-read-subfile osubfile)
775 (goto-char opoint) 783 (goto-char opoint)
776 (Info-select-node))))) 784 (Info-select-node)
785 (set-window-start (selected-window) ostart)))))
777 (widen) 786 (widen)
778 (goto-char found) 787 (goto-char found)
779 (Info-select-node) 788 (Info-select-node)