/[emacs]/emacs/lisp/info.el
ViewVC logotype

Diff of /emacs/lisp/info.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.454 by rms, Wed Oct 26 16:38:36 2005 UTC revision 1.455 by jurta, Tue Nov 1 09:45:10 2005 UTC
# Line 310  Marker points nowhere if file has no tag Line 310  Marker points nowhere if file has no tag
310  (defvar Info-current-file-completions nil  (defvar Info-current-file-completions nil
311    "Cached completion list for current Info file.")    "Cached completion list for current Info file.")
312    
313    (defvar Info-file-supports-index-cookies nil
314      "Non-nil if current Info file supports index cookies.")
315    
316  (defvar Info-index-alternatives nil  (defvar Info-index-alternatives nil
317    "List of possible matches for last `Info-index' command.")    "List of possible matches for last `Info-index' command.")
318    
# Line 842  a case-insensitive match is tried." Line 845  a case-insensitive match is tried."
845                  (info-insert-file-contents filename nil)                  (info-insert-file-contents filename nil)
846                  (setq default-directory (file-name-directory filename))))                  (setq default-directory (file-name-directory filename))))
847                (set-buffer-modified-p nil)                (set-buffer-modified-p nil)
848    
849                  ;; Check makeinfo version for index cookie support
850                  (let ((found nil))
851                    (goto-char (point-min))
852                    (condition-case ()
853                        (if (and (re-search-forward
854                                  "makeinfo version \\([0-9]+.[0-9]+\\)"
855                                  (line-beginning-position 3) t)
856                                 (not (version< (match-string 1) "4.7")))
857                            (setq found t))
858                      (error nil))
859                    (set (make-local-variable 'Info-file-supports-index-cookies) found))
860    
861                ;; See whether file has a tag table.  Record the location if yes.                ;; See whether file has a tag table.  Record the location if yes.
862                (goto-char (point-max))                (goto-char (point-max))
863                (forward-line -8)                (forward-line -8)
# Line 2649  following nodes whose names also contain Line 2665  following nodes whose names also contain
2665        (and (member file '("dir" "history" "toc" "apropos"))        (and (member file '("dir" "history" "toc" "apropos"))
2666             (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))             (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2667        (not (stringp file))        (not (stringp file))
2668        ;; Find nodes with index cookie        (if Info-file-supports-index-cookies
2669        (let* ((default-directory (or (and (stringp file)            ;; Find nodes with index cookie
2670                                           (file-name-directory            (let* ((default-directory (or (and (stringp file)
2671                                            (setq file (Info-find-file file))))                                               (file-name-directory
2672                                      default-directory))                                                (setq file (Info-find-file file))))
2673               Info-history Info-history-list Info-fontify-maximum-menu-size                                          default-directory))
2674               (main-file file) subfiles nodes node)                   Info-history Info-history-list Info-fontify-maximum-menu-size
2675          (condition-case nil                   (main-file file) subfiles nodes node)
2676              (with-temp-buffer              (condition-case nil
2677                (while (or main-file subfiles)                  (with-temp-buffer
2678                  (erase-buffer)                    (while (or main-file subfiles)
2679                  (info-insert-file-contents (or main-file (car subfiles)))                      (erase-buffer)
2680                  (goto-char (point-min))                      (info-insert-file-contents (or main-file (car subfiles)))
2681                  (while (search-forward "\0\b[index\0\b]" nil 'move)                      (goto-char (point-min))
2682                    (save-excursion                      (while (search-forward "\0\b[index\0\b]" nil 'move)
2683                      (re-search-backward "^\^_")                        (save-excursion
2684                      (search-forward "Node: ")                          (re-search-backward "^\^_")
2685                      (setq nodes (cons (Info-following-node-name) nodes))))                          (search-forward "Node: ")
2686                  (if main-file                          (setq nodes (cons (Info-following-node-name) nodes))))
2687                      (save-excursion                      (if main-file
2688                        (goto-char (point-min))                          (save-excursion
2689                        (if (search-forward "\n\^_\nIndirect:" nil t)                            (goto-char (point-min))
2690                            (let ((bound (save-excursion (search-forward "\n\^_" nil t))))                            (if (search-forward "\n\^_\nIndirect:" nil t)
2691                              (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t)                                (let ((bound (save-excursion (search-forward "\n\^_" nil t))))
2692                                (setq subfiles (cons (match-string-no-properties 1)                                  (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t)
2693                                                     subfiles)))))                                    (setq subfiles (cons (match-string-no-properties 1)
2694                        (setq subfiles (nreverse subfiles)                                                         subfiles)))))
2695                              main-file nil))                            (setq subfiles (nreverse subfiles)
2696                    (setq subfiles (cdr subfiles)))))                                  main-file nil))
2697            (error nil))                        (setq subfiles (cdr subfiles)))))
2698          (if nodes                (error nil))
2699              (setq nodes (nreverse nodes)              (if nodes
2700                    Info-index-nodes (cons (cons file nodes) Info-index-nodes)))                  (setq nodes (nreverse nodes)
2701          nodes)                        Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2702        ;; Find nodes with the word "Index" in the node name              nodes)
2703        (let ((case-fold-search t)          ;; Else find nodes with the word "Index" in the node name
2704              Info-history Info-history-list Info-fontify-maximum-menu-size          (let ((case-fold-search t)
2705              nodes node)                Info-history Info-history-list Info-fontify-maximum-menu-size
2706          (condition-case nil                nodes node)
2707              (with-temp-buffer            (condition-case nil
2708                (Info-mode)                (with-temp-buffer
2709                (Info-find-node file "Top")                  (Info-mode)
2710                (when (and (search-forward "\n* menu:" nil t)                  (Info-find-node file "Top")
2711                           (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))                  (when (and (search-forward "\n* menu:" nil t)
2712                  (goto-char (match-beginning 1))                             (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))
2713                  (setq nodes (list (Info-extract-menu-node-name)))                    (goto-char (match-beginning 1))
2714                  (Info-goto-node (car nodes))                    (setq nodes (list (Info-extract-menu-node-name)))
2715                  (while (and (setq node (Info-extract-pointer "next" t))                    (Info-goto-node (car nodes))
2716                              (string-match "\\<Index\\>" node))                    (while (and (setq node (Info-extract-pointer "next" t))
2717                    (setq nodes (cons node nodes))                                (string-match "\\<Index\\>" node))
2718                    (Info-goto-node node))))                      (setq nodes (cons node nodes))
2719            (error nil))                      (Info-goto-node node))))
2720          (if nodes              (error nil))
2721              (setq nodes (nreverse nodes)            (if nodes
2722                    Info-index-nodes (cons (cons file nodes) Info-index-nodes)))                (setq nodes (nreverse nodes)
2723          nodes)                      Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2724              nodes))
2725        ;; If file has no index nodes, still add it to the cache        ;; If file has no index nodes, still add it to the cache
2726        (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))        (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2727    (cdr (assoc file Info-index-nodes)))    (cdr (assoc file Info-index-nodes)))
# Line 2718  If FILE is nil, check the current Info f Line 2735  If FILE is nil, check the current Info f
2735        (member (or node Info-current-node) (Info-index-nodes file))        (member (or node Info-current-node) (Info-index-nodes file))
2736      ;; Don't search all index nodes if request is only for the current node      ;; Don't search all index nodes if request is only for the current node
2737      ;; and file is not in the cache of index nodes      ;; and file is not in the cache of index nodes
2738      (or      (if Info-file-supports-index-cookies
2739       (save-match-data          (save-excursion
2740         (string-match "\\<Index\\>" (or node Info-current-node "")))            (goto-char (+ (or (save-excursion
2741       (save-excursion                                (search-backward "\n\^_" nil t))
2742         (goto-char (+ (or (save-excursion                              (point-min)) 2))
2743                             (search-backward "\n\^_" nil t))            (search-forward "\0\b[index\0\b]"
2744                           (point-min)) 2))                            (or (save-excursion
2745         (search-forward "\0\b[index\0\b]"                                  (search-forward "\n\^_" nil t))
2746                         (or (save-excursion                                (point-max)) t))
2747                               (search-forward "\n\^_" nil t))        (save-match-data
2748                             (point-max)) t)))))          (string-match "\\<Index\\>" (or node Info-current-node ""))))))
2749    
2750  (defun Info-goto-index ()  (defun Info-goto-index ()
2751    "Go to the first index node."    "Go to the first index node."
# Line 3504  in the first element of the returned lis Line 3521  in the first element of the returned lis
3521                  (setq info-file file file-list nil))                  (setq info-file file file-list nil))
3522              (setq file-list (cdr file-list))))))              (setq file-list (cdr file-list))))))
3523      (Info-find-node info-file "Top")      (Info-find-node info-file "Top")
     (or (and (search-forward "\n* menu:" nil t)  
              (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))  
         (error "Info file `%s' appears to lack an index" info-file))  
     (goto-char (match-beginning 1))  
3524      ;; Bind Info-history to nil, to prevent the index nodes from      ;; Bind Info-history to nil, to prevent the index nodes from
3525      ;; getting into the node history.      ;; getting into the node history.
3526      (let ((Info-history nil)      (let ((Info-history nil)

Legend:
Removed from v.1.454  
changed lines
  Added in v.1.455

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26