comparison lisp/info.el @ 29621:f03c3a69a809

Doc fixes. (Info-build-node-completions): Match Ref tags.
author Dave Love <fx@gnu.org>
date Tue, 13 Jun 2000 14:45:31 +0000
parents f1b4be7fce6d
children 4eb75bd04c1b
comparison
equal deleted inserted replaced
29620:1353775df8ea 29621:f03c3a69a809
107 This is the name that was specified in Info, not the actual file name. 107 This is the name that was specified in Info, not the actual file name.
108 It doesn't contain directory names or file name extensions added by Info. 108 It doesn't contain directory names or file name extensions added by Info.
109 Can also be t when using `Info-on-current-buffer'.") 109 Can also be t when using `Info-on-current-buffer'.")
110 110
111 (defvar Info-current-subfile nil 111 (defvar Info-current-subfile nil
112 "Info subfile that is actually in the *info* buffer now, 112 "Info subfile that is actually in the *info* buffer now.
113 or nil if current info file is not split into subfiles.") 113 nil if current info file is not split into subfiles.")
114 114
115 (defvar Info-current-node nil 115 (defvar Info-current-node nil
116 "Name of node that Info is now looking at, or nil.") 116 "Name of node that Info is now looking at, or nil.")
117 117
118 (defvar Info-tag-table-marker nil 118 (defvar Info-tag-table-marker nil
124 124
125 (defvar Info-current-file-completions nil 125 (defvar Info-current-file-completions nil
126 "Cached completion list for current Info file.") 126 "Cached completion list for current Info file.")
127 127
128 (defvar Info-index-alternatives nil 128 (defvar Info-index-alternatives nil
129 "List of possible matches for last Info-index command.") 129 "List of possible matches for last `Info-index' command.")
130 130
131 (defvar Info-standalone nil 131 (defvar Info-standalone nil
132 "Non-nil if Emacs was started solely as an Info browser.") 132 "Non-nil if Emacs was started solely as an Info browser.")
133 133
134 (defvar Info-suffix-list 134 (defvar Info-suffix-list
248 (default-directory (or (file-name-directory fullname) 248 (default-directory (or (file-name-directory fullname)
249 default-directory))) 249 default-directory)))
250 (call-process-region (point-min) (point-max) decoder t t))) 250 (call-process-region (point-min) (point-max) decoder t t)))
251 (insert-file-contents fullname visit)))) 251 (insert-file-contents fullname visit))))
252 252
253 ;; Initialize Info-directory-list, if that hasn't been done yet.
254 (defun info-initialize () 253 (defun info-initialize ()
254 "Initialize `Info-directory-list', if that hasn't been done yet."
255 (unless Info-directory-list 255 (unless Info-directory-list
256 (let ((path (getenv "INFOPATH")) 256 (let ((path (getenv "INFOPATH"))
257 (source (expand-file-name "info/" source-directory)) 257 (source (expand-file-name "info/" source-directory))
258 (sibling (if installation-directory 258 (sibling (if installation-directory
259 (expand-file-name "info/" installation-directory))) 259 (expand-file-name "info/" installation-directory)))
360 (forward-line 1) 360 (forward-line 1)
361 (setq beg (point)) 361 (setq beg (point))
362 (forward-line 1) ; does the line after delimiter match REGEXP? 362 (forward-line 1) ; does the line after delimiter match REGEXP?
363 (re-search-backward regexp beg t)))) 363 (re-search-backward regexp beg t))))
364 364
365 ;; Go to an info node specified as separate filename and nodename.
366 ;; no-going-back is non-nil if recovering from an error in this function;
367 ;; it says do not attempt further (recursive) error recovery.
368 (defun Info-find-node (filename nodename &optional no-going-back) 365 (defun Info-find-node (filename nodename &optional no-going-back)
366 "Go to an info node specified as separate FILENAME and NODENAME.
367 NO-GOING-BACK is non-nil if recovering from an error in this function;
368 it says do not attempt further (recursive) error recovery."
369 (info-initialize) 369 (info-initialize)
370 ;; Convert filename to lower case if not found as specified. 370 ;; Convert filename to lower case if not found as specified.
371 ;; Expand it. 371 ;; Expand it.
372 (if (stringp filename) 372 (if (stringp filename)
373 (let (temp temp-downcase found) 373 (let (temp temp-downcase found)
712 (if (assoc-ignore-case "top" this-buffer-nodes) 712 (if (assoc-ignore-case "top" this-buffer-nodes)
713 (setq nodes (nconc this-buffer-nodes nodes)) 713 (setq nodes (nconc this-buffer-nodes nodes))
714 (setq problems t) 714 (setq problems t)
715 (message "No `top' node in %s" Info-dir-file-name)))) 715 (message "No `top' node in %s" Info-dir-file-name))))
716 (setq others (cdr others))) 716 (setq others (cdr others)))
717 ;; Add to the main menu a menu item for each other node. 717 ;; Add to the main menu a menu item for each other node.
718 (let ((case-fold-search t) 718 (let ((case-fold-search t)
719 (re-search-forward "^\\* Menu:"))) 719 (re-search-forward "^\\* Menu:")))
720 (forward-line 1) 720 (forward-line 1)
721 (let ((menu-items '("top")) 721 (let ((menu-items '("top"))
722 (nodes nodes) 722 (nodes nodes)
723 (case-fold-search t) 723 (case-fold-search t)
814 (forward-char 1) 814 (forward-char 1)
815 (search-forward "\n\^_")) 815 (search-forward "\n\^_"))
816 (if (numberp nodepos) 816 (if (numberp nodepos)
817 (+ (- nodepos lastfilepos) (point))))) 817 (+ (- nodepos lastfilepos) (point)))))
818 818
819 ;; Select the info node that point is in.
820 (defun Info-select-node () 819 (defun Info-select-node ()
821 ;; Bind this in case the user sets it to nil. 820 "Select the info node that point is in.
821 Bind this in case the user sets it to nil."
822 (let ((case-fold-search t)) 822 (let ((case-fold-search t))
823 (save-excursion 823 (save-excursion
824 ;; Find beginning of node. 824 ;; Find beginning of node.
825 (if (search-backward "\n\^_" nil 'move) 825 (if (search-backward "\n\^_" nil 'move)
826 (forward-line 2) 826 (forward-line 2)
931 (if (marker-buffer Info-tag-table-marker) 931 (if (marker-buffer Info-tag-table-marker)
932 (let ((marker Info-tag-table-marker)) 932 (let ((marker Info-tag-table-marker))
933 (set-buffer (marker-buffer marker)) 933 (set-buffer (marker-buffer marker))
934 (widen) 934 (widen)
935 (goto-char marker) 935 (goto-char marker)
936 (while (re-search-forward "\nNode: \\(.*\\)\177" nil t) 936 (while (re-search-forward "\n\\(Node\\|Ref\\): \\(.*\\)\177" nil t)
937 (setq compl 937 (setq compl
938 (cons (list (match-string-no-properties 1)) 938 (cons (list (match-string-no-properties 2))
939 compl)))) 939 compl))))
940 (widen) 940 (widen)
941 (goto-char (point-min)) 941 (goto-char (point-min))
942 ;; If the buffer begins with a node header, process that first. 942 ;; If the buffer begins with a node header, process that first.
943 (if (Info-node-at-bob-matching node-regexp) 943 (if (Info-node-at-bob-matching node-regexp)
1036 (or (and (string-equal onode Info-current-node) 1036 (or (and (string-equal onode Info-current-node)
1037 (equal ofile Info-current-file)) 1037 (equal ofile Info-current-file))
1038 (setq Info-history (cons (list ofile onode opoint) 1038 (setq Info-history (cons (list ofile onode opoint)
1039 Info-history)))))) 1039 Info-history))))))
1040 1040
1041 ;; Extract the value of the node-pointer named NAME.
1042 ;; If there is none, use ERRORNAME in the error message;
1043 ;; if ERRORNAME is nil, just return nil.
1044 (defun Info-extract-pointer (name &optional errorname) 1041 (defun Info-extract-pointer (name &optional errorname)
1045 ;; Bind this in case the user sets it to nil. 1042 "Extract the value of the node-pointer named NAME.
1043 If there is none, use ERRORNAME in the error message;
1044 if ERRORNAME is nil, just return nil.
1045 Bind this in case the user sets it to nil."
1046 (let ((case-fold-search t)) 1046 (let ((case-fold-search t))
1047 (save-excursion 1047 (save-excursion
1048 (goto-char (point-min)) 1048 (goto-char (point-min))
1049 (forward-line 1) 1049 (forward-line 1)
1050 (if (re-search-backward (concat name ":") nil t) 1050 (if (re-search-backward (concat name ":") nil t)
1053 (Info-following-node-name)) 1053 (Info-following-node-name))
1054 (if (eq errorname t) 1054 (if (eq errorname t)
1055 nil 1055 nil
1056 (error "Node has no %s" (capitalize (or errorname name)))))))) 1056 (error "Node has no %s" (capitalize (or errorname name))))))))
1057 1057
1058 ;; Return the node name in the buffer following point.
1059 ;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
1060 ;; saying which chars may appear in the node name.
1061 (defun Info-following-node-name (&optional allowedchars) 1058 (defun Info-following-node-name (&optional allowedchars)
1059 "Return the node name in the buffer following point.
1060 ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
1061 saying which chars may appear in the node name."
1062 (skip-chars-forward " \t") 1062 (skip-chars-forward " \t")
1063 (buffer-substring-no-properties 1063 (buffer-substring-no-properties
1064 (point) 1064 (point)
1065 (progn 1065 (progn
1066 (while (looking-at (concat "[" (or allowedchars "^,\t\n") "]")) 1066 (while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
1110 "Go to the Info directory node." 1110 "Go to the Info directory node."
1111 (interactive) 1111 (interactive)
1112 (Info-find-node "dir" "top")) 1112 (Info-find-node "dir" "top"))
1113 1113
1114 (defun Info-follow-reference (footnotename) 1114 (defun Info-follow-reference (footnotename)
1115 "Follow cross reference named NAME to the node it refers to. 1115 "Follow cross reference named FOOTNOTENAME to the node it refers to.
1116 NAME may be an abbreviation of the reference name." 1116 FOOTNOTENAME may be an abbreviation of the reference name."
1117 (interactive 1117 (interactive
1118 (let ((completion-ignore-case t) 1118 (let ((completion-ignore-case t)
1119 (case-fold-search t) 1119 (case-fold-search t)
1120 completions default alt-default (start-point (point)) str i bol eol) 1120 completions default alt-default (start-point (point)) str i bol eol)
1121 (save-excursion 1121 (save-excursion
1433 (save-buffers-kill-emacs) 1433 (save-buffers-kill-emacs)
1434 (quit-window))) 1434 (quit-window)))
1435 1435
1436 (defun Info-next-menu-item () 1436 (defun Info-next-menu-item ()
1437 (interactive) 1437 (interactive)
1438 ;; Bind this in case the user sets it to nil. 1438 ;; Bind this in case the user sets it to nil.
1439 (let* ((case-fold-search t) 1439 (let* ((case-fold-search t)
1440 (node 1440 (node
1441 (save-excursion 1441 (save-excursion
1442 (forward-line -1) 1442 (forward-line -1)
1443 (search-forward "\n* menu:" nil t) 1443 (search-forward "\n* menu:" nil t)
1448 1448
1449 (defun Info-last-menu-item () 1449 (defun Info-last-menu-item ()
1450 (interactive) 1450 (interactive)
1451 (save-excursion 1451 (save-excursion
1452 (forward-line 1) 1452 (forward-line 1)
1453 ;; Bind this in case the user sets it to nil. 1453 ;; Bind this in case the user sets it to nil.
1454 (let* ((case-fold-search t) 1454 (let* ((case-fold-search t)
1455 (beg (save-excursion 1455 (beg (save-excursion
1456 (and (search-backward "\n* menu:" nil t) 1456 (and (search-backward "\n* menu:" nil t)
1457 (point))))) 1457 (point)))))
1458 (or (and beg (search-backward "\n* " beg t)) 1458 (or (and beg (search-backward "\n* " beg t))
1597 (if recur 1597 (if recur
1598 (error "No cross references in this node") 1598 (error "No cross references in this node")
1599 (Info-prev-reference t))))) 1599 (Info-prev-reference t)))))
1600 1600
1601 (defun Info-index (topic) 1601 (defun Info-index (topic)
1602 "Look up a string in the index for this file. 1602 "Look up a string TOPIC in the index for this file.
1603 The index is defined as the first node in the top-level menu whose 1603 The index is defined as the first node in the top-level menu whose
1604 name contains the word \"Index\", plus any immediately following 1604 name contains the word \"Index\", plus any immediately following
1605 nodes whose names also contain the word \"Index\". 1605 nodes whose names also contain the word \"Index\".
1606 If there are no exact matches to the specified topic, this chooses 1606 If there are no exact matches to the specified topic, this chooses
1607 the first match which is a case-insensitive substring of a topic. 1607 the first match which is a case-insensitive substring of a topic.
1730 flag)) 1730 flag))
1731 (scroll-up))) 1731 (scroll-up)))
1732 (bury-buffer "*Help*"))) 1732 (bury-buffer "*Help*")))
1733 1733
1734 (defun Info-get-token (pos start all &optional errorstring) 1734 (defun Info-get-token (pos start all &optional errorstring)
1735 "Return the token around POS, 1735 "Return the token around POS.
1736 POS must be somewhere inside the token 1736 POS must be somewhere inside the token
1737 START is a regular expression which will match the 1737 START is a regular expression which will match the
1738 beginning of the tokens delimited string 1738 beginning of the tokens delimited string
1739 ALL is a regular expression with a single 1739 ALL is a regular expression with a single
1740 parenthesized subpattern which is the token to be 1740 parenthesized subpattern which is the token to be
1741 returned. E.g. '{\(.*\)}' would return any string 1741 returned. E.g. '{\(.*\)}' would return any string
1742 enclosed in braces around POS. 1742 enclosed in braces around POS.
1743 SIG optional fourth argument, controls action on no match 1743 ERRORSTRING optional fourth argument, controls action on no match
1744 nil: return nil 1744 nil: return nil
1745 t: beep 1745 t: beep
1746 a string: signal an error, using that string." 1746 a string: signal an error, using that string."
1747 (let ((case-fold-search t)) 1747 (let ((case-fold-search t))
1748 (save-excursion 1748 (save-excursion
1867 (define-key Info-mode-map "\177" 'Info-scroll-down) 1867 (define-key Info-mode-map "\177" 'Info-scroll-down)
1868 (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node) 1868 (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node)
1869 ) 1869 )
1870 1870
1871 (defun Info-check-pointer (item) 1871 (defun Info-check-pointer (item)
1872 ;; Non-nil if ITEM is present in this node. 1872 "Non-nil if ITEM is present in this node."
1873 (condition-case nil 1873 (condition-case nil
1874 (Info-extract-pointer item) 1874 (Info-extract-pointer item)
1875 (error nil))) 1875 (error nil)))
1876 1876
1877 (easy-menu-define Info-mode-menu Info-mode-map 1877 (easy-menu-define Info-mode-menu Info-mode-map
1909 (defvar Info-menu-last-node nil) 1909 (defvar Info-menu-last-node nil)
1910 ;; Last node the menu was created for. 1910 ;; Last node the menu was created for.
1911 ;; Value is a list, (FILE-NAME NODE-NAME). 1911 ;; Value is a list, (FILE-NAME NODE-NAME).
1912 1912
1913 (defun Info-menu-update () 1913 (defun Info-menu-update ()
1914 ;; Update the Info menu for the current node. 1914 "Update the Info menu for the current node."
1915 (condition-case nil 1915 (condition-case nil
1916 (if (or (not (eq major-mode 'Info-mode)) 1916 (if (or (not (eq major-mode 'Info-mode))
1917 (equal (list Info-current-file Info-current-node) 1917 (equal (list Info-current-file Info-current-node)
1918 Info-menu-last-node)) 1918 Info-menu-last-node))
1919 () 1919 ()
1978 1978
1979 ;; Info mode is suitable only for specially formatted data. 1979 ;; Info mode is suitable only for specially formatted data.
1980 (put 'info-mode 'mode-class 'special) 1980 (put 'info-mode 'mode-class 'special)
1981 1981
1982 (defun Info-mode () 1982 (defun Info-mode ()
1983 "\\<Info-mode-map> 1983 "Info mode provides commands for browsing through the Info documentation tree.
1984 Info mode provides commands for browsing through the Info documentation tree.
1985 Documentation in Info is divided into \"nodes\", each of which discusses 1984 Documentation in Info is divided into \"nodes\", each of which discusses
1986 one topic and contains references to other nodes which discuss related 1985 one topic and contains references to other nodes which discuss related
1987 topics. Info has commands to follow the references and show you other nodes. 1986 topics. Info has commands to follow the references and show you other nodes.
1988 1987
1988 \\<Info-mode-map>\
1989 \\[Info-help] Invoke the Info tutorial. 1989 \\[Info-help] Invoke the Info tutorial.
1990 \\[Info-exit] Quit Info: reselect previously selected buffer. 1990 \\[Info-exit] Quit Info: reselect previously selected buffer.
1991 1991
1992 Selecting other nodes: 1992 Selecting other nodes:
1993 \\[Info-mouse-follow-nearest-node] 1993 \\[Info-mouse-follow-nearest-node]
2131 (defun Info-find-emacs-command-nodes (command) 2131 (defun Info-find-emacs-command-nodes (command)
2132 "Return a list of locations documenting COMMAND. 2132 "Return a list of locations documenting COMMAND.
2133 The `info-file' property of COMMAND says which Info manual to search. 2133 The `info-file' property of COMMAND says which Info manual to search.
2134 If COMMAND has no property, the variable `Info-file-list-for-emacs' 2134 If COMMAND has no property, the variable `Info-file-list-for-emacs'
2135 defines heuristics for which Info manual to try. 2135 defines heuristics for which Info manual to try.
2136 The locations are of the format used in Info-history, i.e. 2136 The locations are of the format used in `Info-history', i.e.
2137 \(FILENAME NODENAME BUFFERPOS\)." 2137 \(FILENAME NODENAME BUFFERPOS\)."
2138 (let ((where '()) 2138 (let ((where '())
2139 (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command)) 2139 (cmd-desc (concat "^\\* +" (regexp-quote (symbol-name command))
2140 ":\\s *\\(.*\\)\\.$")) 2140 ":\\s *\\(.*\\)\\.$"))
2141 (info-file "emacs")) ;default 2141 (info-file "emacs")) ;default
2207 (error "Couldn't find documentation for %s" command)))) 2207 (error "Couldn't find documentation for %s" command))))
2208 2208
2209 ;;;###autoload 2209 ;;;###autoload
2210 (defun Info-goto-emacs-key-command-node (key) 2210 (defun Info-goto-emacs-key-command-node (key)
2211 "Go to the Info node in the Emacs manual the command bound to KEY, a string. 2211 "Go to the Info node in the Emacs manual the command bound to KEY, a string.
2212 Interactively, if the binding is execute-extended-command, a command is read. 2212 Interactively, if the binding is `execute-extended-command', a command is read.
2213 The command is found by looking up in Emacs manual's Command Index 2213 The command is found by looking up in Emacs manual's Command Index
2214 or in another manual found via COMMAND's `info-file' property or 2214 or in another manual found via COMMAND's `info-file' property or
2215 the variable `Info-file-list-for-emacs'." 2215 the variable `Info-file-list-for-emacs'."
2216 (interactive "kFind documentation for key:") 2216 (interactive "kFind documentation for key:")
2217 (let ((command (key-binding key))) 2217 (let ((command (key-binding key)))