/[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.304.2.12 by miles, Thu Apr 29 10:59:09 2004 UTC revision 1.304.2.13 by miles, Tue Jul 6 09:31:48 2004 UTC
# Line 863  a case-insensitive match is tried." Line 863  a case-insensitive match is tried."
863                (let ((pos (Info-find-node-in-buffer regexp)))                (let ((pos (Info-find-node-in-buffer regexp)))
864                  (when pos                  (when pos
865                    (goto-char pos)                    (goto-char pos)
866                    (throw 'foo t))                    (throw 'foo t)))
867                  ;; No such anchor in tag table or node in tag table or file  
868                  (error "No such node or anchor: %s" nodename)))                (when (string-match "\\([^.]+\\)\\." nodename)
869                    (let (Info-point-loc)
870                      (Info-find-node-2
871                       filename (match-string 1 nodename) no-going-back))
872                    (widen)
873                    (throw 'foo t))
874    
875                  ;; No such anchor in tag table or node in tag table or file
876                  (error "No such node or anchor: %s" nodename))
877    
878              (Info-select-node)              (Info-select-node)
879              (goto-char (point-min))              (goto-char (point-min))
# Line 1075  a case-insensitive match is tried." Line 1083  a case-insensitive match is tried."
1083      (goto-char (point-min))      (goto-char (point-min))
1084      ;; Remove duplicate headings in the same menu.      ;; Remove duplicate headings in the same menu.
1085      (while (search-forward "\n* Menu:" nil t)      (while (search-forward "\n* Menu:" nil t)
1086        (setq limit (save-excursion (search-forward "\n" nil t)))        (setq limit (save-excursion (search-forward "\n\^_" nil t)))
1087        ;; Look for the next heading to unify.        ;; Look for the next heading to unify.
1088        (while (re-search-forward "^\\(\\w.*\\)\n\\*" limit t)        (while (re-search-forward "^\\(\\w.*\\)\n\\*" limit t)
1089          (let ((name (match-string 1))          (let ((name (match-string 1))
# Line 1286  any double quotes or backslashes must be Line 1294  any double quotes or backslashes must be
1294          (let ((new-history (list Info-current-file Info-current-node)))          (let ((new-history (list Info-current-file Info-current-node)))
1295            (setq Info-history-list            (setq Info-history-list
1296                  (cons new-history (delete new-history Info-history-list))))                  (cons new-history (delete new-history Info-history-list))))
1297          (Info-fontify-node)          (if (not (eq Info-fontify-maximum-menu-size nil))
1298                (Info-fontify-node))
1299          (Info-display-images-node)          (Info-display-images-node)
1300          (Info-hide-cookies-node)          (Info-hide-cookies-node)
1301          (run-hooks 'Info-selection-hook)))))          (run-hooks 'Info-selection-hook)))))
# Line 1646  If SAME-FILE is non-nil, do not move to Line 1655  If SAME-FILE is non-nil, do not move to
1655        (let ((inhibit-read-only t))        (let ((inhibit-read-only t))
1656          (erase-buffer)          (erase-buffer)
1657          (goto-char (point-min))          (goto-char (point-min))
1658          (insert "\n\nFile: history Node: Top, Up: (dir)\n\n")          (insert "\n\^_\nFile: history Node: Top, Up: (dir)\n\n")
1659          (insert "Recently Visited Nodes\n**********************\n\n")          (insert "Recently Visited Nodes\n**********************\n\n")
1660          (insert "* Menu:\n\n")          (insert "* Menu:\n\n")
1661          (let ((hl (delete '("history" "Top") Info-history-list)))          (let ((hl (delete '("history" "Top") Info-history-list)))
# Line 1673  If SAME-FILE is non-nil, do not move to Line 1682  If SAME-FILE is non-nil, do not move to
1682              (node-list (Info-build-toc curr-file)))              (node-list (Info-build-toc curr-file)))
1683          (erase-buffer)          (erase-buffer)
1684          (goto-char (point-min))          (goto-char (point-min))
1685          (insert "\n\nFile: toc Node: Top, Up: (dir)\n\n")          (insert "\n\^_\nFile: toc Node: Top, Up: (dir)\n\n")
1686          (insert "Table of Contents\n*****************\n\n")          (insert "Table of Contents\n*****************\n\n")
1687          (insert "*Note Top::\n")          (insert "*Note Top::\n")
1688          (Info-insert-toc          (Info-insert-toc
# Line 1682  If SAME-FILE is non-nil, do not move to Line 1691  If SAME-FILE is non-nil, do not move to
1691        (if (not (bobp))        (if (not (bobp))
1692            (let ((Info-hide-note-references 'hide)            (let ((Info-hide-note-references 'hide)
1693                  (Info-fontify-visited-nodes nil))                  (Info-fontify-visited-nodes nil))
1694              (setq Info-current-node "Top")              (Info-mode)
1695                (setq Info-current-file "toc" Info-current-node "Top")
1696              (Info-fontify-node)))              (Info-fontify-node)))
1697        (goto-char (point-min))        (goto-char (point-min))
1698        (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))        (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
# Line 1707  If SAME-FILE is non-nil, do not move to Line 1717  If SAME-FILE is non-nil, do not move to
1717    (if (equal file "dir")    (if (equal file "dir")
1718        (error "Table of contents for Info directory is not supported yet"))        (error "Table of contents for Info directory is not supported yet"))
1719    (with-temp-buffer    (with-temp-buffer
1720      (let ((default-directory (or (and (stringp file)      (let* ((default-directory (or (and (stringp file)
1721                                        (file-name-directory                                         (file-name-directory
1722                                         (setq file (Info-find-file file))))                                          (setq file (Info-find-file file))))
1723                                   default-directory))                                    default-directory))
1724            (sections '(("Top" "Top")))             (main-file file)
1725            nodes subfiles)             (sections '(("Top" "Top")))
1726        (while (or file subfiles)             nodes subfiles)
1727          (or file (message "Searching subfile %s..." (car subfiles)))        (while (or main-file subfiles)
1728            (or main-file (message "Searching subfile %s..." (car subfiles)))
1729          (erase-buffer)          (erase-buffer)
1730          (info-insert-file-contents (or file (car subfiles)))          (info-insert-file-contents (or main-file (car subfiles)))
1731            (goto-char (point-min))
1732          (while (and (search-forward "\n\^_\nFile:" nil 'move)          (while (and (search-forward "\n\^_\nFile:" nil 'move)
1733                      (search-forward "Node: " nil 'move))                      (search-forward "Node: " nil 'move))
1734            (let ((nodename (substring-no-properties (Info-following-node-name)))            (let ((nodename (substring-no-properties (Info-following-node-name)))
# Line 1724  If SAME-FILE is non-nil, do not move to Line 1736  If SAME-FILE is non-nil, do not move to
1736                                (point-max)) 2))                                (point-max)) 2))
1737                  (section "Top")                  (section "Top")
1738                  menu-items)                  menu-items)
1739              (when (and (not (string-match "\\<index\\>" nodename))              (when (and (not (Info-index-node nodename file))
1740                         (re-search-forward "^\\* Menu:" bound t))                         (re-search-forward "^\\* Menu:" bound t))
1741                (forward-line 1)                (forward-line 1)
1742                (beginning-of-line)                (beginning-of-line)
# Line 1756  If SAME-FILE is non-nil, do not move to Line 1768  If SAME-FILE is non-nil, do not move to
1768                                      (nreverse menu-items))                                      (nreverse menu-items))
1769                                nodes))                                nodes))
1770              (goto-char bound)))              (goto-char bound)))
1771          (if file          (if main-file
1772              (save-excursion              (save-excursion
1773                (goto-char (point-min))                (goto-char (point-min))
1774                (if (search-forward "\n\^_\nIndirect:" nil t)                (if (search-forward "\n\^_\nIndirect:" nil t)
# Line 1765  If SAME-FILE is non-nil, do not move to Line 1777  If SAME-FILE is non-nil, do not move to
1777                        (setq subfiles (cons (match-string-no-properties 1)                        (setq subfiles (cons (match-string-no-properties 1)
1778                                             subfiles)))))                                             subfiles)))))
1779                (setq subfiles (nreverse subfiles)                (setq subfiles (nreverse subfiles)
1780                      file nil))                      main-file nil))
1781            (setq subfiles (cdr subfiles))))            (setq subfiles (cdr subfiles))))
1782        (message "")        (message "")
1783        (nreverse nodes))))        (nreverse nodes))))
# Line 1907  Because of ambiguities, this should be c Line 1919  Because of ambiguities, this should be c
1919    
1920  (defvar Info-complete-menu-buffer)  (defvar Info-complete-menu-buffer)
1921  (defvar Info-complete-next-re nil)  (defvar Info-complete-next-re nil)
1922    (defvar Info-complete-nodes nil)
1923  (defvar Info-complete-cache nil)  (defvar Info-complete-cache nil)
1924    
1925  (defconst Info-node-spec-re  (defconst Info-node-spec-re
# Line 1920  Because of ambiguities, this should be c Line 1933  Because of ambiguities, this should be c
1933    ;; - `Info-complete-next-re' which, if non-nil, indicates that we should    ;; - `Info-complete-next-re' which, if non-nil, indicates that we should
1934    ;; also look for menu items in subsequent nodes as long as those    ;; also look for menu items in subsequent nodes as long as those
1935    ;; nodes' names match `Info-complete-next-re'.  This feature is currently    ;; nodes' names match `Info-complete-next-re'.  This feature is currently
1936      ;; not used.
1937      ;; - `Info-complete-nodes' which, if non-nil, indicates that we should
1938      ;; also look for menu items in these nodes.  This feature is currently
1939    ;; only used for completion in Info-index.    ;; only used for completion in Info-index.
1940    
1941    ;; Note that `Info-complete-menu-buffer' could be current already,    ;; Note that `Info-complete-menu-buffer' could be current already,
# Line 1943  Because of ambiguities, this should be c Line 1959  Because of ambiguities, this should be c
1959            (if (and (equal (nth 0 Info-complete-cache) Info-current-file)            (if (and (equal (nth 0 Info-complete-cache) Info-current-file)
1960                     (equal (nth 1 Info-complete-cache) Info-current-node)                     (equal (nth 1 Info-complete-cache) Info-current-node)
1961                     (equal (nth 2 Info-complete-cache) Info-complete-next-re)                     (equal (nth 2 Info-complete-cache) Info-complete-next-re)
1962                       (equal (nth 5 Info-complete-cache) Info-complete-nodes)
1963                     (let ((prev (nth 3 Info-complete-cache)))                     (let ((prev (nth 3 Info-complete-cache)))
1964                       (eq t (compare-strings string 0 (length prev)                       (eq t (compare-strings string 0 (length prev)
1965                                              prev 0 nil t))))                                              prev 0 nil t))))
# Line 1955  Because of ambiguities, this should be c Line 1972  Because of ambiguities, this should be c
1972                      (push (match-string-no-properties 1)                      (push (match-string-no-properties 1)
1973                            completions))                            completions))
1974                    ;; Check subsequent nodes if applicable.                    ;; Check subsequent nodes if applicable.
1975                    (and Info-complete-next-re                    (or (and Info-complete-next-re
1976                         (setq nextnode (Info-extract-pointer "next" t))                             (setq nextnode (Info-extract-pointer "next" t))
1977                         (string-match Info-complete-next-re nextnode)))                             (string-match Info-complete-next-re nextnode))
1978                          (and Info-complete-nodes
1979                               (setq Info-complete-nodes (cdr Info-complete-nodes)
1980                                     nextnode (car Info-complete-nodes)))))
1981                (Info-goto-node nextnode))                (Info-goto-node nextnode))
1982              ;; Go back to the start node (for the next completion).              ;; Go back to the start node (for the next completion).
1983              (unless (equal Info-current-node orignode)              (unless (equal Info-current-node orignode)
# Line 1965  Because of ambiguities, this should be c Line 1985  Because of ambiguities, this should be c
1985              ;; Update the cache.              ;; Update the cache.
1986              (set (make-local-variable 'Info-complete-cache)              (set (make-local-variable 'Info-complete-cache)
1987                   (list Info-current-file Info-current-node                   (list Info-current-file Info-current-node
1988                         Info-complete-next-re string completions)))                         Info-complete-next-re string completions
1989                           Info-complete-nodes)))
1990            (if action            (if action
1991                (all-completions string completions predicate)                (all-completions string completions predicate)
1992              (try-completion string completions predicate)))))))              (try-completion string completions predicate)))))))
# Line 2034  new buffer." Line 2055  new buffer."
2055              (error "No such item in menu"))              (error "No such item in menu"))
2056          (beginning-of-line)          (beginning-of-line)
2057          (forward-char 2)          (forward-char 2)
2058          (Info-extract-menu-node-name)))))          (Info-extract-menu-node-name nil (Info-index-node))))))
2059    
2060  ;; If COUNT is nil, use the last item in the menu.  ;; If COUNT is nil, use the last item in the menu.
2061  (defun Info-extract-menu-counting (count)  (defun Info-extract-menu-counting (count)
# Line 2049  new buffer." Line 2070  new buffer."
2070                  (error "Too few items in menu"))                  (error "Too few items in menu"))
2071            (while (search-forward "\n* " nil t)            (while (search-forward "\n* " nil t)
2072              nil))              nil))
2073          (Info-extract-menu-node-name)))))          (Info-extract-menu-node-name nil (Info-index-node))))))
2074    
2075  (defun Info-nth-menu-item ()  (defun Info-nth-menu-item ()
2076    "Go to the node of the Nth menu item.    "Go to the node of the Nth menu item.
# Line 2076  N is the digit argument used to invoke t Line 2097  N is the digit argument used to invoke t
2097      ;; move forward until we can't go any farther.      ;; move forward until we can't go any farther.
2098      (while (Info-forward-node t t) nil)      (while (Info-forward-node t t) nil)
2099      ;; Then keep moving down to last subnode, unless we reach an index.      ;; Then keep moving down to last subnode, unless we reach an index.
2100      (while (and (not (string-match "\\<index\\>" Info-current-node))      (while (and (not (Info-index-node))
2101                  (save-excursion (search-forward "\n* Menu:" nil t)))                  (save-excursion (search-forward "\n* Menu:" nil t)))
2102        (Info-goto-node (Info-extract-menu-counting nil)))))        (Info-goto-node (Info-extract-menu-counting nil)))))
2103    
# Line 2092  N is the digit argument used to invoke t Line 2113  N is the digit argument used to invoke t
2113      ;;     3. next node is up and next      ;;     3. next node is up and next
2114      (cond ((and (not not-down)      (cond ((and (not not-down)
2115                  (save-excursion (search-forward "\n* menu:" nil t))                  (save-excursion (search-forward "\n* menu:" nil t))
2116                  (not (string-match "\\<index\\>" Info-current-node)))                  (not (Info-index-node)))
2117             (Info-goto-node (Info-extract-menu-counting 1))             (Info-goto-node (Info-extract-menu-counting 1))
2118             t)             t)
2119            ((save-excursion (search-backward "next:" nil t))            ((save-excursion (search-backward "next:" nil t))
# Line 2130  N is the digit argument used to invoke t Line 2151  N is the digit argument used to invoke t
2151             ;; go down to find the last subnode*.             ;; go down to find the last subnode*.
2152             (Info-prev)             (Info-prev)
2153             (let (Info-history)             (let (Info-history)
2154               (while (and (not (string-match "\\<index\\>" Info-current-node))               (while (and (not (Info-index-node))
2155                           (save-excursion (search-forward "\n* Menu:" nil t)))                           (save-excursion (search-forward "\n* Menu:" nil t)))
2156                 (Info-goto-node (Info-extract-menu-counting nil)))))                 (Info-goto-node (Info-extract-menu-counting nil)))))
2157            (t            (t
# Line 2321  parent node." Line 2342  parent node."
2342          (if recur          (if recur
2343              (error "No cross references in this node")              (error "No cross references in this node")
2344            (Info-prev-reference t)))))            (Info-prev-reference t)))))
2345    
2346    (defvar Info-index-nodes nil
2347      "Alist of cached index node names of visited Info files.
2348    Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).")
2349    
2350    (defun Info-index-nodes (&optional file)
2351      "Return a list of names of all index nodes in Info FILE.
2352    If FILE is omitted, it defaults to the current Info file.
2353    First look in a list of cached index node names.  Then scan Info
2354    file and its subfiles for nodes with the index cookie.  Then try
2355    to find index nodes starting from the first node in the top level
2356    menu whose name contains the word \"Index\", plus any immediately
2357    following nodes whose names also contain the word \"Index\"."
2358      (or file (setq file Info-current-file))
2359      (or (assoc file Info-index-nodes)
2360          ;; Skip virtual Info files
2361          (and (member file '("dir" "history" "toc" "apropos"))
2362               (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2363          (not (stringp file))
2364          ;; Find nodes with index cookie
2365          (let* ((default-directory (or (and (stringp file)
2366                                             (file-name-directory
2367                                              (setq file (Info-find-file file))))
2368                                        default-directory))
2369                 Info-history Info-history-list Info-fontify-maximum-menu-size
2370                 (main-file file) subfiles nodes node)
2371            (condition-case nil
2372                (with-temp-buffer
2373                  (while (or main-file subfiles)
2374                    (erase-buffer)
2375                    (info-insert-file-contents (or main-file (car subfiles)))
2376                    (goto-char (point-min))
2377                    (while (search-forward "\0\b[index\0\b]" nil 'move)
2378                      (save-excursion
2379                        (re-search-backward "^\^_")
2380                        (search-forward "Node: ")
2381                        (setq nodes (cons (Info-following-node-name) nodes))))
2382                    (if main-file
2383                        (save-excursion
2384                          (goto-char (point-min))
2385                          (if (search-forward "\n\^_\nIndirect:" nil t)
2386                              (let ((bound (save-excursion (search-forward "\n\^_" nil t))))
2387                                (while (re-search-forward "^\\(.*\\): [0-9]+$" bound t)
2388                                  (setq subfiles (cons (match-string-no-properties 1)
2389                                                       subfiles)))))
2390                          (setq subfiles (nreverse subfiles)
2391                                main-file nil))
2392                      (setq subfiles (cdr subfiles)))))
2393              (error nil))
2394            (if nodes
2395                (setq nodes (nreverse nodes)
2396                      Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2397            nodes)
2398          ;; Find nodes with the word "Index" in the node name
2399          (let ((case-fold-search t)
2400                Info-history Info-history-list Info-fontify-maximum-menu-size
2401                nodes node)
2402            (condition-case nil
2403                (with-temp-buffer
2404                  (Info-mode)
2405                  (Info-find-node file "Top")
2406                  (when (and (search-forward "\n* menu:" nil t)
2407                             (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t))
2408                    (goto-char (match-beginning 1))
2409                    (setq nodes (list (Info-extract-menu-node-name)))
2410                    (Info-goto-node (car nodes))
2411                    (while (and (setq node (Info-extract-pointer "next" t))
2412                                (string-match "\\<Index\\>" node))
2413                      (setq nodes (cons node nodes))
2414                      (Info-goto-node node))))
2415              (error nil))
2416            (if nodes
2417                (setq nodes (nreverse nodes)
2418                      Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2419            nodes)
2420          ;; If file has no index nodes, still add it to the cache
2421          (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2422      (cdr (assoc file Info-index-nodes)))
2423    
2424    (defun Info-index-node (&optional node file)
2425      "Return non-nil value if NODE is an index node.
2426    If NODE is nil, check the current Info node.
2427    If FILE is nil, check the current Info file."
2428      (if (or (and node (not (equal node Info-current-node)))
2429              (assoc (or file Info-current-file) Info-index-nodes))
2430          (member (or node Info-current-node) (Info-index-nodes file))
2431        ;; Don't search all index nodes if request is only for the current node
2432        ;; and file is not in the cache of index nodes
2433        (or
2434         (save-match-data
2435           (string-match "\\<Index\\>" (or node Info-current-node "")))
2436         (save-excursion
2437           (goto-char (+ (or (save-excursion
2438                               (search-backward "\n\^_" nil t))
2439                             (point-min)) 2))
2440           (search-forward "\0\b[index\0\b]"
2441                           (or (save-excursion
2442                                 (search-forward "\n\^_" nil t))
2443                               (point-max)) t)))))
2444    
2445  (defun Info-goto-index ()  (defun Info-goto-index ()
2446    (Info-goto-node "Top")    "Go to the first index node."
2447    (or (search-forward "\n* menu:" nil t)    (let ((node (car (Info-index-nodes))))
2448        (error "No index"))      (or node (error "No index"))
2449    (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)      (Info-goto-node node)))
       (error "No index"))  
   (goto-char (match-beginning 1))  
   ;; Protect Info-history so that the current node (Top) is not added to it.  
   (let ((Info-history nil))  
     (Info-goto-node (Info-extract-menu-node-name))))  
2450    
2451  ;;;###autoload  ;;;###autoload
2452  (defun Info-index (topic)  (defun Info-index (topic)
2453    "Look up a string TOPIC in the index for this file.    "Look up a string TOPIC in the index for this file.
 The index is defined as the first node in the top level menu whose  
 name contains the word \"Index\", plus any immediately following  
 nodes whose names also contain the word \"Index\".  
2454  If there are no exact matches to the specified topic, this chooses  If there are no exact matches to the specified topic, this chooses
2455  the first match which is a case-insensitive substring of a topic.  the first match which is a case-insensitive substring of a topic.
2456  Use the \\<Info-mode-map>\\[Info-index-next] command to see the other matches.  Use the \\<Info-mode-map>\\[Info-index-next] command to see the other matches.
# Line 2346  Give a blank topic name to go to the Ind Line 2458  Give a blank topic name to go to the Ind
2458    (interactive    (interactive
2459     (list     (list
2460      (let ((Info-complete-menu-buffer (clone-buffer))      (let ((Info-complete-menu-buffer (clone-buffer))
2461            (Info-complete-next-re "\\<Index\\>"))            (Info-complete-nodes (Info-index-nodes))
2462              (Info-history-list nil))
2463        (if (equal Info-current-file "dir")        (if (equal Info-current-file "dir")
2464            (error "The Info directory node has no index; use m to select a manual"))            (error "The Info directory node has no index; use m to select a manual"))
2465        (unwind-protect        (unwind-protect
# Line 2359  Give a blank topic name to go to the Ind Line 2472  Give a blank topic name to go to the Ind
2472    (let ((orignode Info-current-node)    (let ((orignode Info-current-node)
2473          (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"          (pattern (format "\n\\* +\\([^\n]*%s[^\n]*\\):[ \t]+\\([^\n]*\\)\\.\\(?:[ \t\n]*(line +\\([0-9]+\\))\\)?"
2474                           (regexp-quote topic)))                           (regexp-quote topic)))
2475          node          node (nodes (Info-index-nodes))
2476            (ohist-list Info-history-list)
2477          (case-fold-search t))          (case-fold-search t))
2478      (Info-goto-index)      (Info-goto-index)
2479      (or (equal topic "")      (or (equal topic "")
# Line 2381  Give a blank topic name to go to the Ind Line 2495  Give a blank topic name to go to the Ind
2495                                (string-to-number (concat "0"                                (string-to-number (concat "0"
2496                                                          (match-string 3))))                                                          (match-string 3))))
2497                          matches))                          matches))
2498                  (and (setq node (Info-extract-pointer "next" t))                  (setq nodes (cdr nodes) node (car nodes)))
                      (string-match "\\<Index\\>" node)))  
2499              (Info-goto-node node))              (Info-goto-node node))
2500            (or matches            (or matches
2501                (progn                (progn
# Line 2392  Give a blank topic name to go to the Ind Line 2505  Give a blank topic name to go to the Ind
2505            (while (setq found (assoc topic matches))            (while (setq found (assoc topic matches))
2506              (setq exact (cons found exact)              (setq exact (cons found exact)
2507                    matches (delq found matches)))                    matches (delq found matches)))
2508              (setq Info-history-list ohist-list)
2509            (setq Info-index-alternatives (nconc exact (nreverse matches)))            (setq Info-index-alternatives (nconc exact (nreverse matches)))
2510            (Info-index-next 0)))))            (Info-index-next 0)))))
2511    
# Line 2454  Build a menu of the possible matches." Line 2568  Build a menu of the possible matches."
2568            (ohist-list Info-history-list)            (ohist-list Info-history-list)
2569            (current-node Info-current-node)            (current-node Info-current-node)
2570            (current-file Info-current-file)            (current-file Info-current-file)
2571            manuals matches node)            manuals matches node nodes)
2572        (let ((Info-fontify-maximum-menu-size 0)        (let ((Info-fontify-maximum-menu-size nil))
             Info-use-header-lines  
             Info-hide-note-references)  
2573          (Info-directory)          (Info-directory)
2574          (message "Searching indices...")          (message "Searching indices...")
2575          (goto-char (point-min))          (goto-char (point-min))
# Line 2466  Build a menu of the possible matches." Line 2578  Build a menu of the possible matches."
2578            (add-to-list 'manuals (match-string 1)))            (add-to-list 'manuals (match-string 1)))
2579          (dolist (manual manuals)          (dolist (manual manuals)
2580            (message "Searching %s" manual)            (message "Searching %s" manual)
2581            (condition-case nil            (if (setq nodes (Info-index-nodes (Info-find-file manual)))
2582                (save-excursion                (condition-case nil
2583                  (Info-find-node manual "Top")                    (save-excursion
2584                  (when (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)                      (Info-find-node manual (car nodes))
2585                    (goto-char (match-beginning 1))                      (while
2586                    (Info-goto-node (Info-extract-menu-node-name))                          (progn
2587                    (while                            (goto-char (point-min))
2588                        (progn                            (while (re-search-forward pattern nil t)
2589                          (goto-char (point-min))                              (add-to-list 'matches
2590                          (while (re-search-forward pattern nil t)                                           (list manual
2591                            (add-to-list 'matches                                                 (match-string-no-properties 1)
2592                                         (list manual                                                 (match-string-no-properties 2)
2593                                               (match-string-no-properties 1)                                                 (match-string-no-properties 3))))
2594                                               (match-string-no-properties 2)                            (setq nodes (cdr nodes) node (car nodes)))
2595                                               (match-string-no-properties 3))))                        (Info-goto-node node)))
2596                          (and (setq node (Info-extract-pointer "next" t))                  (error nil)))))
                              (string-match "\\<Index\\>" node)))  
                     (Info-goto-node node))))  
             (error nil))))  
2597        (Info-goto-node (concat "(" current-file ")" current-node))        (Info-goto-node (concat "(" current-file ")" current-node))
2598        (setq Info-history ohist        (setq Info-history ohist
2599              Info-history-list ohist-list)              Info-history-list ohist-list)
# Line 2493  Build a menu of the possible matches." Line 2602  Build a menu of the possible matches."
2602            (message "No matches found")            (message "No matches found")
2603          (with-current-buffer (get-buffer-create " *info-apropos*")          (with-current-buffer (get-buffer-create " *info-apropos*")
2604            (erase-buffer)            (erase-buffer)
2605            (insert "\n\nFile: apropos, Node: Index, Up: (dir)\n")            (insert "\n\^_\nFile: apropos, Node: Index, Up: (dir)\n")
2606            (insert "* Menu: \nNodes whose indices contain \"" string "\"\n\n")            (insert "* Menu: \nNodes whose indices contain \"" string "\"\n\n")
2607            (dolist (entry matches)            (dolist (entry matches)
2608              (insert              (insert
# Line 2629  if point is in a menu item description, Line 2738  if point is in a menu item description,
2738       ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ")       ((Info-get-token (point) "\\* +" "\\* +\\(.*\\): ")
2739        (beginning-of-line)        (beginning-of-line)
2740        (forward-char 2)        (forward-char 2)
2741        (setq node (Info-extract-menu-node-name        (setq node (Info-extract-menu-node-name nil (Info-index-node)))
                   nil (string-match "\\<index\\>" Info-current-node)))  
2742        (Info-goto-node node fork))        (Info-goto-node node fork))
2743       ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))       ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)"))
2744        (Info-goto-node node fork))        (Info-goto-node node fork))
# Line 2683  if point is in a menu item description, Line 2791  if point is in a menu item description,
2791    (define-key Info-mode-map "p" 'Info-prev)    (define-key Info-mode-map "p" 'Info-prev)
2792    (define-key Info-mode-map "q" 'Info-exit)    (define-key Info-mode-map "q" 'Info-exit)
2793    (define-key Info-mode-map "s" 'Info-search)    (define-key Info-mode-map "s" 'Info-search)
2794      (define-key Info-mode-map "S" 'Info-search-case-sensitively)
2795    ;; For consistency with Rmail.    ;; For consistency with Rmail.
2796    (define-key Info-mode-map "\M-s" 'Info-search)    (define-key Info-mode-map "\M-s" 'Info-search)
2797    (define-key Info-mode-map "\M-n" 'clone-buffer)    (define-key Info-mode-map "\M-n" 'clone-buffer)
2798    (define-key Info-mode-map "t" 'Info-top-node)    (define-key Info-mode-map "t" 'Info-top-node)
2799    (define-key Info-mode-map "u" 'Info-up)    (define-key Info-mode-map "u" 'Info-up)
2800      ;; For consistency with dired-copy-filename-as-kill.
2801      (define-key Info-mode-map "w" 'Info-copy-current-node-name)
2802    (define-key Info-mode-map "," 'Info-index-next)    (define-key Info-mode-map "," 'Info-index-next)
2803    (define-key Info-mode-map "\177" 'Info-scroll-down)    (define-key Info-mode-map "\177" 'Info-scroll-down)
2804    (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node)    (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node)
# Line 2832  if point is in a menu item description, Line 2943  if point is in a menu item description,
2943      (error (ding))))      (error (ding))))
2944    
2945    
2946  (defun Info-copy-current-node-name ()  (defun Info-copy-current-node-name (&optional arg)
2947    "Put the name of the current info node into the kill ring.    "Put the name of the current info node into the kill ring.
2948  The name of the info file is prepended to the node name in parentheses."  The name of the info file is prepended to the node name in parentheses.
2949    (interactive)  With a zero prefix arg, put the name inside a function call to `info'."
2950      (interactive "P")
2951    (unless Info-current-node    (unless Info-current-node
2952      (error "No current info node"))      (error "No current info node"))
2953    (kill-new    (let ((node (concat "(" (file-name-nondirectory
2954     (concat "("                             (or (and (stringp Info-current-file)
2955             (file-name-nondirectory                                      Info-current-file)
2956              (if (stringp Info-current-file)                                 buffer-file-name
2957                  Info-current-file                                 ""))
2958                (or buffer-file-name "")))                        ")" Info-current-node)))
2959             ")"      (if (zerop (prefix-numeric-value arg))
2960             Info-current-node)))          (setq node (concat "(info \"" node "\")")))
2961        (kill-new node)
2962        (message "%s" node)))
2963    
2964    
2965  ;; Info mode is suitable only for specially formatted data.  ;; Info mode is suitable only for specially formatted data.
# Line 3072  The locations are of the format used in Line 3186  The locations are of the format used in
3186      ;; Bind Info-history to nil, to prevent the index nodes from      ;; Bind Info-history to nil, to prevent the index nodes from
3187      ;; getting into the node history.      ;; getting into the node history.
3188      (let ((Info-history nil)      (let ((Info-history nil)
3189            node)            (Info-history-list nil)
3190        (Info-goto-node (Info-extract-menu-node-name))            node (nodes (Info-index-nodes)))
3191          (Info-goto-node (car nodes))
3192        (while        (while
3193            (progn            (progn
3194              (goto-char (point-min))              (goto-char (point-min))
# Line 3083  The locations are of the format used in Line 3198  The locations are of the format used in
3198                                  (match-string-no-properties 2)                                  (match-string-no-properties 2)
3199                                  0)                                  0)
3200                            where)))                            where)))
3201              (and (setq node (Info-extract-pointer "next" t))              (and (setq nodes (cdr nodes) node (car nodes))))
                  (string-match "\\<Index\\>" node)))  
3202          (Info-goto-node node)))          (Info-goto-node node)))
3203      where))      where))
3204    
# Line 3111  COMMAND must be a symbol or string." Line 3225  COMMAND must be a symbol or string."
3225            ;; Bind Info-history to nil, to prevent the last Index node            ;; Bind Info-history to nil, to prevent the last Index node
3226            ;; visited by Info-find-emacs-command-nodes from being            ;; visited by Info-find-emacs-command-nodes from being
3227            ;; pushed onto the history.            ;; pushed onto the history.
3228            (let ((Info-history nil))            (let ((Info-history nil) (Info-history-list nil))
3229              (Info-find-node (car (car where))              (Info-find-node (car (car where))
3230                              (car (cdr (car where)))))                              (car (cdr (car where)))))
3231            (if (> num-matches 1)            (if (> num-matches 1)
# Line 3448  Preserve text properties." Line 3562  Preserve text properties."
3562        (goto-char (point-min))        (goto-char (point-min))
3563        (when (and (or not-fontified-p fontify-visited-p)        (when (and (or not-fontified-p fontify-visited-p)
3564                   (search-forward "\n* Menu:" nil t)                   (search-forward "\n* Menu:" nil t)
3565                   (not (string-match "\\<Index\\>" Info-current-node))                   (not (Info-index-node))
3566                   ;; Don't take time to annotate huge menus                   ;; Don't take time to annotate huge menus
3567                   (< (- (point-max) (point)) Info-fontify-maximum-menu-size))                   (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
3568          (let ((n 0)          (let ((n 0)
# Line 3537  Preserve text properties." Line 3651  Preserve text properties."
3651    
3652        ;; Hide index line numbers        ;; Hide index line numbers
3653        (goto-char (point-min))        (goto-char (point-min))
3654        (when (and not-fontified-p (string-match "\\<Index\\>" Info-current-node))        (when (and not-fontified-p (Info-index-node))
3655          (while (re-search-forward "[ \t\n]*(line +[0-9]+)" nil t)          (while (re-search-forward "[ \t\n]*(line +[0-9]+)" nil t)
3656            (put-text-property (match-beginning 0) (match-end 0)            (put-text-property (match-beginning 0) (match-end 0)
3657                               'invisible t)))                               'invisible t)))
# Line 3757  BUFFER is the buffer speedbar is request Line 3871  BUFFER is the buffer speedbar is request
3871    
3872  (defun Info-desktop-buffer-misc-data (desktop-dirname)  (defun Info-desktop-buffer-misc-data (desktop-dirname)
3873    "Auxiliary information to be saved in desktop file."    "Auxiliary information to be saved in desktop file."
3874    (list Info-current-file Info-current-node))    (if (not (member Info-current-file '("apropos" "history" "toc")))
3875          (list Info-current-file Info-current-node)))
3876    
3877  ;;;###autoload  ;;;###autoload
3878  (defun Info-restore-desktop-buffer (desktop-buffer-file-name  (defun Info-restore-desktop-buffer (desktop-buffer-file-name
# Line 3767  BUFFER is the buffer speedbar is request Line 3882  BUFFER is the buffer speedbar is request
3882    (let ((first (nth 0 desktop-buffer-misc))    (let ((first (nth 0 desktop-buffer-misc))
3883          (second (nth 1 desktop-buffer-misc)))          (second (nth 1 desktop-buffer-misc)))
3884    (when (and first second)    (when (and first second)
3885        (when desktop-buffer-name
3886          (set-buffer (get-buffer-create desktop-buffer-name))
3887          (Info-mode))
3888      (Info-find-node first second)      (Info-find-node first second)
3889      (current-buffer))))      (current-buffer))))
3890    

Legend:
Removed from v.1.304.2.12  
changed lines
  Added in v.1.304.2.13

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