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