Mercurial > emacs
annotate lisp/info-look.el @ 77897:f05ec6aa2fbe
(Man-next-section): Don't consider the last line of the page as being
part of any section.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 04 Jun 2007 23:42:10 +0000 |
parents | 9e18371d4dff |
children | 9355f9b7bbff dd7c098af727 |
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 | |
64762
41bb365f41c4
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64091
diff
changeset
|
4 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, |
75347 | 5 ;; 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
18322 | 6 |
30110
23cb074f9d88
Change author's mail address.
Gerd Moellmann <gerd@gnu.org>
parents:
28112
diff
changeset
|
7 ;; 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
|
8 ;; (did not show signs of life (Nov 2001) -stef) |
18322 | 9 ;; Keywords: help languages |
10 | |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64091 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
18322 | 27 |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
28 ;;; Commentary: |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
29 |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
30 ;; Really cool code to lookup info indexes. |
53770
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
31 ;; Try especially info-lookup-symbol (aka C-h S). |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
32 |
18322 | 33 ;;; Code: |
34 | |
35 (require 'info) | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
36 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
37 (defgroup info-lookup nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
38 "Major mode sensitive help agent." |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
39 :group 'help :group 'languages) |
18322 | 40 |
41 (defvar info-lookup-mode nil | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
42 "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
|
43 Help is provided according to the buffer's major mode if value is nil. |
18322 | 44 Automatically becomes buffer local when set in any fashion.") |
45 (make-variable-buffer-local 'info-lookup-mode) | |
46 | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
47 (defcustom info-lookup-other-window-flag t |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
48 "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
|
49 :group 'info-lookup :type 'boolean) |
18322 | 50 |
58990
a009e1bf75be
(info-lookup-highlight-face): Change default from `highlight' to `match'.
Juri Linkov <juri@jurta.org>
parents:
58798
diff
changeset
|
51 (defcustom info-lookup-highlight-face 'match |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
52 "Face for highlighting looked up help items. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
53 Setting this variable to nil disables highlighting." |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
54 :group 'info-lookup :type 'face) |
18322 | 55 |
56 (defvar info-lookup-highlight-overlay nil | |
57 "Overlay object used for highlighting.") | |
58 | |
22281 | 59 (defcustom info-lookup-file-name-alist |
46525
d09ed551daf4
Support current auto{conf,make} manuals.
Dave Love <fx@gnu.org>
parents:
42942
diff
changeset
|
60 '(("\\`ac\\(local\\|site\\|include\\)\\.m4\\'" . autoconf-mode)) |
22281 | 61 "Alist of file names handled specially. |
62 List elements are cons cells of the form | |
63 | |
64 (REGEXP . MODE) | |
65 | |
66 If a file name matches REGEXP, then use help mode MODE instead of the | |
67 buffer's major mode." | |
68 :group 'info-lookup :type '(repeat (cons (string :tag "Regexp") | |
69 (symbol :tag "Mode")))) | |
70 | |
18322 | 71 (defvar info-lookup-history nil |
72 "History of previous input lines.") | |
73 | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
74 (defvar info-lookup-alist nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
75 "Alist of known help topics. |
18322 | 76 Cons cells are of the form |
77 | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
78 (HELP-TOPIC . HELP-DATA) |
18322 | 79 |
80 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
|
81 HELP-DATA is a HELP-TOPIC's public data set. |
18322 | 82 Value is an alist with elements of the form |
83 | |
84 (HELP-MODE REGEXP IGNORE-CASE DOC-SPEC PARSE-RULE OTHER-MODES) | |
85 | |
86 HELP-MODE is a mode's symbol. | |
87 REGEXP is a regular expression matching those help items whose | |
88 documentation can be looked up via DOC-SPEC. | |
89 IGNORE-CASE is non-nil if help items are case insensitive. | |
90 DOC-SPEC is a list of documentation specifications of the form | |
91 | |
92 (INFO-NODE TRANS-FUNC PREFIX SUFFIX) | |
93 | |
94 INFO-NODE is the name (including file name part) of an Info index. | |
95 TRANS-FUNC is a function translating index entries into help items; | |
96 nil means add only those index entries matching REGEXP, a string | |
97 means prepend string to the first word of all index entries. | |
98 PREFIX and SUFFIX are parts of a regular expression. If one of | |
99 them is non-nil then search the help item's Info node for the | |
100 first occurrence of the regular expression `PREFIX ITEM SUFFIX'. | |
101 ITEM will be highlighted with `info-lookup-highlight-face' if this | |
102 variable is not nil. | |
103 PARSE-RULE is either the symbol name of a function or a regular | |
104 expression for guessing the default help item at point. Fuzzy | |
105 regular expressions like \"[_a-zA-Z0-9]+\" do a better job if | |
106 there are no clear delimiters; do not try to write too complex | |
107 expressions. PARSE-RULE defaults to REGEXP. | |
108 OTHER-MODES is a list of cross references to other help modes.") | |
109 | |
110 (defsubst info-lookup->topic-value (topic) | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
111 (cdr (assoc topic info-lookup-alist))) |
18322 | 112 |
113 (defsubst info-lookup->mode-value (topic mode) | |
114 (assoc mode (info-lookup->topic-value topic))) | |
115 | |
116 (defsubst info-lookup->regexp (topic mode) | |
117 (nth 1 (info-lookup->mode-value topic mode))) | |
118 | |
119 (defsubst info-lookup->ignore-case (topic mode) | |
120 (nth 2 (info-lookup->mode-value topic mode))) | |
121 | |
122 (defsubst info-lookup->doc-spec (topic mode) | |
123 (nth 3 (info-lookup->mode-value topic mode))) | |
124 | |
125 (defsubst info-lookup->parse-rule (topic mode) | |
126 (nth 4 (info-lookup->mode-value topic mode))) | |
127 | |
128 (defsubst info-lookup->other-modes (topic mode) | |
129 (nth 5 (info-lookup->mode-value topic mode))) | |
130 | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
131 (defun info-lookup-add-help (&rest arg) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
132 "Add or update a help specification. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
133 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
|
134 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
135 KEYWORD ARGUMENT |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
136 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
137 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
|
138 `:doc-spec', `:parse-rule', or `:other-modes'. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
139 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
|
140 variable `info-lookup-alist'. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
141 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
142 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
|
143 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
|
144 (apply 'info-lookup-add-help* nil arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
145 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
146 (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
|
147 "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
|
148 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
|
149 for more details." |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
150 (apply 'info-lookup-add-help* t arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
151 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
152 (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
|
153 (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
|
154 parse-rule other-modes keyword value) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
155 (setq topic 'symbol |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
156 mode major-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
157 regexp "\\w+") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
158 (while arg |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
159 (setq keyword (car arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
160 (or (symbolp keyword) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
161 (error "Junk in argument list \"%S\"" arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
162 (setq arg (cdr arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
163 (and (null arg) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
164 (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
|
165 (setq value (car arg) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
166 arg (cdr arg)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
167 (cond ((eq keyword :topic) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
168 (setq topic value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
169 ((eq keyword :mode) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
170 (setq mode value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
171 ((eq keyword :regexp) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
172 (setq regexp value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
173 ((eq keyword :ignore-case) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
174 (setq ignore-case value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
175 ((eq keyword :doc-spec) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
176 (setq doc-spec value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
177 ((eq keyword :parse-rule) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
178 (setq parse-rule value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
179 ((eq keyword :other-modes) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
180 (setq other-modes value)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
181 (t |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
182 (error "Unknown keyword \"%S\"" keyword)))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
183 (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
|
184 (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
|
185 (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
|
186 (car (setq info-lookup-alist |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
187 (cons (cons topic nil) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
188 info-lookup-alist))))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
189 (mode-cell (assoc mode topic-cell))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
190 (if (null mode-cell) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
191 (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
|
192 (setcdr mode-cell data)))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
193 nil)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
194 |
18322 | 195 (defvar info-lookup-cache nil |
196 "Cache storing data maintained automatically by the program. | |
197 Value is an alist with cons cell of the form | |
198 | |
199 (HELP-TOPIC . ((HELP-MODE INITIALIZED COMPLETIONS REFER-MODES) ...)) | |
200 | |
201 HELP-TOPIC is the symbol of a help topic. | |
202 HELP-MODE is a mode's symbol. | |
203 INITIALIZED is nil if HELP-MODE is uninitialized, t if | |
204 HELP-MODE is initialized, and `0' means HELP-MODE is | |
205 initialized but void. | |
206 COMPLETIONS is an alist of documented help items. | |
207 REFER-MODES is a list of other help modes to use.") | |
208 | |
209 (defsubst info-lookup->cache (topic) | |
210 (or (assoc topic info-lookup-cache) | |
211 (car (setq info-lookup-cache | |
212 (cons (cons topic nil) | |
213 info-lookup-cache))))) | |
214 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
215 (defun info-lookup->topic-cache (topic) |
18322 | 216 (cdr (info-lookup->cache topic))) |
217 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
218 (defun info-lookup->mode-cache (topic mode) |
18322 | 219 (assoc mode (info-lookup->topic-cache topic))) |
220 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
221 (defun info-lookup->initialized (topic mode) |
18322 | 222 (nth 1 (info-lookup->mode-cache topic mode))) |
223 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
224 (defun info-lookup->completions (topic mode) |
18322 | 225 (or (info-lookup->initialized topic mode) |
226 (info-lookup-setup-mode topic mode)) | |
227 (nth 2 (info-lookup->mode-cache topic mode))) | |
228 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
229 (defun info-lookup->refer-modes (topic mode) |
18322 | 230 (or (info-lookup->initialized topic mode) |
231 (info-lookup-setup-mode topic mode)) | |
232 (nth 3 (info-lookup->mode-cache topic mode))) | |
233 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
234 (defun info-lookup->all-modes (topic mode) |
18322 | 235 (cons mode (info-lookup->refer-modes topic mode))) |
236 | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
237 (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
|
238 (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
|
239 |
18322 | 240 ;;;###autoload |
241 (defun info-lookup-reset () | |
242 "Throw away all cached data. | |
243 This command is useful if the user wants to start at the beginning without | |
244 quitting Emacs, for example, after some Info documents were updated on the | |
245 system." | |
246 (interactive) | |
247 (setq info-lookup-cache nil)) | |
248 | |
57469
2967bbb0802b
(info-lookup-file): Add info-file property.
Richard M. Stallman <rms@gnu.org>
parents:
55238
diff
changeset
|
249 ;;;###autoload (put 'info-lookup-symbol 'info-file "emacs") |
18322 | 250 ;;;###autoload |
251 (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
|
252 "Display the definition of SYMBOL, as found in the relevant manual. |
73692
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
253 When this command is called interactively, it reads SYMBOL from the |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
254 minibuffer. In the minibuffer, use M-n to yank the default argument |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
255 value into the minibuffer so you can edit it. The default symbol is the |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
256 one found at point. |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
257 |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
258 With prefix arg a query for the symbol help mode is offered." |
18322 | 259 (interactive |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
260 (info-lookup-interactive-arguments 'symbol current-prefix-arg)) |
18322 | 261 (info-lookup 'symbol symbol mode)) |
262 | |
57469
2967bbb0802b
(info-lookup-file): Add info-file property.
Richard M. Stallman <rms@gnu.org>
parents:
55238
diff
changeset
|
263 ;;;###autoload (put 'info-lookup-file 'info-file "emacs") |
18322 | 264 ;;;###autoload |
265 (defun info-lookup-file (file &optional mode) | |
266 "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
|
267 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
|
268 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
|
269 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
|
270 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
|
271 |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
272 With prefix arg a query for the file help mode is offered." |
18322 | 273 (interactive |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
274 (info-lookup-interactive-arguments 'file current-prefix-arg)) |
18322 | 275 (info-lookup 'file file mode)) |
276 | |
25057
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
277 (defun info-lookup-interactive-arguments (topic &optional query) |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
278 "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
|
279 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
|
280 (let* ((mode (cond (query |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
281 (info-lookup-change-mode topic)) |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
282 ((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
|
283 info-lookup-mode) |
6019ba9c1a95
(info-lookup-interactive-arguments): Add optional
Karl Heuer <kwzh@gnu.org>
parents:
25041
diff
changeset
|
284 ((info-lookup-change-mode topic)))) |
18322 | 285 (completions (info-lookup->completions topic mode)) |
286 (default (info-lookup-guess-default topic mode)) | |
287 (completion-ignore-case (info-lookup->ignore-case topic mode)) | |
288 (enable-recursive-minibuffers t) | |
289 (value (completing-read | |
24829
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
290 (if default |
18322 | 291 (format "Describe %s (default %s): " topic default) |
292 (format "Describe %s: " topic)) | |
24829
749c12791859
(info-lookup-file, info-lookup-symbol): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
24769
diff
changeset
|
293 completions nil nil nil 'info-lookup-history default))) |
18322 | 294 (list (if (equal value "") default value) mode))) |
295 | |
22281 | 296 (defun info-lookup-select-mode () |
297 (when (and (not info-lookup-mode) (buffer-file-name)) | |
298 (let ((file-name (file-name-nondirectory (buffer-file-name))) | |
299 (file-name-alist info-lookup-file-name-alist)) | |
300 (while (and (not info-lookup-mode) file-name-alist) | |
301 (when (string-match (caar file-name-alist) file-name) | |
302 (setq info-lookup-mode (cdar file-name-alist))) | |
303 (setq file-name-alist (cdr file-name-alist))))) | |
304 (or info-lookup-mode (setq info-lookup-mode major-mode))) | |
305 | |
18322 | 306 (defun info-lookup-change-mode (topic) |
307 (let* ((completions (mapcar (lambda (arg) | |
308 (cons (symbol-name (car arg)) (car arg))) | |
309 (info-lookup->topic-value topic))) | |
310 (mode (completing-read | |
311 (format "Use %s help mode: " topic) | |
312 completions nil t nil 'info-lookup-history))) | |
313 (or (setq mode (cdr (assoc mode completions))) | |
314 (error "No %s help available" topic)) | |
315 (or (info-lookup->mode-value topic mode) | |
316 (error "No %s help available for `%s'" topic mode)) | |
317 (setq info-lookup-mode mode))) | |
318 | |
319 (defun info-lookup (topic item mode) | |
320 "Display the documentation of a help item." | |
22281 | 321 (or mode (setq mode (info-lookup-select-mode))) |
18322 | 322 (or (info-lookup->mode-value topic mode) |
323 (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
|
324 (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
|
325 (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
|
326 (entry (or (assoc (if ignore-case (downcase item) item) completions) |
53407
0e54e5e10501
(info-lookup): Use assoc-string.
Richard M. Stallman <rms@gnu.org>
parents:
52401
diff
changeset
|
327 (assoc-string item completions t) |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
328 (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
|
329 (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
|
330 (window (selected-window)) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
331 found doc-spec node prefix suffix doc-found) |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
332 (if (not (eq major-mode 'Info-mode)) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
333 (if (not info-lookup-other-window-flag) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
334 (info) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
335 (progn |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
336 (save-window-excursion (info)) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
337 ;; Determine whether or not the Info buffer is visible in |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
338 ;; another frame on the same display. If it is, simply raise |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
339 ;; that frame. Otherwise, display it in another window. |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
340 (let* ((window (get-buffer-window "*info*" t)) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
341 (info-frame (and window (window-frame window)))) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
342 (if (and info-frame |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
343 (display-multi-frame-p) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
344 (memq info-frame (frames-on-display-list)) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
345 (not (eq info-frame (selected-frame)))) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
346 (select-frame info-frame) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
347 (switch-to-buffer-other-window "*info*")))))) |
18322 | 348 (while (and (not found) modes) |
349 (setq doc-spec (info-lookup->doc-spec topic (car modes))) | |
350 (while (and (not found) doc-spec) | |
351 (setq node (nth 0 (car doc-spec)) | |
352 prefix (nth 2 (car doc-spec)) | |
353 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
|
354 (when (condition-case error-data |
25310 | 355 (progn |
75979
9e18371d4dff
(info-lookup): Bind Info-fontify-maximum-menu-size to nil to speed up lookup
Eli Zaretskii <eliz@gnu.org>
parents:
75751
diff
changeset
|
356 ;; Don't need Index menu fontifications here, and |
9e18371d4dff
(info-lookup): Bind Info-fontify-maximum-menu-size to nil to speed up lookup
Eli Zaretskii <eliz@gnu.org>
parents:
75751
diff
changeset
|
357 ;; they slow down the lookup. |
9e18371d4dff
(info-lookup): Bind Info-fontify-maximum-menu-size to nil to speed up lookup
Eli Zaretskii <eliz@gnu.org>
parents:
75751
diff
changeset
|
358 (let (Info-fontify-maximum-menu-size) |
9e18371d4dff
(info-lookup): Bind Info-fontify-maximum-menu-size to nil to speed up lookup
Eli Zaretskii <eliz@gnu.org>
parents:
75751
diff
changeset
|
359 (Info-goto-node node) |
9e18371d4dff
(info-lookup): Bind Info-fontify-maximum-menu-size to nil to speed up lookup
Eli Zaretskii <eliz@gnu.org>
parents:
75751
diff
changeset
|
360 (setq doc-found t))) |
25310 | 361 (error |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
362 (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
|
363 (sit-for 1) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
364 nil)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
365 (condition-case nil |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
366 (progn |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
367 ;; 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
|
368 (let ((case-fold-search nil)) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
369 (re-search-forward |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
370 (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
|
371 ":"))) |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
372 (Info-follow-nearest-node) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
373 (setq found t) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
374 (if (or prefix suffix) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
375 (let ((case-fold-search |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
376 (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
|
377 (buffer-read-only nil)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
378 (goto-char (point-min)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
379 (re-search-forward |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
380 (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
|
381 (goto-char (match-beginning 0)) |
28112
853a7fcaf7f0
(info-lookup): Use display-color-p.
Dave Love <fx@gnu.org>
parents:
25364
diff
changeset
|
382 (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
|
383 ;; Search again for ITEM so that the first |
42942 | 384 ;; 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
|
385 (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
|
386 (let ((start (match-beginning 0)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
387 (end (match-end 0))) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
388 (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
|
389 (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
|
390 start end (current-buffer)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
391 (setq info-lookup-highlight-overlay |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
392 (make-overlay start end)))) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
393 (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
|
394 'face info-lookup-highlight-face))))) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
395 (error nil))) |
18322 | 396 (setq doc-spec (cdr doc-spec))) |
397 (setq modes (cdr modes))) | |
48940
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
398 ;; 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
|
399 ;; 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
|
400 (unless (or ignore-case |
78987e4bee15
(info-lookup): For ease of use try item
Richard M. Stallman <rms@gnu.org>
parents:
46525
diff
changeset
|
401 (string-equal item (car entry))) |
48988
d50289791f55
(info-lookup): Fix error message typo.
Richard M. Stallman <rms@gnu.org>
parents:
48940
diff
changeset
|
402 (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
|
403 (or doc-found |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
404 (error "Info documentation for lookup was not found")) |
18322 | 405 ;; Don't leave the Info buffer if the help item couldn't be looked up. |
406 (if (and info-lookup-other-window-flag found) | |
407 (select-window window)))) | |
408 | |
409 (defun info-lookup-setup-mode (topic mode) | |
410 "Initialize the internal data structure." | |
411 (or (info-lookup->initialized topic mode) | |
412 (let (cell data (initialized 0) completions refer-modes) | |
413 (if (not (info-lookup->mode-value topic mode)) | |
414 (message "No %s help available for `%s'" topic mode) | |
415 ;; Recursively setup cross references. | |
416 ;; But refer only to non-void modes. | |
55097
5c2770cd5506
Add support for cfengine-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54387
diff
changeset
|
417 (dolist (arg (info-lookup->other-modes topic mode)) |
5c2770cd5506
Add support for cfengine-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54387
diff
changeset
|
418 (or (info-lookup->initialized topic arg) |
5c2770cd5506
Add support for cfengine-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54387
diff
changeset
|
419 (info-lookup-setup-mode topic arg)) |
5c2770cd5506
Add support for cfengine-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54387
diff
changeset
|
420 (and (eq (info-lookup->initialized topic arg) t) |
5c2770cd5506
Add support for cfengine-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54387
diff
changeset
|
421 (setq refer-modes (cons arg refer-modes)))) |
18322 | 422 (setq refer-modes (nreverse refer-modes)) |
423 ;; Build the full completion alist. | |
424 (setq completions | |
25041
d45a32b777f6
(info-lookup-setup-mode): Don't give up, if
Karl Heuer <kwzh@gnu.org>
parents:
24829
diff
changeset
|
425 (nconc (condition-case nil |
d45a32b777f6
(info-lookup-setup-mode): Don't give up, if
Karl Heuer <kwzh@gnu.org>
parents:
24829
diff
changeset
|
426 (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
|
427 (error nil)) |
18322 | 428 (apply 'append |
429 (mapcar (lambda (arg) | |
430 (info-lookup->completions topic arg)) | |
431 refer-modes)))) | |
432 (setq initialized t)) | |
433 ;; Update `info-lookup-cache'. | |
434 (setq cell (info-lookup->mode-cache topic mode) | |
435 data (list initialized completions refer-modes)) | |
436 (if (not cell) | |
437 (setcdr (info-lookup->cache topic) | |
438 (cons (cons mode data) (info-lookup->topic-cache topic))) | |
439 (setcdr cell data)) | |
440 initialized))) | |
441 | |
442 (defun info-lookup-make-completions (topic mode) | |
443 "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
|
444 (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
|
445 (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
|
446 "\\)\\([ \t].*\\)?$")) |
75751
8cc088fc5fb2
(info-lookup-make-completions): Bind Info-fontify-maximum-menu-size to nil
Eli Zaretskii <eliz@gnu.org>
parents:
75347
diff
changeset
|
447 Info-fontify-maximum-menu-size |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
448 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
|
449 (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
|
450 (with-current-buffer buffer |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
451 (Info-mode)) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
452 (while doc-spec |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
453 (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
|
454 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
|
455 (lambda (arg) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
456 (if (string-match regexp arg) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
457 (match-string 1 arg)))) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
458 ((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
|
459 (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
|
460 (lambda (arg) |
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
461 (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
|
462 (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
|
463 (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
|
464 (with-current-buffer buffer |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
465 (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
|
466 (when (condition-case error-data |
25310 | 467 (progn |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
468 (Info-goto-node node) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
469 (setq doc-found t)) |
25310 | 470 (error |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
471 (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
|
472 (sit-for 1) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
473 nil)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
474 (condition-case nil |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
475 (progn |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
476 (goto-char (point-min)) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
477 (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
|
478 (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
|
479 (setq entry (match-string 1) |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
480 item (funcall trans entry)) |
23365
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
481 ;; `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
|
482 (when (and item |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
483 ;; Sometimes there's more than one Menu: |
25310 | 484 (not (string= entry "Menu"))) |
23365
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
485 (and (info-lookup->ignore-case topic mode) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
486 (setq item (downcase item))) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
487 (and (string-equal entry item) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
488 (setq entry nil)) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
489 (and (or (assoc item result) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
490 (setq result (cons (cons item entry) |
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
491 result)))))))) |
20690
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
492 (error nil)))) |
20519
c7b3ef0ed1ad
(info-lookup-symbol-alist): Handle Emacs Lisp mode.
Richard M. Stallman <rms@gnu.org>
parents:
18323
diff
changeset
|
493 (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
|
494 (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
|
495 (or doc-found |
a51c71dd5cda
(info-lookup): Report if Info-goto-node fails.
Richard M. Stallman <rms@gnu.org>
parents:
20519
diff
changeset
|
496 (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
|
497 result)) |
18322 | 498 |
499 (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
|
500 "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
|
501 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
|
502 Return nil if there is nothing appropriate in the buffer near point." |
18322 | 503 (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
|
504 guess) |
18322 | 505 (while (and (not guess) modes) |
506 (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
|
507 modes (cdr modes))) |
18322 | 508 ;; Collapse whitespace characters. |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
509 (when guess |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
510 (let ((pos 0)) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
511 (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
|
512 (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
|
513 (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
|
514 guess)) |
18322 | 515 |
516 (defun info-lookup-guess-default* (topic mode) | |
517 (let ((case-fold-search (info-lookup->ignore-case topic mode)) | |
518 (rule (or (info-lookup->parse-rule topic mode) | |
519 (info-lookup->regexp topic mode))) | |
520 (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
|
521 (save-excursion |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
522 (if (symbolp rule) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
523 (setq result (funcall rule)) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
524 (if (consp rule) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
525 (setq regexp (car rule) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
526 subexp (cdr rule)) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
527 (setq regexp rule |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
528 subexp 0)) |
25310 | 529 ;; If at start of symbol, don't go back to end of previous one. |
530 (if (save-match-data | |
531 (looking-at "[ \t\n]")) | |
532 (skip-chars-backward " \t\n")) | |
533 (setq end (point)) | |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
534 (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
|
535 (looking-at regexp) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
536 (>= (match-end 0) end)) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
537 (setq result (match-string subexp))) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
538 (if (not result) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
539 (progn |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
540 (goto-char start) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
541 (skip-chars-forward " \t\n") |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
542 (and (looking-at regexp) |
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
543 (setq result (match-string subexp))))))) |
18322 | 544 result)) |
545 | |
546 (defun info-lookup-guess-c-symbol () | |
547 "Get the C symbol at point." | |
548 (condition-case nil | |
549 (progn | |
25222
1802f1bb3285
(info-lookup-guess-c-symbol): Use skip-syntax-backward.
Karl Heuer <kwzh@gnu.org>
parents:
25057
diff
changeset
|
550 (skip-syntax-backward "w_") |
18322 | 551 (let ((start (point)) prefix name) |
552 ;; Test for a leading `struct', `union', or `enum' keyword | |
553 ;; but ignore names like `foo_struct'. | |
554 (setq prefix (and (< (skip-chars-backward " \t\n") 0) | |
555 (< (skip-chars-backward "_a-zA-Z0-9") 0) | |
556 (looking-at "\\(struct\\|union\\|enum\\)\\s ") | |
557 (concat (match-string 1) " "))) | |
558 (goto-char start) | |
559 (and (looking-at "[_a-zA-Z][_a-zA-Z0-9]*") | |
560 (setq name (match-string 0))) | |
561 ;; Caveat! Look forward if point is at `struct' etc. | |
562 (and (not prefix) | |
563 (or (string-equal name "struct") | |
564 (string-equal name "union") | |
565 (string-equal name "enum")) | |
566 (looking-at "[a-z]+\\s +\\([_a-zA-Z][_a-zA-Z0-9]*\\)") | |
567 (setq prefix (concat name " ") | |
568 name (match-string 1))) | |
569 (and (or prefix name) | |
570 (concat prefix name)))) | |
571 (error nil))) | |
572 | |
73692
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
573 (defun info-lookup-guess-custom-symbol () |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
574 "Get symbol at point in custom buffers." |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
575 (condition-case nil |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
576 (save-excursion |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
577 (let ((case-fold-search t) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
578 (ignored-chars "][()`',:.\" \t\n") |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
579 (significant-chars "^][()`',:.\" \t\n") |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
580 beg end) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
581 (cond |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
582 ((and (memq (get-char-property (point) 'face) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
583 '(custom-variable-tag custom-variable-tag-face)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
584 (setq beg (previous-single-char-property-change |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
585 (point) 'face nil (line-beginning-position))) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
586 (setq end (next-single-char-property-change |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
587 (point) 'face nil (line-end-position))) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
588 (> end beg)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
589 (subst-char-in-string |
74232
4accd8d9cc3c
(info-lookup-guess-custom-symbol): "?\ " -> "?\s".
Juanma Barranquero <lekktu@gmail.com>
parents:
73692
diff
changeset
|
590 ?\s ?\- (buffer-substring-no-properties beg end))) |
73692
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
591 ((or (and (looking-at (concat "[" significant-chars "]")) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
592 (save-excursion |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
593 (skip-chars-backward significant-chars) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
594 (setq beg (point))) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
595 (skip-chars-forward significant-chars) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
596 (setq end (point)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
597 (> end beg)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
598 (and (looking-at "[ \t\n]") |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
599 (looking-back (concat "[" significant-chars "]")) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
600 (setq end (point)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
601 (skip-chars-backward significant-chars) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
602 (setq beg (point)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
603 (> end beg)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
604 (and (skip-chars-forward ignored-chars) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
605 (setq beg (point)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
606 (skip-chars-forward significant-chars) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
607 (setq end (point)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
608 (> end beg))) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
609 (buffer-substring-no-properties beg end))))) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
610 (error nil))) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
611 |
18322 | 612 ;;;###autoload |
613 (defun info-complete-symbol (&optional mode) | |
614 "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
|
615 (interactive) |
64d728fb396a
(info-complete-symbol): If MODE is nil, use the default value.
Richard M. Stallman <rms@gnu.org>
parents:
18322
diff
changeset
|
616 (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
|
617 (or mode |
64d728fb396a
(info-complete-symbol): If MODE is nil, use the default value.
Richard M. Stallman <rms@gnu.org>
parents:
18322
diff
changeset
|
618 (if (info-lookup->mode-value |
22281 | 619 'symbol (info-lookup-select-mode)) |
620 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
|
621 (info-lookup-change-mode 'symbol))))) |
18322 | 622 |
623 ;;;###autoload | |
624 (defun info-complete-file (&optional mode) | |
625 "Perform completion on file preceding point." | |
20973
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
626 (interactive) |
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
627 (info-complete 'file |
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
628 (or mode |
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
629 (if (info-lookup->mode-value |
22281 | 630 'file (info-lookup-select-mode)) |
631 info-lookup-mode | |
20973
b7e7f7c9685a
Added support for the Emacs Lisp manual.
Karl Heuer <kwzh@gnu.org>
parents:
20909
diff
changeset
|
632 (info-lookup-change-mode 'file))))) |
18322 | 633 |
634 (defun info-complete (topic mode) | |
635 "Try to complete a help item." | |
636 (barf-if-buffer-read-only) | |
22281 | 637 (or mode (setq mode (info-lookup-select-mode))) |
18322 | 638 (or (info-lookup->mode-value topic mode) |
639 (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
|
640 (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
|
641 (start (point)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
642 try) |
18322 | 643 (while (and (not try) modes) |
644 (setq mode (car modes) | |
645 modes (cdr modes) | |
646 try (info-lookup-guess-default* topic mode)) | |
647 (goto-char start)) | |
648 (and (not try) | |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
649 (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
|
650 (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
|
651 (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
|
652 completion) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
653 (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
|
654 (cond ((not completion) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
655 (ding) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
656 (message "No match")) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
657 ((stringp completion) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
658 (or (assoc completion completions) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
659 (setq completion (completing-read |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
660 (format "Complete %S: " topic) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
661 completions nil t completion |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
662 info-lookup-history))) |
25310 | 663 ;; Find the original symbol and zap it. |
664 (end-of-line) | |
665 (while (and (search-backward try nil t) | |
666 (< start (point)))) | |
667 (replace-match "") | |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
668 (insert completion)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
669 (t |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
670 (message "%s is complete" |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
671 (capitalize (prin1-to-string topic)))))))) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
672 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
673 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
674 ;;; Initialize some common modes. |
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 'c-mode :topic 'symbol |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
678 :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
|
679 :doc-spec '(("(libc)Function Index" nil |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
680 "^[ \t]+-+ \\(Function\\|Macro\\): .*\\<" "\\>") |
59558
5d4f8c85454f
(c-mode/symbol): Add ^` to prefix, and change
Eli Zaretskii <eliz@gnu.org>
parents:
58990
diff
changeset
|
681 ;; prefix/suffix has to match things like |
5d4f8c85454f
(c-mode/symbol): Add ^` to prefix, and change
Eli Zaretskii <eliz@gnu.org>
parents:
58990
diff
changeset
|
682 ;; " -- Macro: int F_DUPFD" |
5d4f8c85454f
(c-mode/symbol): Add ^` to prefix, and change
Eli Zaretskii <eliz@gnu.org>
parents:
58990
diff
changeset
|
683 ;; " -- Variable: char * tzname [2]" |
5d4f8c85454f
(c-mode/symbol): Add ^` to prefix, and change
Eli Zaretskii <eliz@gnu.org>
parents:
58990
diff
changeset
|
684 ;; "`DBL_MAX'" (texinfo @table) |
5d4f8c85454f
(c-mode/symbol): Add ^` to prefix, and change
Eli Zaretskii <eliz@gnu.org>
parents:
58990
diff
changeset
|
685 ;; suffix "\\>" is not used because that sends DBL_MAX to |
5d4f8c85454f
(c-mode/symbol): Add ^` to prefix, and change
Eli Zaretskii <eliz@gnu.org>
parents:
58990
diff
changeset
|
686 ;; DBL_MAX_EXP ("_" is a non-word char) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
687 ("(libc)Variable Index" nil |
59558
5d4f8c85454f
(c-mode/symbol): Add ^` to prefix, and change
Eli Zaretskii <eliz@gnu.org>
parents:
58990
diff
changeset
|
688 "^\\([ \t]+-+ \\(Variable\\|Macro\\): .*\\<\\|`\\)" |
5d4f8c85454f
(c-mode/symbol): Add ^` to prefix, and change
Eli Zaretskii <eliz@gnu.org>
parents:
58990
diff
changeset
|
689 "\\( \\|'?$\\)") |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
690 ("(libc)Type Index" nil |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
691 "^[ \t]+-+ Data Type: \\<" "\\>") |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
692 ("(termcap)Var Index" nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
693 "^[ \t]*`" "'")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
694 :parse-rule 'info-lookup-guess-c-symbol) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
695 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
696 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
697 :mode 'c-mode :topic 'file |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
698 :regexp "[_a-zA-Z0-9./+-]+" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
699 :doc-spec '(("(libc)File Index"))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
700 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
701 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
702 :mode 'bison-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
703 :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
|
704 :doc-spec '(("(bison)Index" nil |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
705 "`" "'")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
706 :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
|
707 :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
|
708 |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
709 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
710 :mode 'makefile-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
711 :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
|
712 :doc-spec '(("(make)Name Index" nil |
41076
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
713 "^[ \t]*`" "'") |
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
714 ("(automake)Macro and Variable Index" nil |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
715 "^[ \t]*`" "'")) |
41076
1be1f069f19f
(makefile-mode): Add info for automake.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38436
diff
changeset
|
716 :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
|
717 :other-modes '(automake-mode)) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
718 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
719 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
720 :mode 'texinfo-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
721 :regexp "@\\([a-zA-Z]+\\|[^a-zA-Z]\\)" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
722 :doc-spec '(("(texinfo)Command and Variable Index" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
723 ;; Ignore Emacs commands and prepend a `@'. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
724 (lambda (item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
725 (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
|
726 (concat "@" (match-string 1 item)))) |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
727 "`" "[' ]"))) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
728 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
729 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
730 :mode 'm4-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
731 :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
|
732 :doc-spec '(("(m4)Macro index")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
733 :parse-rule "[_a-zA-Z0-9]+") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
734 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
735 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
736 :mode 'autoconf-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
737 :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
|
738 :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
|
739 ;; 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
|
740 ;; 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
|
741 ("(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
|
742 (lambda (item) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
743 (if (string-match "^A._" item) item (concat "AC_" item))) |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
744 "^[ \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
|
745 ;; 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
|
746 ;; 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
|
747 ;; 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
|
748 ;; 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
|
749 ("(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
|
750 (lambda (item) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
751 (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
|
752 (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
|
753 (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
|
754 item) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
755 ((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
|
756 (concat "AS_" item)) |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
757 (t |
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
758 (concat "m4_" item))))) |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
759 "^[ \t]+-+ Macro: .*\\<" "\\>") |
51242
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
760 ;; 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
|
761 ("(autoconf)Autotest Macro Index" "AT_" |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
762 "^[ \t]+-+ Macro: .*\\<" "\\>") |
51242
661e2fe7e775
(autoconf-mode setups): Recognise AH_ and AU_ entries in "(autoconf)Autoconf
Juanma Barranquero <lekktu@gmail.com>
parents:
50950
diff
changeset
|
763 ;; 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
|
764 ("(autoconf)Macro Index" "AC_" |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
765 "^[ \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
|
766 ;; 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
|
767 ;; 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
|
768 ;; 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
|
769 ("(automake)Macro and Variable Index" nil |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
770 "^[ \t]*`" "'")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
771 ;; 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
|
772 :parse-rule 'ignore |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
773 :other-modes '(m4-mode)) |
18322 | 774 |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
775 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
776 :mode 'awk-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
777 :regexp "[_a-zA-Z]+" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
778 :doc-spec '(("(gawk)Index" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
779 (lambda (item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
780 (let ((case-fold-search nil)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
781 (cond |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
782 ;; `BEGIN' and `END'. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
783 ((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
|
784 (match-string 1 item)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
785 ;; `if', `while', `do', ... |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
786 ((string-match "^\\([a-z]+\\) statement\\b" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
787 (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
|
788 (match-string 1 item))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
789 ;; `NR', `NF', ... |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
790 ((string-match "^[A-Z]+$" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
791 item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
792 ;; Built-in functions (matches to many entries). |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
793 ((string-match "^[a-z]+$" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
794 item)))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
795 "`" "\\([ \t]*([^)]*)\\)?'"))) |
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 'perl-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
799 :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
|
800 :doc-spec '(("(perl5)Function Index" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
801 (lambda (item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
802 (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
|
803 (match-string 1 item))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
804 "^" "\\b") |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
805 ("(perl5)Variable Index" |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
806 (lambda (item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
807 ;; Work around bad formatted array variables. |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
808 (let ((sym (cond ((or (string-match "^\\$\\(.\\|@@\\)$" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
809 (string-match "^\\$\\^[A-Z]$" item)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
810 item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
811 ((string-match |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
812 "^\\([$%@]\\|@@\\)?[_a-zA-Z0-9]+" item) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
813 (match-string 0 item)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
814 (t "")))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
815 (if (string-match "@@" sym) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
816 (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
|
817 (substring sym (1- (match-end 0)))))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
818 (if (string-equal sym "") nil sym))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
819 "^" "\\b")) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
820 :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
|
821 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
822 (info-lookup-maybe-add-help |
36605
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
823 :mode 'cperl-mode |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
824 :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
|
825 :other-modes '(perl-mode)) |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
826 |
d29b9968e84f
Docstring fixes and dead code eliminated.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
30348
diff
changeset
|
827 (info-lookup-maybe-add-help |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
828 :mode 'latex-mode |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
829 :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
|
830 :doc-spec '(("(latex)Command Index" nil |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
831 "`" "\\({[^}]*}\\)?'"))) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
832 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
833 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
834 :mode 'emacs-lisp-mode |
73692
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
835 :regexp "[^][()`',\" \t\n]+" |
50451
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
836 :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
|
837 ;; those without as `M-x foo'. |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
838 ("(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
|
839 ;; 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
|
840 ("(emacs)Variable Index" nil "`" "'") |
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
841 ;; Almost all functions, variables, etc appear in nodes as |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
842 ;; " -- Function: foo" etc. A small number of aliases and |
50451
fedb9513a26e
(emacs-lisp-mode): Add prefix/suffix matching regexps.
Juanma Barranquero <lekktu@gmail.com>
parents:
50407
diff
changeset
|
843 ;; 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
|
844 ;; 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
|
845 ;; 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
|
846 ;; 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
|
847 ;; sort of fallback match scheme existed. |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
848 ("(elisp)Index" nil "^ -+ .*: " "\\( \\|$\\)"))) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
849 |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
850 (info-lookup-maybe-add-help |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
851 :mode 'lisp-interaction-mode |
73692
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
852 :regexp "[^][()`',\" \t\n]+" |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
853 :parse-rule 'ignore |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
854 :other-modes '(emacs-lisp-mode)) |
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
855 |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
856 (info-lookup-maybe-add-help |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
857 :mode 'lisp-mode |
73692
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
858 :regexp "[^()`',\" \t\n]+" |
21334
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
859 :parse-rule 'ignore |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
860 :other-modes '(emacs-lisp-mode)) |
66b3b9fe3e3c
(info-lookup->topic-cache): Use defun, not defsubst.
Richard M. Stallman <rms@gnu.org>
parents:
20973
diff
changeset
|
861 |
22281 | 862 (info-lookup-maybe-add-help |
863 :mode 'scheme-mode | |
54160
815ea37f89e4
In scheme-mode symbol regexp, disallow backquote and
Eli Zaretskii <eliz@gnu.org>
parents:
53770
diff
changeset
|
864 :regexp "[^()`',\" \t\n]+" |
22281 | 865 :ignore-case t |
23365
d400637428d1
Remove duplicate scheme-mode entry.
Dave Love <fx@gnu.org>
parents:
23346
diff
changeset
|
866 ;; Aubrey Jaffer's rendition from <URL:ftp://ftp-swiss.ai.mit.edu/pub/scm> |
22281 | 867 :doc-spec '(("(r5rs)Index" nil |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
868 "^[ \t]+-+ [^:]+:[ \t]*" "\\b"))) |
22281 | 869 |
23346 | 870 (info-lookup-maybe-add-help |
871 :mode 'octave-mode | |
872 :regexp "[_a-zA-Z0-9]+" | |
50407
41c0eed9d556
*** empty log message ***
Juanma Barranquero <lekktu@gmail.com>
parents:
50347
diff
changeset
|
873 :doc-spec '(("(octave)Function Index" nil |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
874 "^ -+ [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil) |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
875 ("(octave)Variable Index" nil "^ -+ [^:]+:[ ]+" nil) |
23346 | 876 ;; Catch lines of the form "xyz statement" |
25310 | 877 ("(octave)Concept Index" |
23346 | 878 (lambda (item) |
879 (cond | |
880 ((string-match "^\\([A-Z]+\\) statement\\b" item) | |
881 (match-string 1 item)) | |
882 (t nil))) | |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
883 nil; "^ -+ [^:]+:[ ]+" don't think this prefix is useful here. |
23346 | 884 nil))) |
50347
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
885 |
53770
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
886 (info-lookup-maybe-add-help |
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
887 :mode 'maxima-mode |
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
888 :ignore-case t |
73356
1f6137cb9eff
* info-look.el: Update lookup regexp for maxima modes.
Chong Yidong <cyd@stupidchicken.com>
parents:
68651
diff
changeset
|
889 :regexp "[a-zA-Z0-9_%]+" |
58017
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
890 :doc-spec '( ("(maxima)Function and Variable Index" nil |
57d5e5e2e4db
(info-lookup): Allow reusing in the current buffer
Juri Linkov <juri@jurta.org>
parents:
57469
diff
changeset
|
891 "^ -+ [^:]+:[ ]+\\(\\[[^=]*=[ ]+\\)?" nil))) |
53770
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
892 |
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
893 (info-lookup-maybe-add-help |
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
894 :mode 'inferior-maxima-mode |
73356
1f6137cb9eff
* info-look.el: Update lookup regexp for maxima modes.
Chong Yidong <cyd@stupidchicken.com>
parents:
68651
diff
changeset
|
895 :regexp "[a-zA-Z0-9_%]+" |
53770
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
896 :other-modes '(maxima-mode)) |
293189a557d0
Add support for maxima-mode. Update commentary
Stephen Eglen <stephen@gnu.org>
parents:
53407
diff
changeset
|
897 |
50347
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
898 ;; 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
|
899 ;; 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
|
900 ;; 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
|
901 ;; 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
|
902 ;; |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
903 ;; 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
|
904 ;; 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
|
905 ;; $# 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
|
906 ;; 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
|
907 ;; 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
|
908 ;; 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
|
909 |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
910 (info-lookup-maybe-add-help |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
911 :mode 'sh-mode :topic 'symbol |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
912 ;; 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
|
913 ;; 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
|
914 :regexp "\\([a-zA-Z0-9_-]+\\|[!{}@*#?$]\\|\\[\\[?\\|]]?\\)" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
915 :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
|
916 ("(bash)Reserved Word Index" nil "^`" "[ .']") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
917 ("(bash)Variable Index" nil "^`" "[ .']") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
918 ;; 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
|
919 ;; 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
|
920 ;; "[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
|
921 ("(coreutils)Index" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
922 (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
|
923 ;; 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
|
924 ;; are things like "foo invocation". |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
925 ("(diff)Index" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
926 (lambda (item) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
927 (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
|
928 (match-string 1 item)))) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
929 ;; 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
|
930 ;; 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
|
931 ("(sed)Concept Index" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
932 (lambda (item) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
933 (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
|
934 "sed"))) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
935 ;; 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
|
936 ;; 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
|
937 ("(gawk)Index" |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
938 (lambda (item) |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
939 (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
|
940 "awk") |
d6a0264d2fe2
(sh-mode): Add doc-specs for commands and variables.
Juanma Barranquero <lekktu@gmail.com>
parents:
48988
diff
changeset
|
941 ((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
|
942 "gawk")))))) |
55097
5c2770cd5506
Add support for cfengine-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54387
diff
changeset
|
943 |
55238
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
944 ;; This misses some things which occur as node names but not in the |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
945 ;; index. Unfortunately it also picks up the wrong one of multiple |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
946 ;; entries for the same term in some cases. --fx |
55097
5c2770cd5506
Add support for cfengine-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54387
diff
changeset
|
947 (info-lookup-maybe-add-help |
5c2770cd5506
Add support for cfengine-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
54387
diff
changeset
|
948 :mode 'cfengine-mode |
58798
bcb4709c5b09
(info-lookup-maybe-add-help cfengine-mode): Regexp typo.
Richard M. Stallman <rms@gnu.org>
parents:
58017
diff
changeset
|
949 :regexp "[[:alnum:]_]+\\(?:()\\)?" |
55238
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
950 :doc-spec '(("(cfengine-Reference)Variable Index" |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
951 (lambda (item) |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
952 ;; Index entries may be like `IsPlain()' |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
953 (if (string-match "\\([[:alnum:]_]+\\)()" item) |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
954 (match-string 1 item) |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
955 item)) |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
956 ;; This gets functions in evaluated classes. Other |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
957 ;; possible patterns don't seem to work too well. |
373bc9e19710
(cfengine-mode): Accept a terminal ().
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
55097
diff
changeset
|
958 "`" "("))) |
73692
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
959 |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
960 (info-lookup-maybe-add-help |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
961 :mode 'custom-mode |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
962 :ignore-case t |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
963 :regexp "[^][()`',:\" \t\n]+" |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
964 :parse-rule 'info-lookup-guess-custom-symbol |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
965 :other-modes '(emacs-lisp-mode)) |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
966 |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
967 (info-lookup-maybe-add-help |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
968 :mode 'help-mode |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
969 :regexp "[^][()`',:\" \t\n]+" |
1cf33b77992b
(info-lookup-guess-custom-symbol): New function for retrieving symbol at point
Eli Zaretskii <eliz@gnu.org>
parents:
73356
diff
changeset
|
970 :other-modes '(emacs-lisp-mode)) |
20909
542ae65815fb
(info-complete): Rewrite minibuffer completion code.
Richard M. Stallman <rms@gnu.org>
parents:
20899
diff
changeset
|
971 |
18322 | 972 (provide 'info-look) |
973 | |
52401 | 974 ;;; arch-tag: 0f1e3ea3-32a2-4461-bbab-3cff93539a74 |
18322 | 975 ;;; info-look.el ends here |