aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/info.el155
2 files changed, 97 insertions, 71 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b9782a19545..6caad6e2854 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12005-11-01 Juri Linkov <juri@jurta.org>
2
3 * info.el (Info-file-supports-index-cookies): New variable.
4 (Info-find-node-2): Check makeinfo version for index cookie support.
5 (Info-index-nodes): Search for nodes with index cookies only when
6 Info-file-supports-index-cookies is t. Otherwise, search nodes
7 with "Index" in the node name.
8 (Info-index-node): Search index cookie in the current node only when
9 Info-file-supports-index-cookies is t. Otherwise, check the word
10 "Index" in the node name.
11 (Info-find-emacs-command-nodes): Remove code that searches nodes
12 with "Index" node name in the top menu.
13
12005-11-01 Stefan Monnier <monnier@iro.umontreal.ca> 142005-11-01 Stefan Monnier <monnier@iro.umontreal.ca>
2 15
3 * progmodes/scheme.el (scheme-mode-variables): Use the default 16 * progmodes/scheme.el (scheme-mode-variables): Use the default
diff --git a/lisp/info.el b/lisp/info.el
index ec74160188a..2c85cc9d9ab 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -310,6 +310,9 @@ Marker points nowhere if file has no tag table.")
310(defvar Info-current-file-completions nil 310(defvar Info-current-file-completions nil
311 "Cached completion list for current Info file.") 311 "Cached completion list for current Info file.")
312 312
313(defvar Info-file-supports-index-cookies nil
314 "Non-nil if current Info file supports index cookies.")
315
313(defvar Info-index-alternatives nil 316(defvar Info-index-alternatives nil
314 "List of possible matches for last `Info-index' command.") 317 "List of possible matches for last `Info-index' command.")
315 318
@@ -842,6 +845,19 @@ a case-insensitive match is tried."
842 (info-insert-file-contents filename nil) 845 (info-insert-file-contents filename nil)
843 (setq default-directory (file-name-directory filename)))) 846 (setq default-directory (file-name-directory filename))))
844 (set-buffer-modified-p nil) 847 (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
845 ;; See whether file has a tag table. Record the location if yes. 861 ;; See whether file has a tag table. Record the location if yes.
846 (goto-char (point-max)) 862 (goto-char (point-max))
847 (forward-line -8) 863 (forward-line -8)
@@ -2649,62 +2665,63 @@ following nodes whose names also contain the word \"Index\"."
2649 (and (member file '("dir" "history" "toc" "apropos")) 2665 (and (member file '("dir" "history" "toc" "apropos"))
2650 (setq Info-index-nodes (cons (cons file nil) Info-index-nodes))) 2666 (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2651 (not (stringp file)) 2667 (not (stringp file))
2652 ;; Find nodes with index cookie 2668 (if Info-file-supports-index-cookies
2653 (let* ((default-directory (or (and (stringp file) 2669 ;; Find nodes with index cookie
2654 (file-name-directory 2670 (let* ((default-directory (or (and (stringp file)
2655 (setq file (Info-find-file file)))) 2671 (file-name-directory
2656 default-directory)) 2672 (setq file (Info-find-file file))))
2657 Info-history Info-history-list Info-fontify-maximum-menu-size 2673 default-directory))
2658 (main-file file) subfiles nodes node) 2674 Info-history Info-history-list Info-fontify-maximum-menu-size
2659 (condition-case nil 2675 (main-file file) subfiles nodes node)
2660 (with-temp-buffer 2676 (condition-case nil
2661 (while (or main-file subfiles) 2677 (with-temp-buffer
2662 (erase-buffer) 2678 (while (or main-file subfiles)
2663 (info-insert-file-contents (or main-file (car subfiles))) 2679 (erase-buffer)
2664 (goto-char (point-min)) 2680 (info-insert-file-contents (or main-file (car subfiles)))
2665 (while (search-forward "\0\b[index\0\b]" nil 'move) 2681 (goto-char (point-min))
2666 (save-excursion 2682 (while (search-forward "\0\b[index\0\b]" nil 'move)
2667 (re-search-backward "^\^_") 2683 (save-excursion
2668 (search-forward "Node: ") 2684 (re-search-backward "^\^_")
2669 (setq nodes (cons (Info-following-node-name) nodes)))) 2685 (search-forward "Node: ")
2670 (if main-file 2686 (setq nodes (cons (Info-following-node-name) nodes))))
2671 (save-excursion 2687 (if main-file
2672 (goto-char (point-min)) 2688 (save-excursion
2673 (if (search-forward "\n\^_\nIndirect:" nil t) 2689 (goto-char (point-min))
2674 (let ((bound (save-excursion (search-forward "\n\^_" nil t)))) 2690 (if (search-forward "\n\^_\nIndirect:" nil t)
2675 (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t) 2691 (let ((bound (save-excursion (search-forward "\n\^_" nil t))))
2676 (setq subfiles (cons (match-string-no-properties 1) 2692 (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t)
2677 subfiles))))) 2693 (setq subfiles (cons (match-string-no-properties 1)
2678 (setq subfiles (nreverse subfiles) 2694 subfiles)))))
2679 main-file nil)) 2695 (setq subfiles (nreverse subfiles)
2680 (setq subfiles (cdr subfiles))))) 2696 main-file nil))
2681 (error nil)) 2697 (setq subfiles (cdr subfiles)))))
2682 (if nodes 2698 (error nil))
2683 (setq nodes (nreverse nodes) 2699 (if nodes
2684 Info-index-nodes (cons (cons file nodes) Info-index-nodes))) 2700 (setq nodes (nreverse nodes)
2685 nodes) 2701 Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2686 ;; Find nodes with the word "Index" in the node name 2702 nodes)
2687 (let ((case-fold-search t) 2703 ;; Else find nodes with the word "Index" in the node name
2688 Info-history Info-history-list Info-fontify-maximum-menu-size 2704 (let ((case-fold-search t)
2689 nodes node) 2705 Info-history Info-history-list Info-fontify-maximum-menu-size
2690 (condition-case nil 2706 nodes node)
2691 (with-temp-buffer 2707 (condition-case nil
2692 (Info-mode) 2708 (with-temp-buffer
2693 (Info-find-node file "Top") 2709 (Info-mode)
2694 (when (and (search-forward "\n* menu:" nil t) 2710 (Info-find-node file "Top")
2695 (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)) 2711 (when (and (search-forward "\n* menu:" nil t)
2696 (goto-char (match-beginning 1)) 2712 (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))
2697 (setq nodes (list (Info-extract-menu-node-name))) 2713 (goto-char (match-beginning 1))
2698 (Info-goto-node (car nodes)) 2714 (setq nodes (list (Info-extract-menu-node-name)))
2699 (while (and (setq node (Info-extract-pointer "next" t)) 2715 (Info-goto-node (car nodes))
2700 (string-match "\\<Index\\>" node)) 2716 (while (and (setq node (Info-extract-pointer "next" t))
2701 (setq nodes (cons node nodes)) 2717 (string-match "\\<Index\\>" node))
2702 (Info-goto-node node)))) 2718 (setq nodes (cons node nodes))
2703 (error nil)) 2719 (Info-goto-node node))))
2704 (if nodes 2720 (error nil))
2705 (setq nodes (nreverse nodes) 2721 (if nodes
2706 Info-index-nodes (cons (cons file nodes) Info-index-nodes))) 2722 (setq nodes (nreverse nodes)
2707 nodes) 2723 Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2724 nodes))
2708 ;; If file has no index nodes, still add it to the cache 2725 ;; If file has no index nodes, still add it to the cache
2709 (setq Info-index-nodes (cons (cons file nil) Info-index-nodes))) 2726 (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2710 (cdr (assoc file Info-index-nodes))) 2727 (cdr (assoc file Info-index-nodes)))
@@ -2718,17 +2735,17 @@ If FILE is nil, check the current Info file."
2718 (member (or node Info-current-node) (Info-index-nodes file)) 2735 (member (or node Info-current-node) (Info-index-nodes file))
2719 ;; Don't search all index nodes if request is only for the current node 2736 ;; Don't search all index nodes if request is only for the current node
2720 ;; and file is not in the cache of index nodes 2737 ;; and file is not in the cache of index nodes
2721 (or 2738 (if Info-file-supports-index-cookies
2722 (save-match-data 2739 (save-excursion
2723 (string-match "\\<Index\\>" (or node Info-current-node ""))) 2740 (goto-char (+ (or (save-excursion
2724 (save-excursion 2741 (search-backward "\n\^_" nil t))
2725 (goto-char (+ (or (save-excursion 2742 (point-min)) 2))
2726 (search-backward "\n\^_" nil t)) 2743 (search-forward "\0\b[index\0\b]"
2727 (point-min)) 2)) 2744 (or (save-excursion
2728 (search-forward "\0\b[index\0\b]" 2745 (search-forward "\n\^_" nil t))
2729 (or (save-excursion 2746 (point-max)) t))
2730 (search-forward "\n\^_" nil t)) 2747 (save-match-data
2731 (point-max)) t))))) 2748 (string-match "\\<Index\\>" (or node Info-current-node ""))))))
2732 2749
2733(defun Info-goto-index () 2750(defun Info-goto-index ()
2734 "Go to the first index node." 2751 "Go to the first index node."
@@ -3504,10 +3521,6 @@ in the first element of the returned list (which is treated specially in
3504 (setq info-file file file-list nil)) 3521 (setq info-file file file-list nil))
3505 (setq file-list (cdr file-list)))))) 3522 (setq file-list (cdr file-list))))))
3506 (Info-find-node info-file "Top") 3523 (Info-find-node info-file "Top")
3507 (or (and (search-forward "\n* menu:" nil t)
3508 (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))
3509 (error "Info file `%s' appears to lack an index" info-file))
3510 (goto-char (match-beginning 1))
3511 ;; Bind Info-history to nil, to prevent the index nodes from 3524 ;; Bind Info-history to nil, to prevent the index nodes from
3512 ;; getting into the node history. 3525 ;; getting into the node history.
3513 (let ((Info-history nil) 3526 (let ((Info-history nil)