Mercurial > emacs
annotate lisp/info-look.el @ 52491:086c5d73dee4
(install-arch-indep, uninstall): Add SES manual.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Fri, 12 Sep 2003 15:04:45 +0000 |
parents | 695cf19ef79e |
children | 0e54e5e10501 375f2633d815 |
rev | line source |
---|---|
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
36605
diff
changeset
|
1 ;;; info-look.el --- major-mode-sensitive Info index lookup facility |
18322 | 2 ;; An older version of this was known as libc.el. |
3 | |
50950
a7b2bce87058
(info-lookup-make-completions): Allow colons in index entries by looking for ":
Juanma Barranquero <lekktu@gmail.com>
parents:
50451
diff
changeset
|
4 ;; Copyright (C) 1995,96,97,98,99,2001,2003 Free Software Foundation, Inc. |
18322 | 5 |
30110
23cb074f9d88
Change author's mail address.
Gerd Moellmann <gerd@gnu.org>
parents:
28112
diff
changeset
|
6 ;; Author: Ralph Schleicher <rs@nunatak.allgaeu.org> |
41076
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
7 ;; (did not show signs of life (Nov 2001) -stef) |
18322 | 8 ;; Keywords: help languages |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
26 | |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
27 ;;; Commentary: |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
28 |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
29 ;; Really cool code to lookup info indexes. |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
30 ;; Try especially info-lookup-symbol (aka C-h TAB). |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
31 |
18322 | 32 ;;; Code: |
33 | |
34 (require 'info) | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
35 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
36 (defgroup info-lookup nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
37 "Major mode sensitive help agent." |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
38 :group 'help :group 'languages) |
18322 | 39 |
40 (defvar info-lookup-mode nil | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
41 "Symbol of the current buffer's help mode. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
42 Help is provided according to the buffer's major mode if value is nil. |
18322 | 43 Automatically becomes buffer local when set in any fashion.") |
44 (make-variable-buffer-local 'info-lookup-mode) | |
45 | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
46 (defcustom info-lookup-other-window-flag t |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
47 "Non-nil means pop up the Info buffer in another window." |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
48 :group 'info-lookup :type 'boolean) |
18322 | 49 |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
50 (defcustom info-lookup-highlight-face 'highlight |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
51 "Face for highlighting looked up help items. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
52 Setting this variable to nil disables highlighting." |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
53 :group 'info-lookup :type 'face) |
18322 | 54 |
55 (defvar info-lookup-highlight-overlay nil | |
56 "Overlay object used for highlighting.") | |
57 | |
22281 | 58 (defcustom info-lookup-file-name-alist |
46525
d09ed551daf4
Support current auto{conf,make} manuals.
Dave Love <fx@gnu.org>
parents:
42942
diff
changeset
|
59 '(("\\`ac\\(local\\|site\\|include\\)\\.m4\\'" . autoconf-mode)) |
22281 | 60 "Alist of file names handled specially. |
61 List elements are cons cells of the form | |
62 | |
63 (REGEXP . MODE) | |
64 | |
65 If a file name matches REGEXP, then use help mode MODE instead of the | |
66 buffer's major mode." | |
67 :group 'info-lookup :type '(repeat (cons (string :tag "Regexp") | |
68 (symbol :tag "Mode")))) | |
69 | |
18322 | 70 (defvar info-lookup-history nil |
71 "History of previous input lines.") | |
72 | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
73 (defvar info-lookup-alist nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
74 "Alist of known help topics. |
18322 | 75 Cons cells are of the form |
76 | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
77 (HELP-TOPIC . HELP-DATA) |
18322 | 78 |
79 HELP-TOPIC is the symbol of a help topic. | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
80 HELP-DATA is a HELP-TOPIC's public data set. |
18322 | 81 Value is an alist with elements of the form |
82 | |
83 (HELP-MODE REGEXP IGNORE-CASE DOC-SPEC PARSE-RULE OTHER-MODES) | |
84 | |
85 HELP-MODE is a mode's symbol. | |
86 REGEXP is a regular expression matching those help items whose | |
87 documentation can be looked up via DOC-SPEC. | |
88 IGNORE-CASE is non-nil if help items are case insensitive. | |
89 DOC-SPEC is a list of documentation specifications of the form | |
90 | |
91 (INFO-NODE TRANS-FUNC PREFIX SUFFIX) | |
92 | |
93 INFO-NODE is the name (including file name part) of an Info index. | |
94 TRANS-FUNC is a function translating index entries into help items; | |
95 nil means add only those index entries matching REGEXP, a string | |
96 means prepend string to the first word of all index entries. | |
97 PREFIX and SUFFIX are parts of a regular expression. If one of | |
98 them is non-nil then search the help item's Info node for the | |
99 first occurrence of the regular expression `PREFIX ITEM SUFFIX'. | |
100 ITEM will be highlighted with `info-lookup-highlight-face' if this | |
101 variable is not nil. | |
102 PARSE-RULE is either the symbol name of a function or a regular | |
103 expression for guessing the default help item at point. Fuzzy | |
104 regular expressions like \"[_a-zA-Z0-9]+\" do a better job if | |
105 there are no clear delimiters; do not try to write too complex | |
106 expressions. PARSE-RULE defaults to REGEXP. | |
107 OTHER-MODES is a list of cross references to other help modes.") | |
108 | |
109 (defsubst info-lookup->topic-value (topic) | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
110 (cdr (assoc topic info-lookup-alist))) |
18322 | 111 |
112 (defsubst info-lookup->mode-value (topic mode) | |
113 (assoc mode (info-lookup->topic-value topic))) | |
114 | |
115 (defsubst info-lookup->regexp (topic mode) | |
116 (nth 1 (info-lookup->mode-value topic mode))) | |
117 | |
118 (defsubst info-lookup->ignore-case (topic mode) | |
119 (nth 2 (info-lookup->mode-value topic mode))) | |
120 | |
121 (defsubst info-lookup->doc-spec (topic mode) | |
122 (nth 3 (info-lookup->mode-value topic mode))) | |
123 | |
124 (defsubst info-lookup->parse-rule (topic mode) | |
125 (nth 4 (info-lookup->mode-value topic mode))) | |
126 | |
127 (defsubst info-lookup->other-modes (topic mode) | |
128 (nth 5 (info-lookup->mode-value topic mode))) | |
129 | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
130 (defun info-lookup-add-help (&rest arg) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
131 "Add or update a help specification. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
132 Function arguments are one or more options of the form |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
133 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
134 KEYWORD ARGUMENT |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
135 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
136 KEYWORD is either `:topic', `:mode', `:regexp', `:ignore-case', |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
137 `:doc-spec', `:parse-rule', or `:other-modes'. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
138 ARGUMENT has a value as explained in the documentation of the |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
139 variable `info-lookup-alist'. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
140 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
141 If no topic or mode option has been specified, then the help topic defaults |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
142 to `symbol', and the help mode defaults to the current major mode." |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
143 (apply 'info-lookup-add-help* nil arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
144 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
145 (defun info-lookup-maybe-add-help (&rest arg) |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
146 "Add a help specification iff none is defined. |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
147 See the documentation of the function `info-lookup-add-help' |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
148 for more details." |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
149 (apply 'info-lookup-add-help* t arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
150 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
151 (defun info-lookup-add-help* (maybe &rest arg) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
152 (let (topic mode regexp ignore-case doc-spec |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
153 parse-rule other-modes keyword value) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
154 (setq topic 'symbol |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
155 mode major-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
156 regexp "\\w+") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
157 (while arg |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
158 (setq keyword (car arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
159 (or (symbolp keyword) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
160 (error "Junk in argument list \"%S\"" arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
161 (setq arg (cdr arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
162 (and (null arg) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
163 (error "Keyword \"%S\" is missing an argument" keyword)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
164 (setq value (car arg) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
165 arg (cdr arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
166 (cond ((eq keyword :topic) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
167 (setq topic value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
168 ((eq keyword :mode) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
169 (setq mode value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
170 ((eq keyword :regexp) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
171 (setq regexp value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
172 ((eq keyword :ignore-case) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
173 (setq ignore-case value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
174 ((eq keyword :doc-spec) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
175 (setq doc-spec value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
176 ((eq keyword :parse-rule) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
177 (setq parse-rule value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
178 ((eq keyword :other-modes) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
179 (setq other-modes value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
180 (t |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
181 (error "Unknown keyword \"%S\"" keyword)))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
182 (or (and maybe (info-lookup->mode-value topic mode)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
183 (let* ((data (list regexp ignore-case doc-spec parse-rule other-modes)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
184 (topic-cell (or (assoc topic info-lookup-alist) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
185 (car (setq info-lookup-alist |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
186 (cons (cons topic nil) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
187 info-lookup-alist))))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
188 (mode-cell (assoc mode topic-cell))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
189 (if (null mode-cell) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
190 (setcdr topic-cell (cons (cons mode data) (cdr topic-cell))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
191 (setcdr mode-cell data)))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
192 nil)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
193 |
18322 | 194 (defvar info-lookup-cache nil |
195 "Cache storing data maintained automatically by the program. | |
196 Value is an alist with cons cell of the form | |
197 | |
198 (HELP-TOPIC . ((HELP-MODE INITIALIZED COMPLETIONS REFER-MODES) ...)) | |
199 | |
200 HELP-TOPIC is the symbol of a help topic. | |
201 HELP-MODE is a mode's symbol. | |
202 INITIALIZED is nil if HELP-MODE is uninitialized, t if | |
203 HELP-MODE is initialized, and `0' means HELP-MODE is | |
204 initialized but void. | |
205 COMPLETIONS is an alist of documented help items. | |
206 REFER-MODES is a list of other help modes to use.") | |
207 | |
208 (defsubst info-lookup->cache (topic) | |
209 (or (assoc topic info-lookup-cache) | |
210 (car (setq info-lookup-cache | |
211 (cons (cons topic nil) | |
212 info-lookup-cache))))) | |
213 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
214 (defun info-lookup->topic-cache (topic) |
18322 | 215 (cdr (info-lookup->cache topic))) |
216 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
217 (defun info-lookup->mode-cache (topic mode) |
18322 | 218 (assoc mode (info-lookup->topic-cache topic))) |
219 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
220 (defun info-lookup->initialized (topic mode) |
18322 | 221 (nth 1 (info-lookup->mode-cache topic mode))) |
222 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
223 (defun info-lookup->completions (topic mode) |
18322 | 224 (or (info-lookup->initialized topic mode) |
225 (info-lookup-setup-mode topic mode)) | |
226 (nth 2 (info-lookup->mode-cache topic mode))) | |
227 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
228 (defun info-lookup->refer-modes (topic mode) |
18322 | 229 (or (info-lookup->initialized topic mode) |
230 (info-lookup-setup-mode topic mode)) | |
231 (nth 3 (info-lookup->mode-cache topic mode))) | |
232 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
233 (defun info-lookup->all-modes (topic mode) |
18322 | 234 (cons mode (info-lookup->refer-modes topic mode))) |
235 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
236 (defun info-lookup-quick-all-modes (topic mode) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
237 (cons mode (info-lookup->other-modes topic mode))) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
238 |
18322 | 239 ;;;###autoload |
240 (defun info-lookup-reset () | |
241 "Throw away all cached data. | |
242 This command is useful if the user wants to start at the beginning without | |
243 quitting Emacs, for example, after some Info documents were updated on the | |
244 system." | |
245 (interactive) | |
246 (setq info-lookup-cache nil)) | |
247 | |
248 ;;;###autoload | |
249 (defun info-lookup-symbol (symbol &optional mode) | |
24829
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
250 "Display the definition of SYMBOL, as found in the relevant manual. |
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
251 When this command is called interactively, it reads SYMBOL from the minibuffer. |
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
252 In the minibuffer, use M-n to yank the default argument value |
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
253 into the minibuffer so you can edit it. |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
254 The default symbol is the one found at point. |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
255 |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
256 With prefix arg a query for the symbol help mode is offered." |
18322 | 257 (interactive |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
258 (info-lookup-interactive-arguments 'symbol current-prefix-arg)) |
18322 | 259 (info-lookup 'symbol symbol mode)) |
260 | |
261 ;;;###autoload | |
262 (defun info-lookup-file (file &optional mode) | |
263 "Display the documentation of a file. | |
24829
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
264 When this command is called interactively, it reads FILE from the minibuffer. |
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
265 In the minibuffer, use M-n to yank the default file name |
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
266 into the minibuffer so you can edit it. |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
267 The default file name is the one found at point. |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
268 |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
269 With prefix arg a query for the file help mode is offered." |
18322 | 270 (interactive |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
271 (info-lookup-interactive-arguments 'file current-prefix-arg)) |
18322 | 272 (info-lookup 'file file mode)) |
273 | |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
274 (defun info-lookup-interactive-arguments (topic &optional query) |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
275 "Read and return argument value (and help mode) for help topic TOPIC. |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
276 If optional argument QUERY is non-nil, query for the help mode." |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
277 (let* ((mode (cond (query |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
278 (info-lookup-change-mode topic)) |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
279 ((info-lookup->mode-value topic (info-lookup-select-mode)) |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
280 info-lookup-mode) |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
281 ((info-lookup-change-mode topic)))) |
18322 | 282 (completions (info-lookup->completions topic mode)) |
283 (default (info-lookup-guess-default topic mode)) | |
284 (completion-ignore-case (info-lookup->ignore-case topic mode)) | |
285 (enable-recursive-minibuffers t) | |
286 (value (completing-read | |
24829
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
287 (if default |
18322 | 288 (format "Describe %s (default %s): " topic default) |
289 (format "Describe %s: " topic)) | |
24829
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
290 completions nil nil nil 'info-lookup-history default))) |
18322 | 291 (list (if (equal value "") default value) mode))) |
292 | |
22281 | 293 (defun info-lookup-select-mode () |
294 (when (and (not info-lookup-mode) (buffer-file-name)) | |
295 (let ((file-name (file-name-nondirectory (buffer-file-name))) | |
296 (file-name-alist info-lookup-file-name-alist)) | |
297 (while (and (not info-lookup-mode) file-name-alist) | |
298 (when (string-match (caar file-name-alist) file-name) | |
299 (setq info-lookup-mode (cdar file-name-alist))) | |
300 (setq file-name-alist (cdr file-name-alist))))) | |
301 (or info-lookup-mode (setq info-lookup-mode major-mode))) | |
302 | |
18322 | 303 (defun info-lookup-change-mode (topic) |
304 (let* ((completions (mapcar (lambda (arg) | |
305 (cons (symbol-name (car arg)) (car arg))) | |
306 (info-lookup->topic-value topic))) | |
307 (mode (completing-read | |
308 (format "Use %s help mode: " topic) | |
309 completions nil t nil 'info-lookup-history))) | |
310 (or (setq mode (cdr (assoc mode completions))) | |
311 (error "No %s help available" topic)) | |
312 (or (info-lookup->mode-value topic mode) | |
313 (error "No %s help available for `%s'" topic mode)) | |
314 (setq info-lookup-mode mode))) | |
315 | |
316 (defun info-lookup (topic item mode) | |
317 "Display the documentation of a help item." | |
22281 | 318 (or mode (setq mode (info-lookup-select-mode))) |
18322 | 319 (or (info-lookup->mode-value topic mode) |
320 (error "No %s help available for `%s'" topic mode)) | |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
321 (let* ((completions (info-lookup->completions topic mode)) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
322 (ignore-case (info-lookup->ignore-case topic mode)) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
323 (entry (or (assoc (if ignore-case (downcase item) item) completions) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
324 (assoc-ignore-case item completions) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
325 (error "Not documented as a %s: %s" topic (or item "")))) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
326 (modes (info-lookup->all-modes topic mode)) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
327 (window (selected-window)) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
328 found doc-spec node prefix suffix doc-found) |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
329 (if (or (not info-lookup-other-window-flag) |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
330 (eq (current-buffer) (get-buffer "*info*"))) |
18322 | 331 (info) |
30348
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
332 (progn |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
333 (save-window-excursion (info)) |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
334 ;; Determine whether or not the Info buffer is visible in |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
335 ;; another frame on the same display. If it is, simply raise |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
336 ;; that frame. Otherwise, display it in another window. |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
337 (let* ((window (get-buffer-window "*info*" t)) |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
338 (info-frame (and window (window-frame window)))) |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
339 (if (and info-frame |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
340 (display-multi-frame-p) |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
341 (memq info-frame (frames-on-display-list))) |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
342 (select-frame info-frame) |
2dc989936987
(info-lookup): If *info* is shown in another frame
Gerd Moellmann <gerd@gnu.org>
parents:
30110
diff
changeset
|
343 (switch-to-buffer-other-window "*info*"))))) |
18322 | 344 (while (and (not found) modes) |
345 (setq doc-spec (info-lookup->doc-spec topic (car modes))) | |
346 (while (and (not found) doc-spec) | |
347 (setq node (nth 0 (car doc-spec)) | |
348 prefix (nth 2 (car doc-spec)) | |
349 suffix (nth 3 (car doc-spec))) | |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
350 (when (condition-case error-data |
25310 | 351 (progn |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
352 (Info-goto-node node) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
353 (setq doc-found t)) |
25310 | 354 (error |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
355 (message "Cannot access Info node %s" node) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
356 (sit-for 1) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
357 nil)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
358 (condition-case nil |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
359 (progn |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
360 ;; Don't use Info-menu, it forces case-fold-search to t |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
361 (let ((case-fold-search nil)) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
362 (re-search-forward |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
363 (concat "^\\* " (regexp-quote (or (cdr entry) (car entry))) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
364 ":"))) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
365 (Info-follow-nearest-node) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
366 (setq found t) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
367 (if (or prefix suffix) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
368 (let ((case-fold-search |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
369 (info-lookup->ignore-case topic (car modes))) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
370 (buffer-read-only nil)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
371 (goto-char (point-min)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
372 (re-search-forward |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
373 (concat prefix (regexp-quote (car entry)) suffix)) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
374 (goto-char (match-beginning 0)) |
28112
853a7fcaf7f0
(info-lookup): Use display-color-p.
Dave Love <fx@gnu.org>
parents:
25364
diff
changeset
|
375 (and (display-color-p) info-lookup-highlight-face |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
376 ;; Search again for ITEM so that the first |
42942 | 377 ;; occurrence of ITEM will be highlighted. |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
378 (re-search-forward (regexp-quote (car entry))) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
379 (let ((start (match-beginning 0)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
380 (end (match-end 0))) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
381 (if (overlayp info-lookup-highlight-overlay) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
382 (move-overlay info-lookup-highlight-overlay |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
383 start end (current-buffer)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
384 (setq info-lookup-highlight-overlay |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
385 (make-overlay start end)))) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
386 (overlay-put info-lookup-highlight-overlay |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
387 'face info-lookup-highlight-face))))) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
388 (error nil))) |
18322 | 389 (setq doc-spec (cdr doc-spec))) |
390 (setq modes (cdr modes))) | |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
391 ;; Alert the user if case was munged, and do this after bringing up the |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
392 ;; info buffer since that can print messages |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
393 (unless (or ignore-case |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
394 (string-equal item (car entry))) |
48988
d50289791f55
(info-lookup): Fix error message typo.
Richard M. Stallman <rms@gnu.org>
parents:
48940
diff
changeset
|
395 (message "Found in different case: %s" (car entry))) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
396 (or doc-found |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
397 (error "Info documentation for lookup was not found")) |
18322 | 398 ;; Don't leave the Info buffer if the help item couldn't be looked up. |
399 (if (and info-lookup-other-window-flag found) | |
400 (select-window window)))) | |
401 | |
402 (defun info-lookup-setup-mode (topic mode) | |
403 "Initialize the internal data structure." | |
404 (or (info-lookup->initialized topic mode) | |
405 (let (cell data (initialized 0) completions refer-modes) | |
406 (if (not (info-lookup->mode-value topic mode)) | |
407 (message "No %s help available for `%s'" topic mode) | |
408 ;; Recursively setup cross references. | |
409 ;; But refer only to non-void modes. | |
410 (mapcar (lambda (arg) | |
411 (or (info-lookup->initialized topic arg) | |
412 (info-lookup-setup-mode topic arg)) | |
413 (and (eq (info-lookup->initialized topic arg) t) | |
414 (setq refer-modes (cons arg refer-modes)))) | |
415 (info-lookup->other-modes topic mode)) | |
416 (setq refer-modes (nreverse refer-modes)) | |
417 ;; Build the full completion alist. | |
418 (setq completions | |
25041
d45a32b777f6
(info-lookup-setup-mode): Don't give up, if
Karl Heuer <kwzh@gnu.org>
parents:
24829
diff
changeset
|
419 (nconc (condition-case nil |
d45a32b777f6
(info-lookup-setup-mode): Don't give up, if
Karl Heuer <kwzh@gnu.org>
parents:
24829
diff
changeset
|
420 (info-lookup-make-completions topic mode) |
d45a32b777f6
(info-lookup-setup-mode): Don't give up, if
Karl Heuer <kwzh@gnu.org>
parents:
24829
diff
changeset
|
421 (error nil)) |
18322 | 422 (apply 'append |
423 (mapcar (lambda (arg) | |
424 (info-lookup->completions topic arg)) | |
425 refer-modes)))) | |
426 (setq initialized t)) | |
427 ;; Update `info-lookup-cache'. | |
428 (setq cell (info-lookup->mode-cache topic mode) | |
429 data (list initialized completions refer-modes)) | |
430 (if (not cell) | |
431 (setcdr (info-lookup->cache topic) | |
432 (cons (cons mode data) (info-lookup->topic-cache topic))) | |
433 (setcdr cell data)) | |
434 initialized))) | |
435 | |
436 (defun info-lookup-make-completions (topic mode) | |
437 "Create a unique alist from all index entries." | |
20519
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
438 (let ((doc-spec (info-lookup->doc-spec topic mode)) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
439 (regexp (concat "^\\(" (info-lookup->regexp topic mode) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
440 "\\)\\([ \t].*\\)?$")) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
441 node trans entry item prefix result doc-found |
20519
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
442 (buffer (get-buffer-create " temp-info-look"))) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
443 (with-current-buffer buffer |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
444 (Info-mode)) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
445 (while doc-spec |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
446 (setq node (nth 0 (car doc-spec)) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
447 trans (cond ((eq (nth 1 (car doc-spec)) nil) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
448 (lambda (arg) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
449 (if (string-match regexp arg) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
450 (match-string 1 arg)))) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
451 ((stringp (nth 1 (car doc-spec))) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
452 (setq prefix (nth 1 (car doc-spec))) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
453 (lambda (arg) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
454 (if (string-match "^\\([^: \t\n]+\\)" arg) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
455 (concat prefix (match-string 1 arg))))) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
456 (t (nth 1 (car doc-spec))))) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
457 (with-current-buffer buffer |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
458 (message "Processing Info node `%s'..." node) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
459 (when (condition-case error-data |
25310 | 460 (progn |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
461 (Info-goto-node node) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
462 (setq doc-found t)) |
25310 | 463 (error |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
464 (message "Cannot access Info node `%s'" node) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
465 (sit-for 1) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
466 nil)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
467 (condition-case nil |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
468 (progn |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
469 (goto-char (point-min)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
470 (and (search-forward "\n* Menu:" nil t) |
50950
a7b2bce87058
(info-lookup-make-completions): Allow colons in index entries by looking for ":
Juanma Barranquero <lekktu@gmail.com>
parents:
50451
diff
changeset
|
471 (while (re-search-forward "\n\\* \\(.*\\): " nil t) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
472 (setq entry (match-string 1) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
473 item (funcall trans entry)) |
23365
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
474 ;; `trans' can return nil if the regexp doesn't match. |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
475 (when (and item |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
476 ;; Sometimes there's more than one Menu: |
25310 | 477 (not (string= entry "Menu"))) |
23365
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
478 (and (info-lookup->ignore-case topic mode) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
479 (setq item (downcase item))) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
480 (and (string-equal entry item) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
481 (setq entry nil)) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
482 (and (or (assoc item result) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
483 (setq result (cons (cons item entry) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
484 result)))))))) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
485 (error nil)))) |
20519
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
486 (message "Processing Info node `%s'...done" node) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
487 (setq doc-spec (cdr doc-spec))) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
488 (or doc-found |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
489 (error "Info documentation for lookup was not found")) |
20519
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
490 result)) |
18322 | 491 |
492 (defun info-lookup-guess-default (topic mode) | |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
493 "Return a guess for a symbol to look up, based on text around point. |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
494 Try all related modes applicable to TOPIC and MODE. |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
495 Return nil if there is nothing appropriate in the buffer near point." |
18322 | 496 (let ((modes (info-lookup->all-modes topic mode)) |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
497 guess) |
18322 | 498 (while (and (not guess) modes) |
499 (setq guess (info-lookup-guess-default* topic (car modes)) | |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
500 modes (cdr modes))) |
18322 | 501 ;; Collapse whitespace characters. |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
502 (when guess |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
503 (let ((pos 0)) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
504 (while (string-match "[ \t\n]+" guess pos) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
505 (setq pos (1+ (match-beginning 0))) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
506 (setq guess (replace-match " " t t guess))))) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
507 guess)) |
18322 | 508 |
509 (defun info-lookup-guess-default* (topic mode) | |
510 (let ((case-fold-search (info-lookup->ignore-case topic mode)) | |
511 (rule (or (info-lookup->parse-rule topic mode) | |
512 (info-lookup->regexp topic mode))) | |
513 (start (point)) end regexp subexp result) | |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
514 (save-excursion |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
515 (if (symbolp rule) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
516 (setq result (funcall rule)) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
517 (if (consp rule) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
518 (setq regexp (car rule) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
519 subexp (cdr rule)) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
520 (setq regexp rule |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
521 subexp 0)) |
25310 | 522 ;; If at start of symbol, don't go back to end of previous one. |
523 (if (save-match-data | |
524 (looking-at "[ \t\n]")) | |
525 (skip-chars-backward " \t\n")) | |
526 (setq end (point)) | |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
527 (while (and (re-search-backward regexp nil t) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
528 (looking-at regexp) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
529 (>= (match-end 0) end)) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
530 (setq result (match-string subexp))) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
531 (if (not result) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
532 (progn |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
533 (goto-char start) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
534 (skip-chars-forward " \t\n") |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
535 (and (looking-at regexp) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
536 (setq result (match-string subexp))))))) |
18322 | 537 result)) |
538 | |
539 (defun info-lookup-guess-c-symbol () | |
540 "Get the C symbol at point." | |
541 (condition-case nil | |
542 (progn | |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
543 (skip-syntax-backward "w_") |
18322 | 544 (let ((start (point)) prefix name) |
545 ;; Test for a leading `struct', `union', or `enum' keyword | |
546 ;; but ignore names like `foo_struct'. | |
547 (setq prefix (and (< (skip-chars-backward " \t\n") 0) | |
548 (< (skip-chars-backward "_a-zA-Z0-9") 0) | |
549 (looking-at "\\(struct\\|union\\|enum\\)\\s ") | |
550 (concat (match-string 1) " "))) | |
551 (goto-char start) | |
552 (and (looking-at "[_a-zA-Z][_a-zA-Z0-9]*") | |
553 (setq name (match-string 0))) | |
554 ;; Caveat! Look forward if point is at `struct' etc. | |
555 (and (not prefix) | |
556 (or (string-equal name "struct") | |
557 (string-equal name "union") | |
558 (string-equal name "enum")) | |
559 (looking-at "[a-z]+\\s +\\([_a-zA-Z][_a-zA-Z0-9]*\\)") | |
560 (setq prefix (concat name " ") | |
561 name (match-string 1))) | |
562 (and (or prefix name) | |
563 (concat prefix name)))) | |
564 (error nil))) | |
565 | |
566 ;;;###autoload | |
567 (defun info-complete-symbol (&optional mode) | |
568 "Perform completion on symbol preceding point." | |
18323
64d728fb396a
(info-complete-symbol): If MODE is nil, use the default value.
Richard M. Stallman <rms@gnu.org>
parents:
18322
diff
changeset
|
569 (interactive) |
64d728fb396a
(info-complete-symbol): If MODE is nil, use the default value.
Richard M. Stallman <rms@gnu.org>
parents:
18322
diff
changeset
|
570 (info-complete 'symbol |
64d728fb396a
(info-complete-symbol): If MODE is nil, use the default value.
Richard M. Stallman <rms@gnu.org>
parents:
18322
diff
changeset
|
571 (or mode |
64d728fb396a
(info-complete-symbol): If MODE is nil, use the default value.
Richard M. Stallman <rms@gnu.org>
parents:
18322
diff
changeset
|
572 (if (info-lookup->mode-value |
22281 | 573 'symbol (info-lookup-select-mode)) |
574 info-lookup-mode | |
18323
64d728fb396a
(info-complete-symbol): If MODE is nil, use the default value.
Richard M. Stallman <rms@gnu.org>
parents:
18322
diff
changeset
|
575 (info-lookup-change-mode 'symbol))))) |
18322 | 576 |
577 ;;;###autoload | |
578 (defun info-complete-file (&optional mode) | |
579 "Perform completion on file preceding point." | |
20973
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
580 (interactive) |
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
581 (info-complete 'file |
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
582 (or mode |
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
583 (if (info-lookup->mode-value |
22281 | 584 'file (info-lookup-select-mode)) |
585 info-lookup-mode | |
20973
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
586 (info-lookup-change-mode 'file))))) |
18322 | 587 |
588 (defun info-complete (topic mode) | |
589 "Try to complete a help item." | |
590 (barf-if-buffer-read-only) | |
22281 | 591 (or mode (setq mode (info-lookup-select-mode))) |
18322 | 592 (or (info-lookup->mode-value topic mode) |
593 (error "No %s completion available for `%s'" topic mode)) | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
594 (let ((modes (info-lookup-quick-all-modes topic mode)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
595 (start (point)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
596 try) |
18322 | 597 (while (and (not try) modes) |
598 (setq mode (car modes) | |
599 modes (cdr modes) | |
600 try (info-lookup-guess-default* topic mode)) | |
601 (goto-char start)) | |
602 (and (not try) | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
603 (error "Found no %S to complete" topic)) |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
604 (let ((completions (info-lookup->completions topic mode)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
605 (completion-ignore-case (info-lookup->ignore-case topic mode)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
606 completion) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
607 (setq completion (try-completion try completions)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
608 (cond ((not completion) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
609 (ding) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
610 (message "No match")) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
611 ((stringp completion) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
612 (or (assoc completion completions) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
613 (setq completion (completing-read |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
614 (format "Complete %S: " topic) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
615 completions nil t completion |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
616 info-lookup-history))) |
25310 | 617 ;; Find the original symbol and zap it. |
618 (end-of-line) | |
619 (while (and (search-backward try nil t) | |
620 (< start (point)))) | |
621 (replace-match "") | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
622 (insert completion)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
623 (t |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
624 (message "%s is complete" |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
625 (capitalize (prin1-to-string topic)))))))) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
626 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
627 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
628 ;;; Initialize some common modes. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
629 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
630 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
631 :mode 'c-mode :topic 'symbol |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
632 :regexp "\\(struct \\|union \\|enum \\)?[_a-zA-Z][_a-zA-Z0-9]*" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
633 :doc-spec '(("(libc)Function Index" nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
634 "^[ \t]+- \\(Function\\|Macro\\): .*\\<" "\\>") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
635 ("(libc)Variable Index" nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
636 "^[ \t]+- \\(Variable\\|Macro\\): .*\\<" "\\>") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
637 ("(libc)Type Index" nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
638 "^[ \t]+- Data Type: \\<" "\\>") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
639 ("(termcap)Var Index" nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
640 "^[ \t]*`" "'")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
641 :parse-rule 'info-lookup-guess-c-symbol) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
642 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
643 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
644 :mode 'c-mode :topic 'file |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
645 :regexp "[_a-zA-Z0-9./+-]+" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
646 :doc-spec '(("(libc)File Index"))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
647 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
648 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
649 :mode 'bison-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
650 :regexp "[:;|]\\|%\\([%{}]\\|[_a-z]+\\)\\|YY[_A-Z]+\\|yy[_a-z]+" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
651 :doc-spec '(("(bison)Index" nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
652 "`" "'")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
653 :parse-rule "[:;|]\\|%\\([%{}]\\|[_a-zA-Z][_a-zA-Z0-9]*\\)" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
654 :other-modes '(c-mode)) |
20899
d1f6ac340403
(info-complete): Display completions on second invocation at same point
Richard M. Stallman <rms@gnu.org>
parents:
20690
diff
changeset
|
655 |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
656 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
657 :mode 'makefile-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
658 :regexp "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z][_a-zA-Z0-9-]*" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
659 :doc-spec '(("(make)Name Index" nil |
41076
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
660 "^[ \t]*`" "'") |
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
661 ("(automake)Macro and Variable Index" nil |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
662 "^[ \t]*`" "'")) |
41076
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
663 :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+" |
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
664 :other-modes '(automake-mode)) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
665 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
666 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
667 :mode 'texinfo-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
668 :regexp "@\\([a-zA-Z]+\\|[^a-zA-Z]\\)" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
669 :doc-spec '(("(texinfo)Command and Variable Index" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
670 ;; Ignore Emacs commands and prepend a `@'. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
671 (lambda (item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
672 (if (string-match "^\\([a-zA-Z]+\\|[^a-zA-Z]\\)\\( .*\\)?$" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
673 (concat "@" (match-string 1 item)))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
674 "`" "'"))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
675 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
676 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
677 :mode 'm4-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
678 :regexp "[_a-zA-Z][_a-zA-Z0-9]*" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
679 :doc-spec '(("(m4)Macro index")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
680 :parse-rule "[_a-zA-Z0-9]+") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
681 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
682 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
683 :mode 'autoconf-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
684 :regexp "A[CM]_[_A-Z0-9]+" |
51242
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
685 :doc-spec '(;; Autoconf Macro Index entries are without an "AC_" prefix, |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
686 ;; but with "AH_" or "AU_" for those. So add "AC_" if there |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
687 ;; isn't already an "A._". |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
688 ("(autoconf)Autoconf Macro Index" |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
689 (lambda (item) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
690 (if (string-match "^A._" item) item (concat "AC_" item))) |
46525
d09ed551daf4
Support current auto{conf,make} manuals.
Dave Love <fx@gnu.org>
parents:
42942
diff
changeset
|
691 "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>") |
51242
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
692 ;; M4 Macro Index entries are without "AS_" prefixes, and |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
693 ;; mostly without "m4_" prefixes. "dnl" is an exception, not |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
694 ;; wanting any prefix. So AS_ is added back to upper-case |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
695 ;; names, m4_ to others which don't already an m4_. |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
696 ("(autoconf)M4 Macro Index" |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
697 (lambda (item) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
698 (let ((case-fold-search nil)) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
699 (cond ((or (string-equal item "dnl") |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
700 (string-match "^m4_" item)) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
701 item) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
702 ((string-match "^[A-Z0-9_]+$" item) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
703 (concat "AS_" item)) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
704 (t |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
705 (concat "m4_" item))))) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
706 "^[ \t]+- Macro: .*\\<" "\\>") |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
707 ;; Autotest Macro Index entries are without "AT_". |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
708 ("(autoconf)Autotest Macro Index" "AT_" |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
709 "^[ \t]+- Macro: .*\\<" "\\>") |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
710 ;; This is for older versions (probably pre autoconf 2.5x): |
46525
d09ed551daf4
Support current auto{conf,make} manuals.
Dave Love <fx@gnu.org>
parents:
42942
diff
changeset
|
711 ("(autoconf)Macro Index" "AC_" |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
712 "^[ \t]+- \\(Macro\\|Variable\\): .*\\<" "\\>") |
51242
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
713 ;; Automake has index entries for its notes on various autoconf |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
714 ;; macros (eg. AC_PROG_CC). Ensure this is after the autoconf |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
715 ;; index, so as to prefer the autoconf docs. |
41076
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
716 ("(automake)Macro and Variable Index" nil |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
717 "^[ \t]*`" "'")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
718 ;; Autoconf symbols are M4 macros. Thus use M4's parser. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
719 :parse-rule 'ignore |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
720 :other-modes '(m4-mode)) |
18322 | 721 |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
722 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
723 :mode 'awk-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
724 :regexp "[_a-zA-Z]+" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
725 :doc-spec '(("(gawk)Index" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
726 (lambda (item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
727 (let ((case-fold-search nil)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
728 (cond |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
729 ;; `BEGIN' and `END'. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
730 ((string-match "^\\([A-Z]+\\) special pattern\\b" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
731 (match-string 1 item)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
732 ;; `if', `while', `do', ... |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
733 ((string-match "^\\([a-z]+\\) statement\\b" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
734 (if (not (string-equal (match-string 1 item) "control")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
735 (match-string 1 item))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
736 ;; `NR', `NF', ... |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
737 ((string-match "^[A-Z]+$" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
738 item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
739 ;; Built-in functions (matches to many entries). |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
740 ((string-match "^[a-z]+$" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
741 item)))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
742 "`" "\\([ \t]*([^)]*)\\)?'"))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
743 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
744 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
745 :mode 'perl-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
746 :regexp "[$@%][^a-zA-Z]\\|\\$\\^[A-Z]\\|[$@%]?[a-zA-Z][_a-zA-Z0-9]*" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
747 :doc-spec '(("(perl5)Function Index" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
748 (lambda (item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
749 (if (string-match "^\\([a-zA-Z0-9]+\\)" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
750 (match-string 1 item))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
751 "^" "\\b") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
752 ("(perl5)Variable Index" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
753 (lambda (item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
754 ;; Work around bad formatted array variables. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
755 (let ((sym (cond ((or (string-match "^\\$\\(.\\|@@\\)$" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
756 (string-match "^\\$\\^[A-Z]$" item)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
757 item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
758 ((string-match |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
759 "^\\([$%@]\\|@@\\)?[_a-zA-Z0-9]+" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
760 (match-string 0 item)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
761 (t "")))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
762 (if (string-match "@@" sym) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
763 (setq sym (concat (substring sym 0 (match-beginning 0)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
764 (substring sym (1- (match-end 0)))))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
765 (if (string-equal sym "") nil sym))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
766 "^" "\\b")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
767 :parse-rule "[$@%]?\\([_a-zA-Z0-9]+\\|[^a-zA-Z]\\)") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
768 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
769 (info-lookup-maybe-add-help |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
770 :mode 'cperl-mode |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
771 :regexp "[$@%][^a-zA-Z]\\|\\$\\^[A-Z]\\|[$@%]?[a-zA-Z][_a-zA-Z0-9]*" |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
772 :other-modes '(perl-mode)) |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
773 |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
774 (info-lookup-maybe-add-help |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
775 :mode 'latex-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
776 :regexp "\\\\\\([a-zA-Z]+\\|[^a-zA-Z]\\)" |
25041
d45a32b777f6
(info-lookup-setup-mode): Don't give up, if
Karl Heuer <kwzh@gnu.org>
parents:
24829
diff
changeset
|
777 :doc-spec '(("(latex)Command Index" nil |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
778 "`" "\\({[^}]*}\\)?'"))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
779 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
780 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
781 :mode 'emacs-lisp-mode |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
782 :regexp "[^][()'\" \t\n]+" |
50451
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
783 :doc-spec '(;; Commands with key sequences appear in nodes as `foo' and |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
784 ;; those without as `M-x foo'. |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
785 ("(emacs)Command Index" nil "`\\(M-x[ \t\n]+\\)?" "'") |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
786 ;; Variables normally appear in nodes as just `foo'. |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
787 ("(emacs)Variable Index" nil "`" "'") |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
788 ;; Almost all functions, variables, etc appear in nodes as |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
789 ;; " - Function: foo" etc. A small number of aliases and |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
790 ;; symbols appear only as `foo', and will miss out on exact |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
791 ;; positions. Allowing `foo' would hit too many false matches |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
792 ;; for things that should go to Function: etc, and those latter |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
793 ;; are much more important. Perhaps this could change if some |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
794 ;; sort of fallback match scheme existed. |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
795 ("(elisp)Index" nil "^ - .*: " "\\( \\|$\\)"))) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
796 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
797 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
798 :mode 'lisp-interaction-mode |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
799 :regexp "[^][()'\" \t\n]+" |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
800 :parse-rule 'ignore |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
801 :other-modes '(emacs-lisp-mode)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
802 |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
803 (info-lookup-maybe-add-help |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
804 :mode 'lisp-mode |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
805 :regexp "[^()'\" \t\n]+" |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
806 :parse-rule 'ignore |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
807 :other-modes '(emacs-lisp-mode)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
808 |
22281 | 809 (info-lookup-maybe-add-help |
810 :mode 'scheme-mode | |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
811 :regexp "[^()'\" \t\n]+" |
22281 | 812 :ignore-case t |
23365
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
813 ;; Aubrey Jaffer's rendition from <URL:ftp://ftp-swiss.ai.mit.edu/pub/scm> |
22281 | 814 :doc-spec '(("(r5rs)Index" nil |
815 "^[ \t]+- [^:]+:[ \t]*" "\\b"))) | |
816 | |
23346 | 817 (info-lookup-maybe-add-help |
818 :mode 'octave-mode | |
819 :regexp "[_a-zA-Z0-9]+" | |
50407
41c0eed9d556
*** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents:
50347
diff
changeset
|
820 :doc-spec '(("(octave)Function Index" nil |
25364
d593a9e28430
Octave-mode support: for the function index entries, allow the prefix
Stephen Eglen <stephen@gnu.org>
parents:
25310
diff
changeset
|
821 "^ - [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil) |
23346 | 822 ("(octave)Variable Index" nil "^ - [^:]+:[ ]+" nil) |
823 ;; Catch lines of the form "xyz statement" | |
25310 | 824 ("(octave)Concept Index" |
23346 | 825 (lambda (item) |
826 (cond | |
827 ((string-match "^\\([A-Z]+\\) statement\\b" item) | |
828 (match-string 1 item)) | |
829 (t nil))) | |
830 nil; "^ - [^:]+:[ ]+" don't think this prefix is useful here. | |
831 nil))) | |
50347
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
832 |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
833 ;; coreutils and bash builtins overlap in places, eg. printf, so there's a |
50407
41c0eed9d556
*** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents:
50347
diff
changeset
|
834 ;; question which should come first. Some of the coreutils descriptions are |
50347
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
835 ;; more detailed, but if bash is usually /bin/sh on a GNU system then the |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
836 ;; builtins will be what's normally run. |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
837 ;; |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
838 ;; Maybe special variables like $? should be matched as $?, not just ?. |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
839 ;; This would avoid a clash between variable $! and negation !, or variable |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
840 ;; $# and comment # (though comment # is not currently indexed in bash). |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
841 ;; Unfortunately if $? etc is the symbol, then we wouldn't be taken to the |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
842 ;; exact spot in the relevant node, since the bash manual has just `?' etc |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
843 ;; there. Maybe an extension to the prefix/suffix scheme could help this. |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
844 |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
845 (info-lookup-maybe-add-help |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
846 :mode 'sh-mode :topic 'symbol |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
847 ;; bash has "." and ":" in its index, but those chars will probably never |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
848 ;; work in info, so don't bother matching them in the regexp. |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
849 :regexp "\\([a-zA-Z0-9_-]+\\|[!{}@*#?$]\\|\\[\\[?\\|]]?\\)" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
850 :doc-spec '(("(bash)Builtin Index" nil "^`" "[ .']") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
851 ("(bash)Reserved Word Index" nil "^`" "[ .']") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
852 ("(bash)Variable Index" nil "^`" "[ .']") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
853 ;; coreutils (version 4.5.10) doesn't have a separate program |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
854 ;; index, so exclude extraneous stuff (most of it) by demanding |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
855 ;; "[a-z]+" in the trans-func. |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
856 ("(coreutils)Index" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
857 (lambda (item) (if (string-match "\\`[a-z]+\\'" item) item))) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
858 ;; diff (version 2.8.1) has only a few programs, index entries |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
859 ;; are things like "foo invocation". |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
860 ("(diff)Index" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
861 (lambda (item) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
862 (if (string-match "\\`\\([a-z]+\\) invocation\\'" item) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
863 (match-string 1 item)))) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
864 ;; there's no plain "sed" index entry as such, mung another |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
865 ;; hopefully unique one to get to the invocation section |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
866 ("(sed)Concept Index" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
867 (lambda (item) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
868 (if (string-equal item "Standard input, processing as input") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
869 "sed"))) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
870 ;; there's no plain "awk" or "gawk" index entries, mung other |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
871 ;; hopefully unique ones to get to the command line options |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
872 ("(gawk)Index" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
873 (lambda (item) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
874 (cond ((string-equal item "gawk, extensions, disabling") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
875 "awk") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
876 ((string-equal item "gawk, versions of, information about, printing") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
877 "gawk")))))) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
878 |
18322 | 879 (provide 'info-look) |
880 | |
52401 | 881 ;;; arch-tag: 0f1e3ea3-32a2-4461-bbab-3cff93539a74 |
18322 | 882 ;;; info-look.el ends here |