emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/info.el,v


From: Juri Linkov
Subject: [Emacs-diffs] Changes to emacs/lisp/info.el,v
Date: Sat, 18 Oct 2008 23:43:06 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Juri Linkov <jurta>     08/10/18 23:43:05

Index: info.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/info.el,v
retrieving revision 1.548
retrieving revision 1.549
diff -u -b -r1.548 -r1.549
--- info.el     18 Oct 2008 23:04:38 -0000      1.548
+++ info.el     18 Oct 2008 23:43:05 -0000      1.549
@@ -239,6 +239,11 @@
   :type 'boolean
   :group 'info)
 
+(defcustom Info-breadcrumbs-depth 4
+  "Depth of breadcrumbs to display.
+0 means do not display breadcrumbs."
+  :type 'integer)
+
 (defcustom Info-search-whitespace-regexp "\\s-+"
   "*If non-nil, regular expression to match a sequence of whitespace chars.
 This applies to Info search for regular expressions.
@@ -307,6 +312,11 @@
 (defvar Info-file-supports-index-cookies nil
   "Non-nil if current Info file supports index cookies.")
 
+(defvar Info-file-supports-index-cookies-list nil
+  "List of Info files with information about index cookies support.
+Each element of the list is a list (FILENAME SUPPORTS-INDEX-COOKIES)
+where SUPPORTS-INDEX-COOKIES can be either t or nil.")
+
 (defvar Info-index-alternatives nil
   "List of possible matches for last `Info-index' command.")
 
@@ -459,6 +469,34 @@
                   (car decoder) t t nil (cdr decoder))))
       (insert-file-contents fullname visit))))
 
+(defun Info-file-supports-index-cookies (&optional file)
+  "Return non-nil value if FILE supports Info index cookies.
+Info index cookies were first introduced in 4.7, and all later
+makeinfo versions output them in index nodes, so we can reply
+solely on the makeinfo version.  This function caches the information
+in `Info-file-supports-index-cookies-list'."
+  (or file (setq file Info-current-file))
+  (or (assoc file Info-file-supports-index-cookies-list)
+      ;; Skip virtual Info files
+      (and (or (not (stringp file))
+              (member file '("dir" apropos history toc)))
+           (setq Info-file-supports-index-cookies-list
+                (cons (cons file nil) Info-file-supports-index-cookies-list)))
+      (save-excursion
+       (let ((found nil))
+         (goto-char (point-min))
+         (condition-case ()
+             (if (and (re-search-forward
+                       "makeinfo[ \n]version[ \n]\\([0-9]+.[0-9]+\\)"
+                       (line-beginning-position 3) t)
+                      (not (version< (match-string 1) "4.7")))
+                 (setq found t))
+           (error nil))
+         (setq Info-file-supports-index-cookies-list
+               (cons (cons file found) 
Info-file-supports-index-cookies-list)))))
+  (cdr (assoc file Info-file-supports-index-cookies-list)))
+
+
 (defun Info-default-dirs ()
   (let ((source (expand-file-name "info/" source-directory))
        (sibling (if installation-directory
@@ -845,18 +883,8 @@
                 (info-insert-file-contents filename nil)
                 (setq default-directory (file-name-directory filename))))
               (set-buffer-modified-p nil)
-
-             ;; Check makeinfo version for index cookie support
-             (let ((found nil))
-               (goto-char (point-min))
-               (condition-case ()
-                   (if (and (re-search-forward
-                             "makeinfo[ \n]version[ \n]\\([0-9]+.[0-9]+\\)"
-                             (line-beginning-position 3) t)
-                            (not (version< (match-string 1) "4.7")))
-                       (setq found t))
-                 (error nil))
-               (set (make-local-variable 'Info-file-supports-index-cookies) 
found))
+             (set (make-local-variable 'Info-file-supports-index-cookies)
+                  (Info-file-supports-index-cookies filename))
 
               ;; See whether file has a tag table.  Record the location if yes.
               (goto-char (point-max))
@@ -2750,7 +2778,7 @@
       (and (or (not (stringp file))
               (member file '("dir" apropos history toc)))
            (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
-      (if Info-file-supports-index-cookies
+      (if (Info-file-supports-index-cookies file)
          ;; Find nodes with index cookie
          (let* ((default-directory (or (and (stringp file)
                                             (file-name-directory
@@ -2787,7 +2815,7 @@
            nodes)
        ;; Else find nodes with the word "Index" in the node name
        (let ((case-fold-search t)
-             Info-history Info-history-list Info-fontify-maximum-menu-size
+             Info-history Info-history-list Info-fontify-maximum-menu-size 
Info-point-loc
              nodes node)
          (condition-case nil
              (with-temp-buffer
@@ -2815,12 +2843,13 @@
   "Return non-nil value if NODE is an index node.
 If NODE is nil, check the current Info node.
 If FILE is nil, check the current Info file."
+  (or file (setq file Info-current-file))
   (if (or (and node (not (equal node Info-current-node)))
-          (assoc (or file Info-current-file) Info-index-nodes))
+          (assoc file Info-index-nodes))
       (member (or node Info-current-node) (Info-index-nodes file))
     ;; Don't search all index nodes if request is only for the current node
     ;; and file is not in the cache of index nodes
-    (if Info-file-supports-index-cookies
+    (if (Info-file-supports-index-cookies file)
        (save-excursion
          (goto-char (+ (or (save-excursion
                              (search-backward "\n\^_" nil t))
@@ -3761,11 +3790,6 @@
     keymap)
   "Keymap to put on the Up link in the text or the header line.")
 
-(defcustom Info-breadcrumbs-depth 4
-  "Depth of breadcrumbs to display.
-0 means do not display breadcrumbs."
-  :type 'integer)
-
 (defun Info-insert-breadcrumbs ()
   (let ((nodes (Info-toc-nodes Info-current-file))
        (node Info-current-node)




reply via email to

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