diff options
| author | Juri Linkov | 2012-08-21 03:12:42 +0300 |
|---|---|---|
| committer | Juri Linkov | 2012-08-21 03:12:42 +0300 |
| commit | 64cde19918824433ac8b0d753ff94cc7bfc36118 (patch) | |
| tree | cdac566b79344396a0d4447173fe446d6726eac0 | |
| parent | 24564fe1aab428c41e053b9c0848d9e7a8f2cb69 (diff) | |
| download | emacs-64cde19918824433ac8b0d753ff94cc7bfc36118.tar.gz emacs-64cde19918824433ac8b0d753ff94cc7bfc36118.zip | |
* 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.
Fixes: debbugs:12230
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/info.el | 47 |
2 files changed, 45 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a1464b52e6c..0b9a95ef352 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2012-08-21 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * info.el (Info-file-attributes): New variable. | ||
| 4 | (info-insert-file-contents): Add file attributes to | ||
| 5 | `Info-file-attributes'. Clear the caches `Info-index-nodes' and | ||
| 6 | `Info-toc-nodes' when previous modtime of the Info file is less | ||
| 7 | than new modtime. | ||
| 8 | (Info-toc-nodes, Info-index-nodes): Move definitions up to the top | ||
| 9 | of info.el. (Bug#12230) | ||
| 10 | |||
| 1 | 2012-08-20 Glenn Morris <rgm@gnu.org> | 11 | 2012-08-20 Glenn Morris <rgm@gnu.org> |
| 2 | 12 | ||
| 3 | * calendar/diary-lib.el (diary-include-files, diary-sexp-entry): | 13 | * calendar/diary-lib.el (diary-include-files, diary-sexp-entry): |
diff --git a/lisp/info.el b/lisp/info.el index 317cba86500..15478f9063c 100644 --- a/lisp/info.el +++ b/lisp/info.el | |||
| @@ -417,6 +417,21 @@ If number, the point is moved to the corresponding line.") | |||
| 417 | (defvar Info-standalone nil | 417 | (defvar Info-standalone nil |
| 418 | "Non-nil if Emacs was started solely as an Info browser.") | 418 | "Non-nil if Emacs was started solely as an Info browser.") |
| 419 | 419 | ||
| 420 | (defvar Info-file-attributes nil | ||
| 421 | "Alist of file attributes of visited Info files. | ||
| 422 | Each element is a list (FILE-NAME FILE-ATTRIBUTES...).") | ||
| 423 | |||
| 424 | (defvar Info-toc-nodes nil | ||
| 425 | "Alist of cached parent-children node information in visited Info files. | ||
| 426 | Each element is (FILE (NODE-NAME PARENT SECTION CHILDREN) ...) | ||
| 427 | where PARENT is the parent node extracted from the Up pointer, | ||
| 428 | SECTION is the section name in the Top node where this node is placed, | ||
| 429 | CHILDREN is a list of child nodes extracted from the node menu.") | ||
| 430 | |||
| 431 | (defvar Info-index-nodes nil | ||
| 432 | "Alist of cached index node names of visited Info files. | ||
| 433 | Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).") | ||
| 434 | |||
| 420 | (defvar Info-virtual-files nil | 435 | (defvar Info-virtual-files nil |
| 421 | "List of definitions of virtual Info files. | 436 | "List of definitions of virtual Info files. |
| 422 | Each element of the list has the format (FILENAME (OPERATION . HANDLER) ...) | 437 | Each element of the list has the format (FILENAME (OPERATION . HANDLER) ...) |
| @@ -609,7 +624,26 @@ Do the right thing if the file has been compressed or zipped." | |||
| 609 | (apply 'call-process-region (point-min) (point-max) | 624 | (apply 'call-process-region (point-min) (point-max) |
| 610 | (car decoder) t t nil (cdr decoder)))) | 625 | (car decoder) t t nil (cdr decoder)))) |
| 611 | (let ((inhibit-null-byte-detection t)) ; Index nodes include null bytes | 626 | (let ((inhibit-null-byte-detection t)) ; Index nodes include null bytes |
| 612 | (insert-file-contents fullname visit))))) | 627 | (insert-file-contents fullname visit))) |
| 628 | |||
| 629 | ;; Clear the caches of modified Info files. | ||
| 630 | (let* ((attribs-old (cdr (assoc fullname Info-file-attributes))) | ||
| 631 | (modtime-old (and attribs-old (nth 5 attribs-old))) | ||
| 632 | (attribs-new (and (stringp fullname) (file-attributes fullname))) | ||
| 633 | (modtime-new (and attribs-new (nth 5 attribs-new)))) | ||
| 634 | (when (and modtime-old modtime-new | ||
| 635 | (> (float-time modtime-new) (float-time modtime-old))) | ||
| 636 | (setq Info-index-nodes (remove (assoc (or Info-current-file filename) | ||
| 637 | Info-index-nodes) | ||
| 638 | Info-index-nodes)) | ||
| 639 | (setq Info-toc-nodes (remove (assoc (or Info-current-file filename) | ||
| 640 | Info-toc-nodes) | ||
| 641 | Info-toc-nodes))) | ||
| 642 | ;; Add new modtime to `Info-file-attributes'. | ||
| 643 | (setq Info-file-attributes | ||
| 644 | (cons (cons fullname attribs-new) | ||
| 645 | (remove (assoc fullname Info-file-attributes) | ||
| 646 | Info-file-attributes)))))) | ||
| 613 | 647 | ||
| 614 | (defun Info-file-supports-index-cookies (&optional file) | 648 | (defun Info-file-supports-index-cookies (&optional file) |
| 615 | "Return non-nil value if FILE supports Info index cookies. | 649 | "Return non-nil value if FILE supports Info index cookies. |
| @@ -2394,13 +2428,6 @@ Table of contents is created from the tree structure of menus." | |||
| 2394 | (message "") | 2428 | (message "") |
| 2395 | (nreverse nodes)))) | 2429 | (nreverse nodes)))) |
| 2396 | 2430 | ||
| 2397 | (defvar Info-toc-nodes nil | ||
| 2398 | "Alist of cached parent-children node information in visited Info files. | ||
| 2399 | Each element is (FILE (NODE-NAME PARENT SECTION CHILDREN) ...) | ||
| 2400 | where PARENT is the parent node extracted from the Up pointer, | ||
| 2401 | SECTION is the section name in the Top node where this node is placed, | ||
| 2402 | CHILDREN is a list of child nodes extracted from the node menu.") | ||
| 2403 | |||
| 2404 | (defun Info-toc-nodes (filename) | 2431 | (defun Info-toc-nodes (filename) |
| 2405 | "Return a node list of Info FILENAME with parent-children information. | 2432 | "Return a node list of Info FILENAME with parent-children information. |
| 2406 | This information is cached in the variable `Info-toc-nodes' with the help | 2433 | This information is cached in the variable `Info-toc-nodes' with the help |
| @@ -3032,10 +3059,6 @@ See `Info-scroll-down'." | |||
| 3032 | (if (looking-at "^\\* ") | 3059 | (if (looking-at "^\\* ") |
| 3033 | (forward-char 2))))) | 3060 | (forward-char 2))))) |
| 3034 | 3061 | ||
| 3035 | (defvar Info-index-nodes nil | ||
| 3036 | "Alist of cached index node names of visited Info files. | ||
| 3037 | Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).") | ||
| 3038 | |||
| 3039 | (defun Info-index-nodes (&optional file) | 3062 | (defun Info-index-nodes (&optional file) |
| 3040 | "Return a list of names of all index nodes in Info FILE. | 3063 | "Return a list of names of all index nodes in Info FILE. |
| 3041 | If FILE is omitted, it defaults to the current Info file. | 3064 | If FILE is omitted, it defaults to the current Info file. |