Small docstring update
[sxemacs] / lisp / info.el
1 ;;; info.el --- info package for SXEmacs.
2 ;; Keywords: help
3
4 ;; Copyright (C) 1985, 1986, 1993, 1997 Free Software Foundation, Inc.
5 ;; Copyright (C) 2005 Steve Youngs.
6
7 ;; Author: Dave Gillespie <daveg@synaptics.com>
8 ;;         Richard Stallman <rms@gnu.ai.mit.edu>
9 ;; Maintainer: Dave Gillespie <daveg@synaptics.com>
10 ;; Version: 1.07 of 7/22/93
11 ;; Keywords: docs, help
12
13 ;; This file is part of SXEmacs.
14
15 ;; SXEmacs is free software: you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation, either version 3 of the License, or
18 ;; (at your option) any later version.
19
20 ;; SXEmacs is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 ;; GNU General Public License for more details.
24
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
27
28 ;;; Synched up with: Not synched with FSF.
29
30 ;; Commentary:
31
32 ;; This is based on an early Emacs 19 info.el file.
33 ;;
34 ;; Note that Info-directory has been replaced by Info-directory-list,
35 ;; a search path of directories in which to find Info files.
36 ;; Also, Info tries adding ".info" to a file name if the name itself
37 ;; is not found.
38 ;;
39 ;; See the change log below for further details.
40
41
42 ;; LCD Archive Entry:
43 ;; info-dg|Dave Gillespie|daveg@synaptics.com
44 ;; |Info reader with many enhancements; replaces standard info.el.
45 ;; |93-07-22|1.07|~/modes/info.el
46
47 ;; Also available from anonymous FTP on csvax.cs.caltech.edu.
48
49
50 ;; Change Log:
51
52 ;; Modified 3/7/1991 by Dave Gillespie:
53 ;; (Author's address: daveg@synaptics.com or daveg@csvax.cs.caltech.edu)
54 ;;
55 ;; Added keys:  i, t, <, >, [, ], {, }, 6, 7, 8, 9, 0.
56 ;; Look at help for info-mode (type ? in Info) for descriptions.
57 ;;
58 ;; If Info-directory-list is undefined and there is no INFOPATH
59 ;; in the environment, use value of Info-directory for compatibility
60 ;; with Emacs 18.57.
61 ;;
62 ;; All files named "localdir" found in the path are appended to "dir",
63 ;; the Info directory.  For this to work, "dir" should contain only
64 ;; one node (Top), and each "localdir" should contain no ^_ or ^L
65 ;; characters.  Generally they will contain only one or several
66 ;; additional lines for the top-level menu.  Note that "dir" is
67 ;; modified in memory each time it is loaded, but not on disk.
68 ;;
69 ;; If "dir" contains a line of the form:  "* Locals:"
70 ;; then the "localdir"s are inserted there instead of at the end.
71
72
73 ;; Modified 4/3/1991 by Dave Gillespie:
74 ;;
75 ;; Added Info-mode-hook (suggested by Sebastian Kremer).
76 ;; Also added epoch-info-startup/select-hooks from Simon Spero's info.el.
77 ;;
78 ;; Added automatic decoding of compressed Info files.
79 ;; See documentation for the variable Info-suffix-list.  Default is to
80 ;; run "uncompress" on ".Z" files and "unyabba" on ".Y" files.
81 ;; (See comp.sources.unix v24i073-076 for yabba/unyabba, a free software
82 ;; alternative to compress/uncompress.)
83 ;; Note: "dir" and "localdir" files should not be compressed.
84 ;;
85 ;; Changed variables like Info-enable-edit to be settable by M-x set-variable.
86 ;;
87 ;; Added Info-auto-advance variable.  If t, SPC and DEL will act like
88 ;; } and {, i.e., they advance to the next/previous node if at the end
89 ;; of the buffer.
90 ;;
91 ;; Changed `u' to restore point to most recent location in that node.
92 ;; Added `=' to do this manually at any time.  (Suggested by David Fox).
93 ;;
94 ;; Changed `m' and `0-9' to try interpreting menu name as a file name
95 ;; if not found as a node name.  This allows (dir) menus of the form,
96 ;;     Emacs::          Cool text editor
97 ;; as a shorthand for
98 ;;     Emacs:(emacs).   Cool text editor
99 ;;
100 ;; Enhanced `i' to use line-number information in the index.
101 ;; Added `,' to move among all matches to a previous `i' command.
102 ;;
103 ;; Added `a' (Info-annotate) for adding personal notes to any Info node.
104 ;; Notes are not stored in the actual Info files, but in the user's own
105 ;; ~/.infonotes file.
106 ;;
107 ;; Added Info-footnote-tag, made default be "Ref" instead of "Note".
108 ;;
109 ;; Got mouse-click stuff to work under Emacs version 18.  Check it out!
110 ;; Left and right clicks scroll the Info window.
111 ;; Middle click goes to clicked-on node, e.g., "Next:", a menu, or a note.
112
113
114 ;; Modified 6/29/1991 by Dave Gillespie:
115 ;;
116 ;; Renamed epoch-info-startup/select-hooks to Info-startup/select-hook.
117 ;;
118 ;; Made Info-select-node into a command on the `!' key.
119 ;;
120 ;; Added Info-mouse-support user option.
121 ;;
122 ;; Cleaned up the implementation of some routines.
123 ;;
124 ;; Added special treatment of quoted words in annotations:  The `g'
125 ;; command for a nonexistent node name scans for an annotation
126 ;; (in any node of any file) containing that name in quotes:  g foo RET
127 ;; looks for an annotation containing:  "foo"  or:  <<foo>>
128 ;; If found, it goes to that file and node.
129 ;;
130 ;; Added a call to set up Info-directory-list in Info-find-node to
131 ;; work around a bug in GNUS where it calls Info-goto-node before info.
132 ;;
133 ;; Added completion for `g' command (inspired by Richard Kim's infox.el).
134 ;; Completion knows all node names for the current file, and all annotation
135 ;; tags (see above).  It does not complete file names or node names in
136 ;; other files.
137 ;;
138 ;; Added `k' (Info-emacs-key) and `*' (Info-elisp-ref) commands.  You may
139 ;; wish to bind these to global keys outside of Info mode.
140 ;;
141 ;; Allowed localdir files to be full dir-like files; only the menu part
142 ;; of each localdir is copied.  Also, redundant menu items are omitted.
143 ;;
144 ;; Changed Info-history to hold only one entry at a time for each node,
145 ;; and to be circular so that multiple `l's come back again to the most
146 ;; recent node.  Note that the format of Info-history entries has changed,
147 ;; which may interfere with external programs that try to operate on it.
148 ;; (Also inspired by Kim's infox.el).
149 ;;
150 ;; Changed `n', `]', `l', etc. to accept prefix arguments to move several
151 ;; steps at once.  Most accept negative arguments to move oppositely.
152 ;;
153 ;; Changed `?' to bury *Help* buffer afterwards to keep it out of the way.
154 ;;
155 ;; Rearranged `?' key's display to be a little better for new users.
156 ;;
157 ;; Changed `a' to save whole window configuration and restore on C-c C-c.
158 ;;
159 ;; Fixed the bug reported by Bill Reynolds on gnu.emacs.bugs.
160 ;;
161 ;; Changed Info-last to restore window-start as well as cursor position.
162 ;;
163 ;; Changed middle mouse button in space after end of node to do Info-last
164 ;; if we got here by following a cross reference, else do Info-global-next.
165 ;;
166 ;; Added some new mouse bindings: shift-left = Info-global-next,
167 ;; shift-right = Info-global-prev, shift-middle = Info-last.
168 ;;
169 ;; Fixed Info-follow-reference not to make assumptions about length
170 ;; of Info-footnote-tag [Linus Tolke].
171 ;;
172 ;; Changed default for Info-auto-advance mode to be press-twice-for-next-node.
173 ;;
174 ;; Modified x-mouse-ignore to preserve last-command variable, so that
175 ;; press-twice Info-auto-advance mode works with the mouse.
176
177
178 ;; Modified 3/4/1992 by Dave Gillespie:
179 ;;
180 ;; Added an "autoload" command to help autoload.el.
181 ;;
182 ;; Changed `*' command to look for file `elisp' as well as for `lispref'.
183 ;;
184 ;; Fixed a bug involving footnote names containing regexp special characters.
185 ;;
186 ;; Fixed a bug in completion during `f' (or `r') command.
187 ;;
188 ;; Added TAB (Info-next-reference), M-TAB, and RET keys to Info mode.
189 ;;
190 ;; Added new bindings, `C-h C-k' for Info-emacs-key and `C-h C-f' for
191 ;; Info-elisp-ref.  These bindings are made when info.el is loaded, and
192 ;; only if those key sequences were previously unbound.  These bindings
193 ;; work at any time, not just when Info is already running.
194
195
196 ;; Modified 3/8/1992 by Dave Gillespie:
197 ;;
198 ;; Fixed some long lines that were causing trouble with mailers.
199
200
201 ;; Modified 3/9/1992 by Dave Gillespie:
202 ;;
203 ;; Added `C-h C-i' (Info-query).
204 ;;
205 ;; Added Info-novice mode, warns if the user attempts to switch to
206 ;; a different Info file.
207 ;;
208 ;; Fixed a bug that caused problems using compressed Info files
209 ;; and Info-directory-list at the same time.
210 ;;
211 ;; Disabled Info-mouse-support by default if Epoch or Hyperbole is in use.
212 ;;
213 ;; Added an expand-file-name call to Info-find-node to fix a small bug.
214
215
216 ;; Modified 5/22/1992 by Dave Gillespie:
217 ;;
218 ;; Added "standalone" operation:  "emacs -f info" runs Emacs specifically
219 ;; for use as an Info browser.  In this mode, the `q' key quits Emacs
220 ;; itself.  Also, "emacs -f info arg" starts in Info file "arg" instead
221 ;; of "dir".
222 ;;
223 ;; Changed to prefer "foo.info" over "foo".  If both exist, "foo" is
224 ;; probably a directory or executable program!
225 ;;
226 ;; Made control-mouse act like regular-mouse does in other buffers.
227 ;; (In most systems, this will be set-cursor for left-mouse, x-cut
228 ;; for right-mouse, and x-paste, which will be an error, for
229 ;; middle-mouse.)
230 ;;
231 ;; Improved prompting and searching for `,' key.
232 ;;
233 ;; Fixed a bug where some "* Menu:" lines disappeared when "dir"
234 ;; contained several nodes.
235
236
237 ;; Modified 9/10/1992 by Dave Gillespie:
238 ;;
239 ;; Mixed in support for XEmacs.  Mouse works the same as in
240 ;; the other Emacs versions by default; added Info-lucid-mouse-style
241 ;; variable, which enables mouse operation similar to XEmacs's default.
242 ;;
243 ;; Fixed a bug where RET couldn't understand "* Foo::" if "Foo" was a
244 ;; file name instead of a node name.
245 ;;
246 ;; Added `x' (Info-bookmark), a simple interface to the annotation
247 ;; tags feature.  Added `j' (Info-goto-bookmark), like `g' but only
248 ;; completes bookmarks.
249 ;;
250 ;; Added `<<tag>>' as alternate to `"tag"' in annotations.
251 ;;
252 ;; Added `v' (Info-visit-file), like Info-goto-node but specialized
253 ;; for going to a new Info file (with file name completion).
254 ;;
255 ;; Added recognition of gzip'd ".z" files.
256
257
258 ;; Modified 5/9/1993 by Dave Gillespie:
259 ;;
260 ;; Merged in various things from FSF's latest Emacs 19 info.el.
261
262 ;; Modified 6/2/1993 by Dave Gillespie:
263 ;;
264 ;; Changed to use new suffix ".gz" for gzip files.
265
266
267 ;; Modified 7/22/1993 by Dave Gillespie:
268 ;;
269 ;; Changed Info-footnote-tag to "See" instead of "Ref".
270 ;;
271 ;; Extended Info-fontify-node to work with FSF version of Emacs 19.
272
273 ;; Modified 7/30/1993 by Jamie Zawinski:
274 ;;
275 ;; Commented out the tty and fsf19 mouse support, because why bother.
276 ;; Commented out the politically incorrect version of XEmacs mouse support.
277 ;; Commented out mouse scrolling bindings because the party line on that
278 ;;  is "scrollbars are coming soon."
279 ;; Commented out munging of help-for-help's doc; put it in help.el.
280 ;; Did Info-edit-map the modern XEmacs way.
281 ;; Pruned extra cruft from fontification and mouse handling code.
282 ;; Fixed ASCII-centric bogosity in unreading of events.
283
284 ;; Modified 8/11/95 by Chuck Thompson:
285 ;;
286 ;; Removed any pretense of ever referencing Info-directory since it
287 ;; wasn't working anyhow.
288
289 ;; Modified 4/5/97 by Tomasz J. Cholewo:
290 ;;
291 ;; Modified Info-search to use with-caps-disable-folding
292
293 ;; Modified 6/21/97 by Hrvoje Niksic
294 ;;
295 ;; Fixed up Info-next-reference to work sanely when n < 0.
296 ;; Added S-tab binding.
297
298 ;; Modified 1997-07-10 by Karl M. Hegbloom
299 ;;
300 ;; Added `Info-minibuffer-history'
301 ;; (also added to defaults in "lisp/utils/savehist.el")
302 ;;  Other changes in main ChangeLog.
303
304 ;; Modified 1998-03-29 by Oscar Figueiredo
305 ;;
306 ;; Added automatic dir/localdir (re)building capability for directories that
307 ;; contain none or when it has become older than info files in the same
308 ;; directory.
309
310 ;; Modified 1998-09-23 by Didier Verna <didier@xemacs.org>
311 ;;
312 ;; Use the new macro `with-search-caps-disable-folding'
313
314 ;; Code:
315 (eval-when-compile
316   (condition-case nil (require 'browse-url) (error nil)))
317
318 (defgroup info nil
319   "The info package for Emacs."
320   :group 'help
321   :group 'docs)
322
323 (defgroup info-faces nil
324   "The faces used by info browser."
325   :group 'info
326   :group 'faces)
327
328
329 (defcustom Info-inhibit-toolbar nil
330   "*Non-nil means don't use the specialized Info toolbar."
331   :type 'boolean
332   :group 'info)
333
334 (defcustom Info-novice nil
335   "*Non-nil means to ask for confirmation before switching Info files."
336   :type 'boolean
337   :group 'info)
338
339 (defvar Info-history nil
340   "List of info nodes user has visited.
341 Each element of list is a list (\"(FILENAME)NODENAME\" BUFPOS WINSTART).")
342
343 (defvar Info-keeping-history t
344   "Non-nil if Info-find-node should modify Info-history.
345 This is for use only by certain internal Info routines.")
346
347 (defvar Info-minibuffer-history nil
348   "Minibuffer history for Info.")
349
350 (defcustom Info-enable-edit nil
351   "*Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info
352 can edit the current node.
353 This is convenient if you want to write info files by hand.
354 However, we recommend that you not do this.
355 It is better to write a Texinfo file and generate the Info file from that,
356 because that gives you a printed manual as well."
357   :type 'boolean
358   :group 'info)
359
360 (defcustom Info-enable-active-nodes t
361   "*Non-nil allows Info to execute Lisp code associated with nodes.
362 The Lisp code is executed when the node is selected."
363   :type 'boolean
364   :group 'info)
365
366 (defcustom Info-restoring-point t
367   "*Non-nil means to restore the cursor position when re-entering a node."
368   :type 'boolean
369   :group 'info)
370
371 (defcustom Info-auto-advance 'twice
372   "*Control what SPC and DEL do when they can't scroll any further.
373 If nil, they beep and remain in the current node.
374 If t, they move to the next node (like Info-global-next/prev).
375 If anything else, they must be pressed twice to move to the next node."
376   :type '(choice (const :tag "off" nil)
377                  (const :tag "advance" t)
378                  (const :tag "confirm" twice))
379   :group 'info)
380
381 (defcustom Info-fontify t
382   "*Non-nil enables font features in XEmacs.
383 This variable is ignored unless running under XEmacs."
384   :type 'boolean
385   :group 'info)
386
387 (defcustom Info-additional-search-directory-list nil
388   "*List of additional directories to search for Info documentation
389 files.  These directories are not searched for merging the `dir'
390 file. An example might be something like:
391 \"/usr/local/lib/xemacs/packages/lisp/calc/\""
392   :type '(repeat directory)
393   :group 'info)
394
395 (defcustom Info-auto-generate-directory 'if-outdated
396   "*When to auto generate an info directory listing.
397 Possible values are:
398 nil or `never' never auto-generate a directory listing,
399   use any existing `dir' or `localdir' file and ignore info
400   directories containing none
401 `always' auto-generate a directory listing ignoring existing
402   `dir' and `localdir' files
403 `if-missing', the default, auto-generates a directory listing
404   if no `dir' or `localdir' file is present.  Otherwise the
405   contents of any of these files is used instead.
406 `if-outdated' auto-generates a directory listing if the `dir'
407   and `localdir' are either inexistent or outdated (touched
408   less recently than an info file in the same directory)."
409   :type '(choice (const :tag "never" never)
410                  (const :tag "always" always)
411                  (const :tag "if-missing" if-missing)
412                  (const :tag "if-outdated" if-outdated))
413   :group 'info)
414
415 (defcustom Info-save-auto-generated-dir 'never
416   "*Whether an auto-generated info directory listing should be saved.
417 Possible values are:
418 nil or `never', the default, auto-generated info directory
419   information will never be saved.
420 `always', auto-generated info directory information will be saved to
421   a `dir' file in the same directory overwriting it if it exists
422 `conservative', auto-generated info directory information will be saved
423   to a `dir' file in the same directory but the user is asked before
424   overwriting any existing file."
425   :type '(choice (const :tag "never" never)
426                  (const :tag "always" always)
427                  (const :tag "conservative" conservative))
428   :group 'info)
429
430 (defconst Info-emacs-info-file-name "sxemacs.info"
431   "The filename of the SXEmacs info for `Info-goto-emacs-command-node'
432 \(`\\<help-mode-map>\\[Info-goto-emacs-command-node]'\)")
433
434 ;;;###autoload
435 (defvar Info-directory-list nil
436   "List of directories to search for Info documentation files.
437