emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109706: * lisp/info.el (Info-file-at


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109706: * lisp/info.el (Info-file-attributes): New variable.
Date: Tue, 21 Aug 2012 03:12:42 +0300
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109706
fixes bug: http://debbugs.gnu.org/12230
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-21 03:12:42 +0300
message:
  * lisp/info.el (Info-file-attributes): New variable.
  (info-insert-file-contents): Add file attributes to
  `Info-file-attributes'.  Clear the caches `Info-index-nodes' and
  `Info-toc-nodes' when previous modtime of the Info file is less
  than new modtime.
  (Info-toc-nodes, Info-index-nodes): Move definitions up to the top
  of info.el.
modified:
  lisp/ChangeLog
  lisp/info.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-08-20 18:13:03 +0000
+++ b/lisp/ChangeLog    2012-08-21 00:12:42 +0000
@@ -1,3 +1,13 @@
+2012-08-21  Juri Linkov  <address@hidden>
+
+       * info.el (Info-file-attributes): New variable.
+       (info-insert-file-contents): Add file attributes to
+       `Info-file-attributes'.  Clear the caches `Info-index-nodes' and
+       `Info-toc-nodes' when previous modtime of the Info file is less
+       than new modtime.
+       (Info-toc-nodes, Info-index-nodes): Move definitions up to the top
+       of info.el.  (Bug#12230)
+
 2012-08-20  Glenn Morris  <address@hidden>
 
        * calendar/diary-lib.el (diary-include-files, diary-sexp-entry):

=== modified file 'lisp/info.el'
--- a/lisp/info.el      2012-08-08 08:48:57 +0000
+++ b/lisp/info.el      2012-08-21 00:12:42 +0000
@@ -417,6 +417,21 @@
 (defvar Info-standalone nil
   "Non-nil if Emacs was started solely as an Info browser.")
 
+(defvar Info-file-attributes nil
+  "Alist of file attributes of visited Info files.
+Each element is a list (FILE-NAME FILE-ATTRIBUTES...).")
+
+(defvar Info-toc-nodes nil
+  "Alist of cached parent-children node information in visited Info files.
+Each element is (FILE (NODE-NAME PARENT SECTION CHILDREN) ...)
+where PARENT is the parent node extracted from the Up pointer,
+SECTION is the section name in the Top node where this node is placed,
+CHILDREN is a list of child nodes extracted from the node menu.")
+
+(defvar Info-index-nodes nil
+  "Alist of cached index node names of visited Info files.
+Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).")
+
 (defvar Info-virtual-files nil
   "List of definitions of virtual Info files.
 Each element of the list has the format (FILENAME (OPERATION . HANDLER) ...)
@@ -609,7 +624,26 @@
            (apply 'call-process-region (point-min) (point-max)
                   (car decoder) t t nil (cdr decoder))))
       (let ((inhibit-null-byte-detection t)) ; Index nodes include null bytes
-       (insert-file-contents fullname visit)))))
+       (insert-file-contents fullname visit)))
+
+    ;; Clear the caches of modified Info files.
+    (let* ((attribs-old (cdr (assoc fullname Info-file-attributes)))
+          (modtime-old (and attribs-old (nth 5 attribs-old)))
+          (attribs-new (and (stringp fullname) (file-attributes fullname)))
+          (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 (or Info-current-file filename)
+                                             Info-index-nodes)
+                                      Info-index-nodes))
+       (setq Info-toc-nodes (remove (assoc (or Info-current-file filename)
+                                           Info-toc-nodes)
+                                    Info-toc-nodes)))
+      ;; Add new modtime to `Info-file-attributes'.
+      (setq Info-file-attributes
+           (cons (cons fullname attribs-new)
+                 (remove (assoc fullname Info-file-attributes)
+                         Info-file-attributes))))))
 
 (defun Info-file-supports-index-cookies (&optional file)
   "Return non-nil value if FILE supports Info index cookies.
@@ -2394,13 +2428,6 @@
       (message "")
       (nreverse nodes))))
 
-(defvar Info-toc-nodes nil
-  "Alist of cached parent-children node information in visited Info files.
-Each element is (FILE (NODE-NAME PARENT SECTION CHILDREN) ...)
-where PARENT is the parent node extracted from the Up pointer,
-SECTION is the section name in the Top node where this node is placed,
-CHILDREN is a list of child nodes extracted from the node menu.")
-
 (defun Info-toc-nodes (filename)
   "Return a node list of Info FILENAME with parent-children information.
 This information is cached in the variable `Info-toc-nodes' with the help
@@ -3032,10 +3059,6 @@
       (if (looking-at "^\\* ")
          (forward-char 2)))))
 
-(defvar Info-index-nodes nil
-  "Alist of cached index node names of visited Info files.
-Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).")
-
 (defun Info-index-nodes (&optional file)
   "Return a list of names of all index nodes in Info FILE.
 If FILE is omitted, it defaults to the current Info file.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]