Show
Ignore:
Timestamp:
11/26/05 08:33:26 (3 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • vendor/emacs-CVS_HEAD/lisp/info.el

    r3939 r3988  
    291291  "Info file that Info is now looking at, or nil. 
    292292This is the name that was specified in Info, not the actual file name. 
    293 It doesn't contain directory names or file name extensions added by Info. 
    294 Can also be t when using `Info-on-current-buffer'.") 
     293It doesn't contain directory names or file name extensions added by Info.") 
    295294 
    296295(defvar Info-current-subfile nil 
     
    310309(defvar Info-current-file-completions nil 
    311310  "Cached completion list for current Info file.") 
     311 
     312(defvar Info-file-supports-index-cookies nil 
     313  "Non-nil if current Info file supports index cookies.") 
    312314 
    313315(defvar Info-index-alternatives nil 
     
    689691  (or (eq major-mode 'Info-mode) (pop-to-buffer "*info*")) 
    690692  ;; Record the node we are leaving. 
    691   (if (and Info-current-file (not no-going-back)
     693  (if (not no-going-back
    692694      (setq Info-history 
    693695            (cons (list Info-current-file Info-current-node (point)) 
     
    695697  (Info-find-node-2 filename nodename no-going-back)) 
    696698 
     699;;;###autoload 
    697700(defun Info-on-current-buffer (&optional nodename) 
    698701  "Use the `Info-mode' to browse the current Info buffer. 
     
    706709  (info-initialize) 
    707710  (Info-mode) 
    708   (set (make-local-variable 'Info-current-file) t) 
     711  (set (make-local-variable 'Info-current-file) 
     712       (or buffer-file-name 
     713           ;; If called on a non-file buffer, make a fake file name. 
     714           (concat default-directory (buffer-name)))) 
    709715  (Info-find-node-2 nil nodename)) 
    710716 
     
    724730        (wline        (count-lines (point-min) (window-start))) 
    725731        (old-history  Info-history) 
    726         (new-history (and Info-current-file 
    727                           (list Info-current-file Info-current-node (point))))) 
     732        (new-history  (list Info-current-file Info-current-node (point)))) 
    728733    (kill-buffer (current-buffer)) 
    729734    (Info-find-node filename nodename) 
     
    843848                (setq default-directory (file-name-directory filename)))) 
    844849              (set-buffer-modified-p nil) 
     850 
     851              ;; Check makeinfo version for index cookie support 
     852              (let ((found nil)) 
     853                (goto-char (point-min)) 
     854                (condition-case () 
     855                    (if (and (re-search-forward 
     856                              "makeinfo version \\([0-9]+.[0-9]+\\)" 
     857                              (line-beginning-position 3) t) 
     858                             (not (version< (match-string 1) "4.7"))) 
     859                        (setq found t)) 
     860                  (error nil)) 
     861                (set (make-local-variable 'Info-file-supports-index-cookies) found)) 
     862 
    845863              ;; See whether file has a tag table.  Record the location if yes. 
    846864              (goto-char (point-max)) 
     
    13851403               (list 
    13861404                (concat " (" 
    1387                         (file-name-nondirectory 
    1388                          (if (stringp Info-current-file) 
    1389                              Info-current-file 
    1390                            (or buffer-file-name ""))) 
    1391                         ") " 
    1392                         (or Info-current-node "")))))) 
     1405                        (if Info-current-file 
     1406                            (file-name-nondirectory Info-current-file) 
     1407                          " ") 
     1408                        ") " (or Info-current-node "")))))) 
    13931409  
    13941410;; Go to an Info node specified with a filename-and-nodename string 
     
    18691885          (old-file Info-current-file) 
    18701886          (node (Info-extract-pointer "up")) p) 
    1871       (and (or same-file (not (stringp Info-current-file))) 
     1887      (and same-file 
    18721888           (string-match "^(" node) 
    18731889           (error "Up node is in another Info file")) 
     
    19461962                       (string-equal node curr-node)) 
    19471963                  (setq p (point))) 
    1948               (insert "* " node ": (" (file-name-nondirectory file) 
     1964              (insert "* " node ": (" 
     1965                      (propertize (or (file-name-directory file) "") 'invisible t) 
     1966                      (file-name-nondirectory file) 
    19491967                      ")" node ".\n")) 
    19501968            (setq hl (cdr hl)))))) 
     
    26502668           (setq Info-index-nodes (cons (cons file nil) Info-index-nodes))) 
    26512669      (not (stringp file)) 
    2652       ;; Find nodes with index cookie 
    2653       (let* ((default-directory (or (and (stringp file) 
    2654                                          (file-name-directory 
    2655                                           (setq file (Info-find-file file)))) 
    2656                                     default-directory)) 
    2657              Info-history Info-history-list Info-fontify-maximum-menu-size 
    2658              (main-file file) subfiles nodes node) 
    2659         (condition-case nil 
    2660             (with-temp-buffer 
    2661               (while (or main-file subfiles) 
    2662                 (erase-buffer) 
    2663                 (info-insert-file-contents (or main-file (car subfiles))) 
    2664                 (goto-char (point-min)) 
    2665                 (while (search-forward "\0\b[index\0\b]" nil 'move) 
    2666                   (save-excursion 
    2667                     (re-search-backward "^\^_") 
    2668                     (search-forward "Node: ") 
    2669                     (setq nodes (cons (Info-following-node-name) nodes)))) 
    2670                 (if main-file 
    2671                     (save-excursion 
    2672                       (goto-char (point-min)) 
    2673                       (if (search-forward "\n\^_\nIndirect:" nil t) 
    2674                           (let ((bound (save-excursion (search-forward "\n\^_" nil t)))) 
    2675                             (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t) 
    2676                               (setq subfiles (cons (match-string-no-properties 1) 
    2677                                                    subfiles))))) 
    2678                       (setq subfiles (nreverse subfiles) 
    2679                             main-file nil)) 
    2680                   (setq subfiles (cdr subfiles))))) 
    2681           (error nil)) 
    2682         (if nodes 
    2683             (setq nodes (nreverse nodes) 
    2684                   Info-index-nodes (cons (cons file nodes) Info-index-nodes))) 
    2685         nodes) 
    2686       ;; Find nodes with the word "Index" in the node name 
    2687       (let ((case-fold-search t) 
    2688             Info-history Info-history-list Info-fontify-maximum-menu-size 
    2689             nodes node) 
    2690         (condition-case nil 
    2691             (with-temp-buffer 
    2692               (Info-mode) 
    2693               (Info-find-node file "Top") 
    2694               (when (and (search-forward "\n* menu:" nil t) 
    2695                          (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)) 
    2696                 (goto-char (match-beginning 1)) 
    2697                 (setq nodes (list (Info-extract-menu-node-name))) 
    2698                 (Info-goto-node (car nodes)) 
    2699                 (while (and (setq node (Info-extract-pointer "next" t)) 
    2700                             (string-match "\\<Index\\>" node)) 
    2701                   (setq nodes (cons node nodes)) 
    2702                   (Info-goto-node node)))) 
    2703           (error nil)) 
    2704         (if nodes 
    2705             (setq nodes (nreverse nodes) 
    2706                   Info-index-nodes (cons (cons file nodes) Info-index-nodes))) 
    2707         nodes) 
     2670      (if Info-file-supports-index-cookies 
     2671          ;; Find nodes with index cookie 
     2672          (let* ((default-directory (or (and (stringp file) 
     2673                                             (file-name-directory 
     2674                                              (setq file (Info-find-file file)))) 
     2675                                        default-directory)) 
     2676                 Info-history Info-history-list Info-fontify-maximum-menu-size 
     2677                 (main-file file) subfiles nodes node) 
     2678            (condition-case nil 
     2679                (with-temp-buffer 
     2680                  (while (or main-file subfiles) 
     2681                    (erase-buffer) 
     2682                    (info-insert-file-contents (or main-file (car subfiles))) 
     2683                    (goto-char (point-min)) 
     2684                    (while (search-forward "\0\b[index\0\b]" nil 'move) 
     2685                      (save-excursion 
     2686                        (re-search-backward "^\^_") 
     2687                        (search-forward "Node: ") 
     2688                        (setq nodes (cons (Info-following-node-name) nodes)))) 
     2689                    (if main-file 
     2690                        (save-excursion 
     2691                          (goto-char (point-min)) 
     2692                          (if (search-forward "\n\^_\nIndirect:" nil t) 
     2693                              (let ((bound (save-excursion (search-forward "\n\^_" nil t)))) 
     2694                                (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t) 
     2695                                  (setq subfiles (cons (match-string-no-properties 1) 
     2696                                                       subfiles))))) 
     2697                          (setq subfiles (nreverse subfiles) 
     2698                                main-file nil)) 
     2699                      (setq subfiles (cdr subfiles))))) 
     2700              (error nil)) 
     2701            (if nodes 
     2702                (setq nodes (nreverse nodes) 
     2703                      Info-index-nodes (cons (cons file nodes) Info-index-nodes))) 
     2704            nodes) 
     2705        ;; Else find nodes with the word "Index" in the node name 
     2706        (let ((case-fold-search t) 
     2707              Info-history Info-history-list Info-fontify-maximum-menu-size 
     2708              nodes node) 
     2709          (condition-case nil 
     2710              (with-temp-buffer 
     2711                (Info-mode) 
     2712                (Info-find-node file "Top") 
     2713                (when (and (search-forward "\n* menu:" nil t) 
     2714                           (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)) 
     2715                  (goto-char (match-beginning 1)) 
     2716                  (setq nodes (list (Info-extract-menu-node-name))) 
     2717                  (Info-goto-node (car nodes)) 
     2718                  (while (and (setq node (Info-extract-pointer "next" t)) 
     2719                              (string-match "\\<Index\\>" node)) 
     2720                    (setq nodes (cons node nodes)) 
     2721                    (Info-goto-node node)))) 
     2722            (error nil)) 
     2723          (if nodes 
     2724              (setq nodes (nreverse nodes) 
     2725                    Info-index-nodes (cons (cons file nodes) Info-index-nodes))) 
     2726          nodes)) 
    27082727      ;; If file has no index nodes, still add it to the cache 
    27092728      (setq Info-index-nodes (cons (cons file nil) Info-index-nodes))) 
     
    27192738    ;; Don't search all index nodes if request is only for the current node 
    27202739    ;; and file is not in the cache of index nodes 
    2721     (or 
    2722      (save-match-data 
    2723        (string-match "\\<Index\\>" (or node Info-current-node ""))) 
    2724      (save-excursion 
    2725        (goto-char (+ (or (save-excursion 
    2726                            (search-backward "\n\^_" nil t)) 
    2727                          (point-min)) 2)) 
    2728        (search-forward "\0\b[index\0\b]" 
    2729                        (or (save-excursion 
    2730                              (search-forward "\n\^_" nil t)) 
    2731                            (point-max)) t))))) 
     2740    (if Info-file-supports-index-cookies 
     2741        (save-excursion 
     2742          (goto-char (+ (or (save-excursion 
     2743                              (search-backward "\n\^_" nil t)) 
     2744                            (point-min)) 2)) 
     2745          (search-forward "\0\b[index\0\b]" 
     2746                          (or (save-excursion 
     2747                                (search-forward "\n\^_" nil t)) 
     2748                              (point-max)) t)) 
     2749      (save-match-data 
     2750       (string-match "\\<Index\\>" (or node Info-current-node "")))))) 
    27322751 
    27332752(defun Info-goto-index () 
     
    31633182      (let ((map (make-sparse-keymap))) 
    31643183        (tool-bar-local-item-from-menu 'Info-exit "close" map Info-mode-map) 
    3165         (tool-bar-local-item-from-menu 'Info-prev "left-arrow" map Info-mode-map) 
    3166         (tool-bar-local-item-from-menu 'Info-next "right-arrow" map Info-mode-map) 
    3167         (tool-bar-local-item-from-menu 'Info-up "up-arrow" map Info-mode-map) 
    3168         (tool-bar-local-item-from-menu 'Info-history-back "back-arrow" map Info-mode-map) 
    3169         (tool-bar-local-item-from-menu 'Info-history-forward "fwd-arrow" map Info-mode-map) 
     3184        (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map) 
     3185        (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map) 
     3186        (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map) 
     3187        (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map) 
     3188        (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map) 
    31703189        (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map) 
    31713190        (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map) 
     
    32483267  (unless Info-current-node 
    32493268    (error "No current Info node")) 
    3250   (let ((node (concat "(" (file-name-nondirectory 
    3251                            (or (and (stringp Info-current-file) 
    3252                                     Info-current-file) 
    3253                                buffer-file-name 
    3254                                "")) 
    3255                       ")" Info-current-node))) 
     3269  (let ((node (concat "(" (file-name-nondirectory Info-current-file) ")" 
     3270                      Info-current-node))) 
    32563271    (if (zerop (prefix-numeric-value arg)) 
    32573272        (setq node (concat "(info \"" node "\")"))) 
     
    35053520            (setq file-list (cdr file-list)))))) 
    35063521    (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)) 
    35113522    ;; Bind Info-history to nil, to prevent the index nodes from 
    35123523    ;; getting into the node history. 
     
    36503661                 (tbeg (match-beginning 1)) 
    36513662                 (tag (match-string 1))) 
    3652             (if (string-equal tag "Node") 
     3663            (if (string-equal (downcase tag) "node") 
    36533664                (put-text-property nbeg nend 'font-lock-face 'info-header-node) 
    36543665              (put-text-property nbeg nend 'font-lock-face 'info-header-xref) 
     
    36613672              ;; It will either be used in the buffer 
    36623673              ;; or copied in the header line. 
    3663               (put-text-property tbeg nend 'keymap 
    3664                                  (cond 
    3665                                   ((equal tag "Prev") Info-prev-link-keymap) 
    3666                                   ((equal tag "Next") Info-next-link-keymap) 
    3667                                   ((equal tag "Up") Info-up-link-keymap)))))) 
     3674              (put-text-property 
     3675               tbeg nend 'keymap 
     3676               (cond 
     3677                ((string-equal (downcase tag) "prev") Info-prev-link-keymap) 
     3678                ((string-equal (downcase tag) "next") Info-next-link-keymap) 
     3679                ((string-equal (downcase tag) "up"  ) Info-up-link-keymap)))))) 
    36683680        (when Info-use-header-line 
    36693681          (goto-char (point-min)) 
     
    37073719                    ;; counter example is when a continuation "..." is alone 
    37083720                    ;; on a line. 
    3709                     (= (- (match-end 1) (match-beginning 1)) 
    3710                        (- (match-end 2) (match-beginning 2)))) 
     3721                    (= (string-width (match-string 1)) 
     3722                       (string-width (match-string 2)))) 
    37113723          (let* ((c (preceding-char)) 
    37123724                 (face 
     
    37423754                    (skip-syntax-backward " (")) 
    37433755                  (setq other-tag 
    3744                         (cond ((memq (char-before) '(nil ?\. ?! ??)) 
     3756                        (cond ((save-match-data (looking-back "\\<see")) 
     3757                               "") 
     3758                              ((memq (char-before) '(nil ?\. ?! ??)) 
    37453759                               "See ") 
    37463760                              ((save-match-data 
     
    37873801                                                  (match-string 4)) 
    37883802                                             (match-string 2))))) 
    3789                                  (file (file-name-nondirectory 
    3790                                         Info-current-file)) 
     3803                                 (file Info-current-file) 
    37913804                                 (hl Info-history-list) 
    37923805                                 res) 
    37933806                            (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) 
    3794                                 (setq file (file-name-nondirectory 
    3795                                             (match-string 1 node)) 
     3807                                (setq file (Info-find-file (match-string 1 node)) 
    37963808                                      node (if (equal (match-string 2 node) "") 
    37973809                                               "Top" 
    37983810                                             (match-string 2 node)))) 
    3799                             (while hl 
    3800                               (if (and (string-equal node (nth 1 (car hl))) 
    3801                                        (string-equal file 
    3802                                                      (file-name-nondirectory 
    3803                                                       (nth 0 (car hl))))) 
    3804                                   (setq res (car hl) hl nil) 
    3805                                 (setq hl (cdr hl)))) 
     3811                            (while hl 
     3812                              (if (and (string-equal node (nth 1 (car hl))) 
     3813                                       (string-equal file (nth 0 (car hl)))) 
     3814                                  (setq res (car hl) hl nil) 
     3815                                (setq hl (cdr hl)))) 
    38063816                            res))) 'info-xref-visited 'info-xref)) 
    38073817              ;; For multiline ref, unfontify newline and surrounding whitespace 
     
    38963906                                            (match-string 1) 
    38973907                                          (match-string 3))) 
    3898                                   (file (file-name-nondirectory Info-current-file)
     3908                                  (file Info-current-file
    38993909                                  (hl Info-history-list) 
    39003910                                  res) 
    39013911                              (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node) 
    3902                                   (setq file (file-name-nondirectory 
    3903                                               (match-string 1 node)) 
     3912                                  (setq file (Info-find-file (match-string 1 node)) 
    39043913                                        node (if (equal (match-string 2 node) "") 
    39053914                                                 "Top" 
    39063915                                               (match-string 2 node)))) 
    3907                               (while hl 
    3908                                 (if (and (string-equal node (nth 1 (car hl))) 
    3909                                          (string-equal file 
    3910                                                        (file-name-nondirectory 
    3911                                                         (nth 0 (car hl))))) 
    3912                                     (setq res (car hl) hl nil) 
    3913                                   (setq hl (cdr hl)))) 
     3916                              (while hl 
     3917                                (if (and (string-equal node (nth 1 (car hl))) 
     3918                                         (string-equal file (nth 0 (car hl)))) 
     3919                                    (setq res (car hl) hl nil) 
     3920                                  (setq hl (cdr hl)))) 
    39143921                              res))) 'info-xref-visited 'info-xref))) 
    39153922              (when (and not-fontified-p (memq Info-hide-note-references '(t hide))) 
     
    41044111  (save-excursion 
    41054112    ;; Set up a buffer we can use to fake-out Info. 
    4106     (set-buffer (get-buffer-create "*info-browse-tmp*")) 
     4113    (set-buffer (get-buffer-create " *info-browse-tmp*")) 
    41074114    (if (not (equal major-mode 'Info-mode)) 
    41084115        (Info-mode))