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: Mon, 20 Aug 2012 02:39:29 +0300 [thread overview]
Message-ID: <87393i8n9q.fsf@mail.jurta.org> (raw)
In-Reply-To: <831uj3egws.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 19 Aug 2012 05:48:03 +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)
next prev parent reply other threads:[~2012-08-19 23:39 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 [this message]
2012-08-20 2:45 ` Eli Zaretskii
2012-08-21 0:15 ` Juri Linkov
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=87393i8n9q.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.