GNU bug report logs - #12230
24.2; revert-buffer in an Info buffer should refresh Info-index-nodes

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sat, 18 Aug 2012 18:16:01 UTC

Severity: normal

Found in version 24.2

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 12230 <at> debbugs.gnu.org
Subject: bug#12230: 24.2; revert-buffer in an Info buffer should refresh Info-index-nodes
Date: Mon, 20 Aug 2012 02:39:29 +0300
>> Since `Info-revert-find-node' is not the right place to clear
>> the cache because the same problem can occur after killing
>> the Info buffer and revisiting the same Info manual manually,
>> perhaps the right fix would be to check the modtime of the Info file
>> in `Info-find-file' and clear the cache for modified files.
>
> That should do the trick, I think.  Thanks.

Actually there are more caches that should be cleared.
The following patch should clear them:

=== modified file 'lisp/info.el'
--- lisp/info.el	2012-08-07 16:12:20 +0000
+++ lisp/info.el	2012-08-19 23:38:18 +0000
@@ -813,6 +816,10 @@ (defun Info-node-at-bob-matching (regexp
 	 (forward-line 1)		; does the line after delimiter match REGEXP?
 	 (re-search-backward regexp beg t))))
 
+(defvar Info-file-attributes nil
+  "List of the file attributes of visited Info files.
+Each element is a list (FILE-NAME FILE-ATTRIBUTES...).")
+
 (defun Info-find-file (filename &optional noerror)
   "Return expanded FILENAME, or t if FILENAME is \"dir\".
 Optional second argument NOERROR, if t, means if file is not found
@@ -875,6 +882,22 @@ (defun Info-find-file (filename &optiona
 	(if noerror
 	    (setq filename nil)
 	  (error "Info file %s does not exist" filename)))
+      ;; Clear the caches of modified Info files.
+      (let* ((attribs-old (cdr (assoc filename Info-file-attributes)))
+	     (modtime-old (and attribs-old (nth 5 attribs-old)))
+	     (attribs-new (and (stringp filename) (file-attributes filename)))
+	     (modtime-new (and attribs-new (nth 5 attribs-new))))
+	(when (and modtime-old modtime-new
+		   (> (float-time modtime-new) (float-time modtime-old)))
+	  (setq Info-index-nodes (remove (assoc filename Info-index-nodes)
+					 Info-index-nodes))
+	  (setq Info-toc-nodes (remove (assoc filename Info-toc-nodes)
+				       Info-toc-nodes)))
+	;; Add new modtime to `Info-file-attributes'.
+	(setq Info-file-attributes
+	      (cons (cons filename attribs-new)
+		    (remove (assoc filename Info-file-attributes)
+			    Info-file-attributes))))
       filename))))
 
 (defun Info-find-node (filename nodename &optional no-going-back)




This bug report was last modified 12 years and 334 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.