all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 12230@debbugs.gnu.org
Subject: bug#12230: 24.2; revert-buffer in an Info buffer should refresh Info-index-nodes
Date: Tue, 21 Aug 2012 03:15:14 +0300	[thread overview]
Message-ID: <87a9xphzfa.fsf@mail.jurta.org> (raw)
In-Reply-To: <83ehn2cmd7.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Aug 2012 05:45:24 +0300")

> Looks good to me, thanks.

Installed with cache invalidation for `Info-index-nodes' and
`Info-toc-nodes' (I had to put code to `info-insert-file-contents'
instead of `Info-find-file' because the full filename is available
only in the former).

There is also `Info-history' that contains information about nodes,
but I see no reasonable way to update `Info-history'
to reflect changes in the modified Info files.

BTW, let me use this opportunity to propose an improvement that restores
the original window point when returning back to the previous node.
This helps to avoid distraction when point jumps from the original
window position (displayed before leaving the Info node) to
another position (by default, center of the window):

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-08-08 08:48:57 +0000
+++ lisp/info.el	2012-08-21 00:14:18 +0000
@@ -40,11 +40,11 @@ (defgroup info nil
 
 (defvar Info-history nil
   "Stack of Info nodes user has visited.
-Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).")
+Each element of the stack is a list (FILENAME NODENAME BUFFERPOS WINDOWPOS).")
 
 (defvar Info-history-forward nil
   "Stack of Info nodes user has visited with `Info-history-back' command.
-Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).")
+Each element of the stack is a list (FILENAME NODENAME BUFFERPOS WINDOWPOS).")
 
 (defvar Info-history-list nil
   "List of all Info nodes user has visited.
@@ -888,7 +925,7 @@ (defun Info-find-node (filename nodename
   ;; Record the node we are leaving, if we were in one.
   (and (not no-going-back)
        Info-current-file
-       (push (list Info-current-file Info-current-node (point))
+       (push (list Info-current-file Info-current-node (point) (window-start))
              Info-history))
   (Info-find-node-2 filename nodename no-going-back))
 
@@ -922,7 +959,7 @@ (defun Info-revert-find-node (filename n
 	(pline        (count-lines (point-min) (line-beginning-position)))
 	(wline        (count-lines (point-min) (window-start)))
 	(new-history  (and Info-current-file
-			   (list Info-current-file Info-current-node (point)))))
+			   (list Info-current-file Info-current-node (point) (window-start)))))
     ;; When `Info-current-file' is nil, `Info-find-node-2' rereads the file.
     (setq Info-current-file nil)
     (Info-find-node filename nodename)
@@ -1192,7 +1229,8 @@ (defun Info-find-node-2 (filename nodena
         (let ((hist (car Info-history)))
           (setq Info-history (cdr Info-history))
           (Info-find-node (nth 0 hist) (nth 1 hist) t)
-          (goto-char (nth 2 hist))))))
+          (goto-char (nth 2 hist))
+	  (set-window-start (selected-window) (nth 3 hist))))))
 
 ;; Cache the contents of the (virtual) dir file, once we have merged
 ;; it for the first time, so we can save time subsequently.
@@ -1968,7 +2008,7 @@ (defun Info-search (regexp &optional bou
 	       (equal ofile Info-current-file))
           (and isearch-mode isearch-wrapped
 	       (eq opoint (if isearch-forward opoint-min opoint-max)))
-	  (setq Info-history (cons (list ofile onode opoint)
+	  (setq Info-history (cons (list ofile onode opoint ostart)
 				   Info-history))))))
 
 (defun Info-search-case-sensitively ()
@@ -2174,17 +2214,19 @@ (defun Info-history-back ()
   (or Info-history
       (user-error "This is the first Info node you looked at"))
   (let ((history-forward
-	 (cons (list Info-current-file Info-current-node (point))
+	 (cons (list Info-current-file Info-current-node (point) (window-start))
 	       Info-history-forward))
-	filename nodename opoint)
+	filename nodename opoint ostart)
     (setq filename (car (car Info-history)))
     (setq nodename (car (cdr (car Info-history))))
     (setq opoint (car (cdr (cdr (car Info-history)))))
+    (setq ostart (car (cdr (cdr (cdr (car Info-history))))))
     (setq Info-history (cdr Info-history))
     (Info-find-node filename nodename)
     (setq Info-history (cdr Info-history))
     (setq Info-history-forward history-forward)
-    (goto-char opoint)))
+    (goto-char opoint)
+    (set-window-start (selected-window) ostart)))
 
 (defalias 'Info-last 'Info-history-back)
 
@@ -2194,13 +2236,15 @@ (defun Info-history-forward ()
   (or Info-history-forward
       (user-error "This is the last Info node you looked at"))
   (let ((history-forward (cdr Info-history-forward))
-	filename nodename opoint)
+	filename nodename opoint ostart)
     (setq filename (car (car Info-history-forward)))
     (setq nodename (car (cdr (car Info-history-forward))))
     (setq opoint (car (cdr (cdr (car Info-history-forward)))))
+    (setq ostart (car (cdr (cdr (cdr (car Info-history-forward))))))
     (Info-find-node filename nodename)
     (setq Info-history-forward history-forward)
-    (goto-char opoint)))
+    (goto-char opoint)
+    (set-window-start (selected-window) ostart)))
 \f
 (add-to-list 'Info-virtual-files
 	     '("\\`dir\\'"






  reply	other threads:[~2012-08-21  0:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-18 18:15 bug#12230: 24.2; revert-buffer in an Info buffer should refresh Info-index-nodes Eli Zaretskii
2012-08-18 22:31 ` Juri Linkov
2012-08-19  2:48   ` Eli Zaretskii
2012-08-19 23:39     ` Juri Linkov
2012-08-20  2:45       ` Eli Zaretskii
2012-08-21  0:15         ` Juri Linkov [this message]
2012-08-21  6:15           ` Chong Yidong
2012-08-21 22:24             ` Juri Linkov
2012-08-21  6:49           ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a9xphzfa.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=12230@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.