annotate lisp/=word-help.el @ 32213:4e8bf6316c14

*** empty log message ***
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 06 Oct 2000 13:55:47 +0000
parents 727cf56647a4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; word-help.el --- keyword help for any language doc'd in TeXinfo.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (c) 1996 Free Software Foundation, Inc.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
17977
727cf56647a4 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17906
diff changeset
5 ;; Author: Jens T. Berger Thielemann <jensthi@ifi.uio.no>
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
6 ;; Keywords: help, keyword, languages, completion
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; This program is free software; you can redistribute it and/or modify
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; any later version.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; This program is distributed in the hope that it will be useful,
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; Boston, MA 02111-1307, USA.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;; Commentary:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;; This package provides a rather general interface for doing keyword
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
28 ;; help in most languages. In short, it'll determine which TeXinfo
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; file which is relevant for the current mode; cache the index and
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; use regexps to give you help on the keyword you're looking at.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;; Installation
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; ************
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;; For the default setup to work for all supported modes, make sure
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; the Texinfo files from the following packages are installed:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; Texinfo file | Available in archive or URL | Notes
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; autoconf.info | autoconf-2.10.tar.gz | -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; bison.info | bison-1.25.tar.gz | -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; libc.info | glibc-1.09.1.tar.gz | -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;; elisp.info | elisp-manual-19-2.4.tar.gz | -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; latex.info | ftp://ftp.dante.de/pub/tex/info/latex2e-help-texinfo/latex2e.texi
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; groff.info | groff-1.10.tar.gz | -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; m4.info | m4-1.4.tar.gz | -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 ;; make.info | make-3.75.tar.gz | -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;; perl.info | http://www.perl.com/CPAN/doc/manual/info/
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; simula.info | Mail bjort@ifi.uio.no | Written in Norwegian
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; texinfo.info | texinfo-3.9.tar.gz | -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 ;; BTW: We refer to Texinfo files by just their last component, not
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;; with an absolute file name. You must thus set up
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; `Info-directory-list' and `Info-default-directory-list' so that
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 ;; these can automatically be located.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 ;; Usage
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 ;; *****
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 ;;
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 ;; Place the cursor over the function/variable/type/whatever you want
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 ;; help on. Type "C-h C-i". `word-help' will then make a suggestion
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 ;; to an index topic; press return to accept this. If not, you may use
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 ;; tab-completion to find the topic you're interested in.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
64 ;; `word-help' is also able to do symbol completion via the
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
65 ;; `word-help-complete' function. Bind this function to C-TAB by
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
66 ;; adding the following line to your .emacs file:
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
67 ;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
68 ;; (global-set-key [?\M-\t] 'word-help-complete)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
69 ;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
70 ;; Note that some modes automatically override this key; you may
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
71 ;; therefore wish to either put the above statement in a hook or
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
72 ;; associate the function with an other key.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
73
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 ;; Usually, `word-help' is able to determine the relevant Texinfo
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; file from looking at the buffer's `mode-name'; if not, you can use
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76 ;; the interactive function `set-help-file' to set this.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 ;; Customizing
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 ;; ***********
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 ;;
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;; User interface
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;; --------------
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 ;;
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;; Two variables control the behaviour of the user-interface of
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ;; `word-help': `word-help-split-window' and
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 ;; `word-help-magic-index'. Do C-h v to get more information on
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;; these.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ;; Adding more Texinfo files
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;; -------------------------
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ;;
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 ;; Associations between mode-names and Texinfo files can be done
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 ;; through the `word-help-mode-alist' variable, which defines an
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 ;; `alist' making `set-help-file' able to initialize the necessary
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 ;; variable.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
97 ;; NOTE: If you have to customize the regexps, it is *CRUCIAL* that
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
98 ;; none of your regexps match the empty string! Not adhering to this
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
99 ;; restriction will make `word-help' enter an infinite loop.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
100
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;; Contacting the author
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;; *********************
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;;
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 ;; If you wish to contact me for any reason, please feel free to write
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 ;; to:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 ;; Jens Berger
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 ;; Spektrumveien 4
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;; N-0666 Oslo
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; Norway
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;;
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 ;; E-mail: <jensthi@ifi.uio.no>
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 ;; Have fun.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 ;;
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 ;;; Code:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 ;;
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 (require 'info)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 ;;;--------------------
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 ;;; USER OPTIONS
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;;;--------------------
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 (defvar word-help-split-window t
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 "*Non-nil means that the info buffer will pop up in a separate window.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 If nil, we will just switch to it.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
130 (defvar word-help-magic-index t
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
131 "*Non-nil means that the keyword will be searched for in the requested node.
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 This is done by determining whether the line the point is positioned
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 on after using `Info-goto-node', actually contains the keyword. If
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134 not, we will search for the first occurence of the keyword. This may
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 help when the info file isn't correctly indexed.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 ;;; ---- end of user configurable variables
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139 ;;;-------------------------
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 ;;; ADVANCED USER OPTIONS
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 ;;;-------------------------
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143 (defvar word-help-mode-alist
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
144 '(
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
145 ("autoconf"
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (("autoconf" "Macro Index") ("m4" "Macro index"))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147 (("AC_\\([A-Za-z0-9_]+\\)" 1)
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
148 ("[a-z]+"))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
149 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
150 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
151 (("AC_\\([A-Za-z0-9_]+\\)" 1 nil (("^[A-Z_]+$")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
152 ("[a-z_][a-z_]*" 0 nil (("^[a-z_]+$")))))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 ("Bison"
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 (("bison" "Index")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 ("libc" "Type Index" "Function Index" "Variable Index"))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
157 (("%[A-Za-z]*")
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
158 ("[A-Za-z_][A-Za-z0-9_]*"))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
159 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
160 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
161 (("%[A-Za-z]*" nil nil (("^%")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
162 ("[A-Za-z_][A-Za-z0-9_]*" nil nil (("[A-Za-z_][A-Za-z0-9_]*")))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
163
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 ("YACC" . "Bison")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 ("C" (("libc" "Type Index" "Function Index" "Variable Index")))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167 ("C++" . "C")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 ("Emacs-Lisp"
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 (("elisp" "Index"))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
171 (("[^][ ()\n\t.\"'#]+"))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
172 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
173 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
174 lisp-complete-symbol)
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 ("LaTeX"
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 (("latex" "Command Index"))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (("\\\\\\(begin\\|end\\){\\([^}\n]+\\)}" 2 0)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 ("\\\\[A-Za-z]+")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 ("\\\\[^A-Za-z]")
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
181 ("[A-Za-z]+"))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
182 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
183 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
184 (("\\\\begin{\\([A-Za-z]*\\)" 1 "}" (("^[A-Za-z]+$")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
185 ("\\\\end{\\([A-Za-z]*\\)" 1 "}" (("^[A-Za-z]+$")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
186 ("\\\\renewcommand{\\(\\\\?[A-Za-z]*\\)" 1 "}" (("^\\\\[A-Za-z]+")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
187 ("\\\\renewcommand\\(\\\\?[A-Za-z]*\\)" 1 "" (("^\\\\[A-Za-z]+")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
188 ("\\\\renewenvironment{?\\([A-Za-z]*\\)" 1 "}"(("^[A-Za-z]+$")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
189 ("\\\\[A-Za-z]*" 0 "" (("^\\\\[A-Za-z]+")))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
190
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
191 ("latex" . "LaTeX")
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 ("Nroff"
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 (("groff" "Macro Index" "Register Index" "Request Index"))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
195 (("\\.[^A-Za-z]")
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
196 ("\\.[A-Za-z]+")
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
197 ("\\.\\([A-Za-z]+\\)" 1))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
198 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
199 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
200 (("\\.[A-Za-z]*" nil nil (("^\\.[A-Za-z]+$")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
201 ("\\.\\([A-Za-z]*\\)" 1 nil (("^[A-Za-z]+$")))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
202
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 ("Groff" . "Nroff")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
205 ("m4"
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
206 (("m4" "Macro index"))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
207 (("\\([mM]4_\\)?\\([A-Za-z_][A-Za-z_0-9]*\\)" 2))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
208 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
209 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
210 (("[mM]4_\\([A-Za-z_]?[A-Za-z_0-9]*\\)" 1)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
211 ("[A-Za-z_][A-Za-z_0-9]*")))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 ("Makefile"
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
214 (("make" "Name Index"))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
215 (("\\.[A-Za-z]+") ;; .SUFFIXES
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
216 ("\\$[^()]") ;; $@
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
217 ("\\$([^A-Za-z].)") ;; $(<@)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
218 ("\\$[\(\{]\\([a-zA-Z+]\\)" 1) ;; $(wildcard)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
219 ("[A-Za-z]+")) ;; foreach
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
220 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
221 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
222 (("\\.[A-Za-z]*" nil ":" (("^\\.[A-Za-z]+$")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
223 ("\\$(\\([A-Z]*\\)" 1 ")" (("^[A-Z]")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
224 ("[a-z]+" nil nil (("^[a-z]+$")))))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 ("Perl"
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
227 (("perl" "Variable Index" "Function Index"))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
228 (("\\$[^A-Za-z^]") ;; $@
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
229 ("\\$\\^[A-Za-z]?") ;; $^D
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
230 ("\\$[A-Za-z][A-Za-z_0-9]+") ;; $foobar
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
231 ("[A-Za-z_][A-Za-z_0-9]+")) ;; dbmopen
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 nil
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
233 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
234 (("\\$[A-Za-z]*" nil nil (("^\\$[A-Za-z]+$"))) ;; $variable
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
235 ("[A-Za-z_][A-Za-z_0-9]*" nil nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
236 (("^[A-Za-z_][A-Za-z_0-9]*$"))))) ;; function
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 ("Simula" (("simula" "Index")) nil t)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 ("Ifi Simula" . "Simula")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 ("SIMULA" . "Simula")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ("Texinfo"
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 (("texinfo" "Command and Variable Index"))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
244 (("@\\([A-Za-z]+\\)" 1))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
245 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
246 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
247 (("@\\([A-Za-z]*\\)" 1)))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 )
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 "Assoc list between `mode-name' and Texinfo files.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 The variable should be initialized with a list of elements with the
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 following form:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 \(mode-name (word-help-info-files) (word-help-keyword-regexps)
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
255 word-help-ignore-case word-help-index-mapper
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
256 word-help-complete-list)
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 where `word-help-info-files', `word-help-keyword-regexps' and so
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 forth of course are the values which should be put in these variables
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 for this mode. Note that `mode-name' doesn't have to be a legal
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 mode-name; the user may use the call `set-help-file', where
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 `mode-name' will be used in the `completing-read'.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 Example entry (for C):
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 \(\"C\" ((\"libc\" \"Type Index\" \"Function Index\" \"Variable Index\"))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 ((\"[A-Za-z_][A-Za-z0-9]+\")))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 The two first variables must be initialized; the two remaining will
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 get default values if you omit them or set them to nil. The default
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 values are:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 word-help-keyword-regexps: (\"[A-Za-z_][A-Za-z0-9]+\")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 word-help-ignore-case: nil
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 More settings may be defined in the future.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 You may also define aliases, if there are several relevant mode-names
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 to a single entry. These should be of the form:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 \(MODE-NAME-ALIAS . MODE-NAME-REAL)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 For C++, you would use the alias
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 \(\"C++\" . \"C\")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 to make C++ mode use the same help files as C files do. Please note
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 that you can shoot yourself in the foot with this possibility, by
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 defining recursive aliases.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 ;;; --- end of advanced user options
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293 (defvar word-help-ignore-case nil
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 "Non-nil means that case is ignored when doing lookup.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 (make-variable-buffer-local 'word-help-ignore-case)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
296
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (defvar word-help-info-files nil
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
298 "List of info files with respective nodes, for the current mode.
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 This should be a list of the following form:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 \((INFO-FILE-1 NODE-NAME-1 NODE-NAME-2 ...)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 (INFO-FILE-1 NODE-NAME-1 NODE-NAME-2 ...)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 : : :
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 (INFO-FILE-1 NODE-NAME-1 NODE-NAME-2 ...))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 An example entry for e.g. C would be:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 \((\"/local/share/gnu/info/libc\" \"Function Index\" \"Type Index\"
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 \"Variable Index\"))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 The files and nodes will be searched/cached in the order specified.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 This variable is usually set by the `word-help-switch-help-file'
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 function, which utilizes the `word-help-mode-alist'.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 (make-variable-buffer-local 'word-help-info-files)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (defvar word-help-keyword-regexps nil
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 "Regexps for finding keywords in the current mode.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 This is constructed as a list of the following form:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 \((REGEXP SUBMATCH-LOOKUP SUBMATCH-CURSOR)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 (REGEXP SUBMATCH-LOOKUP SUBMATCH-CURSOR)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 : : :
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (REGEXP SUBMATCH-LOOKUP SUBMATCH-CURSOR))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 The regexps will be searched in order for a match which the cursor is
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 within.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 submatch-lookup is the submatch number which will be looked for in the
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 index. May be omitted; defaults to 0 (e.g. the entire pattern). This is
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 useful in for instance configure lookup; each command is there prefixed
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 with 'AC_', which must be ignored when doing a lookup. Example regexp
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 entry for this:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 \(\"AC_\\\\([A-Za-z0-9]+\\\\)\" 1)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 submatch-cursor is the part of the match which the cursor must be within.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 May be omitted; defaults to 0 (e.g. the entire pattern).")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (make-variable-buffer-local 'word-help-keyword-regexps)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 (set-default 'word-help-keyword-regexps '(("[A-Za-z_][A-Za-z_0-9]*")))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (defvar word-help-index-mapper nil
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 "Regexps to use for massaging index-entries into keywords.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 This variable should contain a list of regexps with sub-expressions,
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 where we will only look for the sub-expression in the user text.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 The regexp list should be formatted as:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 ((REGEXP SUBEXP) (REGEXP SUBEXP) ... )
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 If the index entry does not match any of the regexps, it will be ignored.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
353
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 Example:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 Perl has index entries of the following form:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 * abs VALUE: perlfunc.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 * accept NEWSOCKET,GENERICSOCKET: perlfunc.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 * alarm SECONDS: perlfunc.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 * atan2 Y,X: perlfunc.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 * bind SOCKET,NAME: perlfunc.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363 : : :
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 We will thus try to extract the first word in the index entry -
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 \"abs\" from \"abs VALUE\", etc. This is done by the following entry:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
368 \((\"^\\\\([^ \\t\\n]+\\\\)\" 1))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
369
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
370 This value is btw. the default one, and works with most Texinfo files")
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 (make-variable-buffer-local 'word-help-index-mapper)
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
372 (set-default 'word-help-index-mapper '(("^\\([^ \t\n]+\\)" 1)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
373
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
374
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
375 (defvar word-help-complete-list nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
376 "Regexps or function to use for completion of symbols.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
377 The list should have the following format:
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
378
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
379 ((REGEXP SUBMATCH TEXT-APPEND (RE-FILTER-1 REG-FILTER-2 ...)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
380 : : : : :
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
381 (REGEXP SUBMATCH TEXT-APPEND (RE-FILTER-1 REG-FILTER-2 ...))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
382
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
383 The two first entries are similar to `word-help-keyword-regexps',
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
384 REGEXP is a regular expression which should match any relevant
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
385 expression, and where SUBMATCH should be used for look up. By
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
386 specifying non-nil REGEXP-FILTERs, we'll only include entries in the
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
387 index which matches the regexp specified.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
388
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
389 If the contents of this variable is a symbol of a function, this
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
390 function will be called instead. This is useful for modes providing
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
391 a more intelligent function (like `lisp-complete-symbol' in Emacs Lisp mode).
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
392
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
393 If you would like to use another function instead, you may.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
394
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
395 Non-nil TEXT-APPEND means that this text will be inserted after the
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
396 completion, if we manage to do make a completion.")
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
397 (make-variable-buffer-local 'word-help-complete-list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
398 (set-default 'word-help-complete-list '(("[A-Za-z_][A-Za-z_0-9]*")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
399
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
400 ;;; Work variables
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
401
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 (defvar word-help-main-index nil
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
404 "List of all index entries.
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 See `word-help-process-indexes' for structure formatting.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 Minor note: This variable is a list if it is initialized, t if
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 initializing failed and nil if uninitialized.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (make-variable-buffer-local 'word-help-main-index)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
412 (defvar word-help-complete-index nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
413 "List of regexps for completion, with matching index entries.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
414 Value is nil if uninitialized, t if initialized but not accessible,
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
415 a list if we're feeling ok.")
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
416 (make-variable-buffer-local 'word-help-complete-index)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
417
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
418 (defvar word-help-main-obarray nil
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
419 "Global work variable for `word-help' system.
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420 Do Not mess with this!")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (defvar word-help-history nil
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 "History for `word-help' minibuffer queries.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (make-local-variable 'word-help-history)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 (defvar word-help-current-help-file nil
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427 "Current help file active for this mode.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 (defvar word-help-index-alist nil
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 "An assoc list mapping help files to info indexes.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 This means that `word-help-mode-index' can be init'ed faster.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (defvar word-help-help-mode nil
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 "Which mode the help system is bound to for the current mode.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 (make-variable-buffer-local 'word-help-help-mode)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
437 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
438 ;;;;;;;;;;;;;;;;;;;;;;;;;;; User Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
439 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 ;;; Debugging
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 ;;;###autoload
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 (defun reset-word-help ()
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 "Clear all cached indexes in the `word-help' system.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 You should only need this when installing new info files, and/or
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 adding more Texinfo files to the `word-help' system."
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448 (interactive)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 (setq word-help-index-alist nil
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
450 word-help-main-index nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
451 word-help-info-files nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
452 word-help-complete-index nil))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 ;;; Changing help file
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 ;;;###autoload
17906
a8d2103ea2b4 (set-word-help-file): Renamed from set-help-file.
Richard M. Stallman <rms@gnu.org>
parents: 16813
diff changeset
458 (defun set-word-help-file ()
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
459 "Change which set of Texinfo files used for word-help.
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 `word-help' maintains a list over which Texinfo files which are
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 relevant for each programming language (`word-help-mode-alist'). It
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 usually selects the correct one, based upon the value of `mode-name'.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 If this guess is incorrect, you may also use this function manually to
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 instruct future `word-help' calls which Texinfo files to use."
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 (interactive)
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
467 (let (helpfile helpguess (completion-ignore-case t))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
468 ;; Try to make a guess
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 (setq helpguess (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 (word-help-current-help-file)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 ((word-help-guess-help-file))))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
472 ;; Ask the user
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
473 (setq helpfile (completing-read
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (if helpguess
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (format "Select help mode (default %s): " helpguess)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 "Select help mode: ")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 word-help-mode-alist
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 nil t nil nil))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 (if (equal "" helpfile)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 (setq helpfile helpguess))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 (if helpfile
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
482 (word-help-switch-help-file helpfile))))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 ;;; Main user interface
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 ;;;###autoload
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 (defun word-help ()
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 "Find documentation on the keyword under the cursor.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 The determination of which language the keyword belongs to, is based upon
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 The relevant info file is selected by matching `mode-name' (the major
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 mode) against the assoc list `word-help-mode-alist'.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 If this is not possible, `set-help-file' will be invoked for selecting
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 the relevant info file. `set-help-file' may also be invoked
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 interactively by the user.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 If the keyword you are looking at is not available in any index, no
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 default suggestion will be presented. "
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 (interactive)
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
500 (let (myguess guess index-info
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
501 (completion-ignore-case word-help-ignore-case))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 ;; Set necessary variables for later lookup
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
503 (word-help-find-help-file)
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 ;; Have we previously cached datas?
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 (word-help-process-indexes)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 (if
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 (atom word-help-main-index)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (message "No help file available for this mode.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 ;; First make a guess at what the user is looking for
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (setq myguess (word-help-guess
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 (point)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 ((not (atom word-help-main-index))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 (car word-help-main-index)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 word-help-keyword-regexps))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 ;; Ask the user himself
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 (setq guess (completing-read
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 ; Format string
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 (if myguess
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 (format "Look up keyword (default %s): " myguess)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 "Look up keyword: ")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 ; Collection
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 (car word-help-main-index)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 nil t nil 'word-help-history))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 (if (equal guess "")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526 (setq guess myguess))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 ;; If we've got anything meaningful to lookup, do so
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 (if (not guess)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 (message "Help aborted.")
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530 (setq index-info (word-help-find-index-node
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 guess
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 word-help-main-index))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 (if (not index-info)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 (message "Oops, I could not find \"%s\" anyway! Bug?" guess)
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
535 (word-help-goto-index-node (nconc index-info (list guess))))))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
536
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
537 ;;;###autoload
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
538 (defun word-help-complete ()
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
539 "Perform completion on the symbol preceding the point.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
540 The determination of which language the keyword belongs to, is based upon
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
541 The relevant info file is selected by matching `mode-name' (the major
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
542 mode) against the assoc list `word-help-mode-alist'.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
543
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
544 If this is not possible, `set-help-file' will be invoked for selecting
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
545 the relevant info file. `set-help-file' may also be invoked
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
546 interactively by the user.
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
548 The keywords are extracted from the index of the info file defined for
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
549 this mode, by using the `word-help-complete-list' variable."
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
550 (interactive)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
551 (word-help-make-complete)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
552 (cond
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
553 ((not word-help-complete-index)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
554 (message "No completion available for this mode."))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
555 ((symbolp word-help-complete-index)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
556 (call-interactively word-help-complete-index))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
557 ((listp word-help-complete-index)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
558 (let ((all-match (word-help-guess-all (point)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
559 word-help-complete-index t))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
560 (completion-ignore-case word-help-ignore-case)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
561 (c-list word-help-complete-index)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
562 c-entry word-match completion completed)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
563 ;; Loop over and try to find a match
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
564 (while (and all-match (not completed))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
565 (setq word-match (car all-match)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
566 c-entry (car c-list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
567 c-list (cdr c-list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
568 all-match (cdr all-match))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
569 ;; Check whether the current pattern matched
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
570 (if word-match
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
571 (let ((close (nth 3 c-entry))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
572 (words (nth 4 c-entry)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
573 ;; Find the maximum completion for this word
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
574 ; (print word-match)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
575 ; (print c-entry)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
576 ; (print close)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
577 (setq completion (try-completion word-match words))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
578 ;; Was the match exact
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
579 (cond ((eq completion t)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
580 (and close
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
581 (not (looking-at (regexp-quote close)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
582 (insert close))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
583 (setq completed t))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
584 ;; Silently ignore non-matches
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
585 ((not completion))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
586 ;; May we complete more unambiguously
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
587 ((not (string-equal completion word-match))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
588 (delete-region (- (point) (length word-match))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
589 (point))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
590 (insert completion)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
591 (if (eq t (try-completion completion words))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
592 (progn
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
593 (and close
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
594 (not (looking-at (regexp-quote close)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
595 (insert close))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
596 (setq completed t))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
597 (t
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
598 (message "Making completion list...")
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
599 (let ((list (all-completions word-match words nil)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
600 (setq completed list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
601 (with-output-to-temp-buffer "*Completions*"
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
602 (display-completion-list list)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
603 (message "Making completion list...done"))))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
604 (if (not completed) (message "No match."))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
605 (t (message "No completion available for this mode."))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
606
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
607 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
608 ;;;;;;;;;;;;;;;;;;;;;;;;;;; Index mapping ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
609 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
610
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 (defun word-help-map-index-entries (str re-list)
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
613 "Transform an Info index entry into a programming keyword.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
614 Uses this by mapping the entries through `word-help-index-mapper'."
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 (let ((regexp (car (car re-list)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 (subexp (car (cdr (car re-list))))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 (next (cdr re-list)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
618 (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
619 ((string-match regexp str)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
620 (substring str (match-beginning subexp) (match-end subexp)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
621 (next
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
622 (word-help-map-index-entries str next)))))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
623
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
624 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
625 ;;;;;;;;;;;;;;;;;;;;;;;;; Switch mode files ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
626 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628 ;;; Mode lookup
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 (defun word-help-guess-help-file ()
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 "Guesses a relevant help file based on mode name.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 Returns nil if no guess could be made. Uses `word-help-mode-alist'."
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 (let (guess)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 ((setq guess (assoc mode-name word-help-mode-alist))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (car guess)))))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 (defun word-help-switch-help-file (helpfile)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 "Changes the help-file to the mode name given.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 Uses `word-help-mode-alist'."
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 (if helpfile
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 (let (helpdesc)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 (if (not (setq helpdesc (assoc helpfile word-help-mode-alist)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 (message "No help defined for \"%s\"." helpfile)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 (if (stringp (cdr helpdesc))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 (word-help-switch-help-file (cdr helpdesc))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648 (word-help-make-default-map
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 helpdesc
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 (list 'word-help-help-mode
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 'word-help-info-files
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 'word-help-keyword-regexps
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 'word-help-ignore-case
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
654 'word-help-index-mapper
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
655 'word-help-complete-list))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
656 (setq word-help-main-index nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
657 word-help-complete-index nil))))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
659 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
660 ;;;;;;;;;;;;;;;;;;;;;;;;;; Index collection ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
661 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 (defun word-help-extract-index (file-name index-list index-map ignore-case)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 "Extract index from filename and the first node name in index list.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 `file-name' is the name of the info file, while `index-list' is a list
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 of node-names to search."
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
668 (let (cmd1 cmdlow nodename ob-array next (case-fold-search word-help-ignore-case))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 (setq nodename (car index-list))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 (setq ob-array (make-vector 211 0))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 (message "Processing \"%s\" in %s..." nodename file-name)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (save-window-excursion
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 (Info-goto-node (concat "(" file-name ")" nodename))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 (end-of-buffer)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (while (re-search-backward "\\* \\([^\n:]+\\):" nil t)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 (setq cmd1 (buffer-substring (match-beginning 1) (match-end 1)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 (setq cmdlow (if ignore-case (downcase cmd1) cmd1))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 (if index-map
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 (setq cmdlow (word-help-map-index-entries cmdlow
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 index-map)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 ;; We have to do this workaround to support case-insensitive matching
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 (cmdlow
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 (put (intern cmdlow ob-array) 'word-help-real-name cmd1)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 (intern cmdlow word-help-main-obarray)))))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 (setq next (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 ((cdr index-list)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 (word-help-extract-index file-name (cdr index-list)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 index-map ignore-case))))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 (nconc (list (list nodename ob-array)) next)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 (defun word-help-collect-indexes (info-file)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 "Process all the indexes in an info file.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696 Uses `word-help-extract-index' on each node, and returns an entry
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 suitable for merging into `word-help-process-indexes'. `info-file'
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 is an entry of the form
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 \(FILE-NAME INDEX-NAME-1 INDEX-NAME-2 ...)"
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 (let ((file (car info-file))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 (nodes (cdr info-file)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 (nconc (list file) (word-help-extract-index file nodes
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 word-help-index-mapper
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
705 word-help-ignore-case))))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 (defun word-help-process-indexes ()
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 "Process all the entries in the global variable `word-help-info-files'.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 Returns a list formatted as follows:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 \(all-entries-ob
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 (file-name-1 (node-name-1 this-node-entries-ob)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 (node-name-2 this-node-entries-ob)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 : : :
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 (node-name-n this-node-entries-ob))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 (file-name-2 (node-name-1 this-node-entries-ob)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 (node-name-2 this-node-entries-ob)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 : : :
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 (node-name-n this-node-entries-ob))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 : : : : : : : : :
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 (file-name-n (node-name-1 this-node-entries-ob)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 (node-name-2 this-node-entries-ob)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 : : :
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (node-name-n this-node-entries-ob)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 The symbols in the obarrays may contain the additional property
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 `word-help-real-name', which tells the *real* node to go to.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 Note that we use `word-help-index-alist' to speed up the process. Note
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 that `word-help-switch-help-file' must have been called before this function.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 This structure is then later searched by `word-help-find-index-node'."
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733 (let (index-words old-index)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734 (if (not word-help-main-index)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 ((setq old-index
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 (assoc word-help-help-mode word-help-index-alist))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 (setq word-help-main-index (nth 1 old-index)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 (word-help-info-files
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740 (setq word-help-main-obarray (make-vector 307 0)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 index-words (mapcar 'word-help-collect-indexes
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742 word-help-info-files)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 word-help-main-index
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 (append (list word-help-main-obarray) index-words))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745 (setq word-help-index-alist (cons (list word-help-help-mode
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746 word-help-main-index)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 word-help-index-alist)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
748 (t (setq word-help-main-index t))))))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
750 (defun word-help-find-help-file ()
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
751 "Tries to find and set a relevant help file for the current mode."
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
752 (let (helpguess)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
753 (if (not word-help-info-files)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
754 (if (setq helpguess (word-help-guess-help-file))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
755 (word-help-switch-help-file helpguess)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
756 (set-help-file)))))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
758
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
759 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
760 ;;;;;;;;;;;;;;;;;;;;;;;;;;; Keyword guess ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
761 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
762
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
763 (defun word-help-guess-all (cur-point re-list
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
764 &optional copy-to-point)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
765 "Guesses *all* keywords the user possibly may be looking at.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
766 Returns a list of all possible keywords. "
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
767 (let ((regexp (car (car re-list)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
768 (submatch (cond ((nth 1 (car re-list))) (0)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
769 (cursmatch (cond ((nth 2 (car re-list))) (0)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
770 (guess nil)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
771 (next-guess nil)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
772 (case-fold-search word-help-ignore-case)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
773 (end-point nil))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
774 (save-excursion
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
775 (end-of-line)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
776 (setq end-point (point))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
777 ;; Start at the beginning
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
778 (beginning-of-line)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
779 (while (and (not guess) (re-search-forward regexp end-point t))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
780 ;; Look whether the cursor is within the match
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
781 (if (and (<= (match-beginning cursmatch) cur-point)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
782 (>= (match-end cursmatch) cur-point))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
783 (if (or (not copy-to-point) (<= cur-point (match-end submatch)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
784 (setq guess (buffer-substring (match-beginning submatch)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
785 (if copy-to-point
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
786 cur-point
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
787 (match-end submatch)))))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
788 ;; If we found anything, return it and call ourselves again
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
789 (if (cdr re-list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
790 (setq next-guess (word-help-guess-all cur-point (cdr re-list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
791 copy-to-point))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
792 (cons guess next-guess)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
793
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
794 (defun word-help-guess-match (all-match cmd-array)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
795 (let ((sym (car all-match)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
796 (cond
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
797 ((and sym (intern-soft (if word-help-ignore-case
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
798 (downcase sym)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
799 sym) cmd-array)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
800 sym))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
801 ((cdr all-match)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
802 (word-help-guess-match (cdr all-match) cmd-array)))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
803
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805 (defun word-help-guess (cur-point cmd-array re-list)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806 "Guesses what keyword the user is looking at, and returns that.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
807 CUR-POINT should be the current value of `point', CMD-ARRAY an obarray
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
808 of all the keywords which are defined for the current mode, and
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
809 RE-LIST a list of regexps use for the hunt. See also
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
810 `word-help-keyword-regexps'."
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
811 (let ((all-matches (word-help-guess-all cur-point re-list)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
812 ; (print all-matches)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
813 (word-help-guess-match all-matches cmd-array)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
814
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
815 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
816 ;;;;;;;;;;;;;;;;;;;;;;; Show node for keyword ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
817 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
818
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
819 ;;; Find an index entry
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
820
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
821 (defun word-help-find-index-node (node index-reg)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
822 "Finds the node named `node' in the index-register `index-reg'.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
823 `index-reg' has the format as returned (and documented) by the
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
824 `word-help-process-indexes' call. In most cases, this will be equal to
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
825 `word-help-main-index'.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
826
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
827 Returns a list with format
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
828 (file-name index-node-name index-entry)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
829 which contains the file and index where the entry can be found.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
830 Returns nil if the entry can't be found."
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
831 (let (file-info node-name)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
832 (setq node-name (cond (word-help-ignore-case (downcase node)) (node)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
833 (if (intern-soft node-name (car index-reg))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
834 (setq file-info (word-help-index-search-file node-name
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
835 (cdr index-reg))))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
836 file-info))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
837
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
838 (defun word-help-index-search-file (entry file-data)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
839 "Searches a cached file for the index-entry `entry'."
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
840 (let (this-file next-files file-name node node-infos)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
841 (setq this-file (car file-data)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
842 next-files (cdr file-data)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
843 file-name (car this-file)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
844 node-infos (cdr this-file)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
845 node (word-help-index-search-nodes entry node-infos))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
846 (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
847 (node
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
848 (cons file-name node))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
849 (next-files (word-help-index-search-file entry next-files)))))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
850
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
851 (defun word-help-index-search-nodes (entry node-info)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
852 "Searches a cached list of nodes for the entry `entry'."
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
853 (let (this-node next-nodes node-name node-ob node-sym)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
854 (setq this-node (car node-info)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
855 next-nodes (cdr node-info)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
856 node-name (car this-node)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
857 node-ob (car (cdr this-node))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
858 node-sym (intern-soft entry node-ob))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
859 (cond
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
860 (node-sym
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
861 (list node-name (get node-sym 'word-help-real-name)))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
862 (next-nodes (word-help-index-search-nodes entry next-nodes)))))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
863
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
864 ;;; Switch to a node in an index
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
865
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
866 (defun word-help-goto-index-node (index-info)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
867 "Jumps to an index node.
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
868 `index-info' should be a list with the following format:
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
869
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
870 \(FILE-NAME INDEX-NODE-NAME INDEX-ENTRY KEYWORD)"
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
871
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
872 (let* ((file-name (car index-info))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
873 (node-name (nth 1 index-info))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
874 (entry-name (nth 2 index-info))
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
875 (kw-name (nth 3 index-info))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
876 (buffer (current-buffer)))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
877 (if word-help-split-window
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
878 (pop-to-buffer nil))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
879 (Info-goto-node (concat "(" file-name ")" node-name))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
880 (Info-menu entry-name)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
881 ;; Do magic keyword search
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
882 (if word-help-magic-index
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
883 (let (end-point regs this-re found entry-re)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
884 (setq entry-re (regexp-quote kw-name)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
885 regs (list (concat
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
886 (if (string-match "^[A-Za-z]" entry-name)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
887 "\\<" "")
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
888 entry-re
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
889 (if (string-match "[A-Za-z]$" entry-name)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
890 "\\>" ""))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
891 (concat "[`\"\(]" entry-re)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
892 (concat "^" entry-re
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
893 (if (string-match "[A-Za-z]$" entry-name)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
894 "\\>" ""))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
895 (end-of-line)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
896 (setq end-point (point))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
897 (beginning-of-line)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
898 (if (not (re-search-forward (car regs) end-point t))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
899 (while (and (not found) (car regs))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
900 (setq this-re (car regs)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
901 regs (cdr regs)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
902 found (re-search-forward this-re nil t))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
903 (recenter 0)))
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
904 (if word-help-split-window
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
905 (pop-to-buffer buffer))))
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
906
16813
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
907
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
908 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
909 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Completion ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
910 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
911
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
912
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
913
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
914 (defun word-help-extract-matches (from-ob dest-ob re-list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
915 "Takes atoms from from-ob, and puts them in dest-ob if they match re-list."
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
916 (let ((regexp (car (car re-list))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
917 (mapatoms (lambda (x)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
918 (if (or (not regexp) (string-match regexp (symbol-name x)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
919 (intern (symbol-name x) dest-ob)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
920 from-ob)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
921 (if (cdr re-list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
922 (word-help-extract-matches from-ob dest-ob (cdr re-list))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
923 dest-ob)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
924
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
925 (defun word-help-make-complete ()
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
926 "Generates the `word-help-complete-index'."
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
927 (if word-help-complete-index
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
928 nil
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
929 (word-help-find-help-file)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
930 (cond
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
931 ((symbolp word-help-complete-list)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
932 (setq word-help-complete-index word-help-complete-list))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
933 (t
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
934 (word-help-process-indexes)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
935 (if (not (atom word-help-main-index))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
936 (let ((from-ob (car word-help-main-index)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
937 (message "Processing keywords...")
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
938 (setq word-help-complete-index
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
939 (mapcar
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
940 (lambda (cmpl)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
941 (let
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
942 ((regexp (car cmpl))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
943 (subm (cond ((nth 1 cmpl)) (0)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
944 (app (cond ((nth 2 cmpl)) ("")))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
945 (re-list (cond ((nth 3 cmpl)) ('((".")))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
946 (obarr (make-vector 47 0)))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
947 (list regexp subm subm app
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
948 (word-help-extract-matches from-ob obarr
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
949 re-list))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
950 word-help-complete-list))))))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
951
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
952 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
953 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Misc. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
954 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
955
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
956
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
957 ;;; Default mapping
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
958
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
959 (defun word-help-make-default-map (list vars)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
960 "Makes a default mapping for `vars', which must be listed in order.
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
961 vars is a list of quoted symbols. If the nth entry in the list is
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
962 non-nil, the nth variable will be given this value. If nil, the var
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
963 will be given the global default value."
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
964 (set (car vars) (cond ((car list)) ((default-value (car vars)))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
965 (if (cdr vars)
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
966 (word-help-make-default-map (cdr list) (cdr vars))))
56bf42e4fb29 (word-help-mode-alist, reset-word-help)
Richard M. Stallman <rms@gnu.org>
parents: 16811
diff changeset
967
16811
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
968 (provide 'word-help)
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
969
df5765f5f6fd Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
970 ;;; word-help.el ends here