0
|
1 ;;; info.el --- info package for Emacs.
|
|
2 ;; Keywords: help
|
|
3
|
|
4 ;; Copyright (C) 1985, 1986, 1993 Free Software Foundation, Inc.
|
|
5
|
|
6 ;; Author: Dave Gillespie <daveg@synaptics.com>
|
|
7 ;; Richard Stallman <rms@gnu.ai.mit.edu>
|
|
8 ;; Maintainer: Dave Gillespie <daveg@synaptics.com>
|
|
9 ;; Version: 1.07 of 7/22/93
|
|
10
|
|
11 ;; This file is part of XEmacs.
|
|
12
|
|
13 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
14 ;; under the terms of the GNU General Public License as published by
|
|
15 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
16 ;; any later version.
|
|
17
|
|
18 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
21 ;; General Public License for more details.
|
|
22
|
|
23 ;; You should have received a copy of the GNU General Public License
|
16
|
24 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
26 ;; Boston, MA 02111-1307, USA.
|
0
|
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 ;; Notably: Added Info-default-directory-list.
|
|
262
|
|
263
|
|
264 ;; Modified 6/2/1993 by Dave Gillespie:
|
|
265 ;;
|
|
266 ;; Changed to use new suffix ".gz" for gzip files.
|
|
267
|
|
268
|
|
269 ;; Modified 7/22/1993 by Dave Gillespie:
|
|
270 ;;
|
|
271 ;; Changed Info-footnote-tag to "See" instead of "Ref".
|
|
272 ;;
|
|
273 ;; Extended Info-fontify-node to work with FSF version of Emacs 19.
|
|
274
|
|
275 ;; Modified 7/30/1993 by Jamie Zawinski:
|
|
276 ;;
|
|
277 ;; Commented out the tty and fsf19 mouse support, because why bother.
|
|
278 ;; Commented out the politically incorrect version of XEmacs mouse support.
|
|
279 ;; Commented out mouse scrolling bindings because the party line on that
|
|
280 ;; is "scrollbars are coming soon."
|
|
281 ;; Commented out munging of help-for-help's doc; put it in help.el.
|
|
282 ;; Did Info-edit-map the modern XEmacs way.
|
|
283 ;; Pruned extra cruft from fontification and mouse handling code.
|
|
284 ;; Fixed ASCII-centric bogosity in unreading of events.
|
|
285
|
|
286 ;; Modified 8/11/95 by Chuck Thompson:
|
|
287 ;;
|
|
288 ;; Removed any pretense of ever referencing Info-directory since it
|
|
289 ;; wasn't working anyhow.
|
|
290
|
120
|
291 ;; Modified 4/5/97 by Tomasz J. Cholewo:
|
|
292 ;;
|
|
293 ;; Modified Info-search to use with-caps-disable-folding
|
|
294
|
0
|
295 ;; Code:
|
|
296
|
120
|
297 (defgroup info nil
|
|
298 "Info subsystem"
|
|
299 :group 'help)
|
0
|
300
|
120
|
301 (defcustom Info-inhibit-toolbar nil
|
|
302 "*Non-nil means don't use the specialized Info toolbar."
|
|
303 :type 'boolean
|
|
304 :group 'info)
|
|
305
|
|
306 (defcustom Info-novice nil
|
|
307 "*Non-nil means to ask for confirmation before switching Info files."
|
|
308 :type 'boolean
|
|
309 :group 'info)
|
0
|
310
|
|
311 (defvar Info-history nil
|
|
312 "List of info nodes user has visited.
|
|
313 Each element of list is a list (\"(FILENAME)NODENAME\" BUFPOS WINSTART).")
|
|
314
|
|
315 (defvar Info-keeping-history t
|
|
316 "Non-nil if Info-find-node should modify Info-history.
|
|
317 This is for use only by certain internal Info routines.")
|
|
318
|
120
|
319 (defcustom Info-enable-edit nil
|
0
|
320 "*Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info
|
|
321 can edit the current node.
|
|
322 This is convenient if you want to write info files by hand.
|
|
323 However, we recommend that you not do this.
|
|
324 It is better to write a Texinfo file and generate the Info file from that,
|
120
|
325 because that gives you a printed manual as well."
|
|
326 :type 'boolean
|
|
327 :group 'info)
|
0
|
328
|
120
|
329 (defcustom Info-enable-active-nodes t
|
0
|
330 "*Non-nil allows Info to execute Lisp code associated with nodes.
|
120
|
331 The Lisp code is executed when the node is selected."
|
|
332 :type 'boolean
|
|
333 :group 'info)
|
0
|
334
|
120
|
335 (defcustom Info-restoring-point t
|
|
336 "*Non-nil means to restore the cursor position when re-entering a node."
|
|
337 :type 'boolean
|
|
338 :group 'info)
|
0
|
339
|
120
|
340 (defcustom Info-auto-advance 'twice
|
0
|
341 "*Control what SPC and DEL do when they can't scroll any further.
|
|
342 If nil, they beep and remain in the current node.
|
|
343 If t, they move to the next node (like Info-global-next/prev).
|
120
|
344 If anything else, they must be pressed twice to move to the next node."
|
|
345 :type '(radio (const :tag "off" nil)
|
|
346 (const :tag "advance" t)
|
|
347 (const :tag "confirm" twice))
|
|
348 :group 'info)
|
0
|
349
|
120
|
350 (defcustom Info-fontify t
|
0
|
351 "*Non-nil enables font features in XEmacs.
|
120
|
352 This variable is ignored unless running under XEmacs."
|
|
353 :type 'boolean
|
|
354 :group 'info)
|
0
|
355
|
120
|
356 (defcustom Info-default-directory-list nil
|
|
357 "*List of default directories to search for Info documentation files.
|
0
|
358 This value is used as the default for `Info-directory-list'. It is set
|
120
|
359 in startup.el."
|
|
360 :type '(repeat directory)
|
|
361 :group 'info)
|
0
|
362
|
|
363 (defvar Info-directory-list
|
|
364 (let ((path (getenv "INFOPATH")))
|
|
365 (if path
|
|
366 (let ((list nil)
|
|
367 idx)
|
|
368 (while (> (length path) 0)
|
|
369 (setq idx (or (string-match ":" path) (length path))
|
|
370 list (cons (substring path 0 idx) list)
|
|
371 path (substring path (min (1+ idx)
|
|
372 (length path)))))
|
|
373 (nreverse list))
|
|
374 Info-default-directory-list))
|
|
375 "List of directories to search for Info documentation files.
|
|
376 Default is to use the environment variable INFOPATH if it exists,
|
|
377 else to use Info-default-directory-list.")
|
|
378
|
|
379 (defvar Info-suffix-list '( (".info" . nil)
|
|
380 (".info.gz" . "gzip -dc %s")
|
|
381 (".info-z" . "gzip -dc %s")
|
|
382 (".info.Z" . "uncompress -c %s")
|
|
383 (".gz" . "gzip -dc %s")
|
|
384 (".Z" . "uncompress -c %s") )
|
|
385 "List of file name suffixes and associated decoding commands.
|
|
386 Each entry should be (SUFFIX . STRING); if STRING contains %s, that is
|
|
387 changed to name of the file to decode, otherwise the file is given to
|
|
388 the command as standard input. If STRING is nil, no decoding is done.")
|
|
389
|
136
|
390 (defvar Info-footnote-tag "Note"
|
0
|
391 "*Symbol that identifies a footnote or cross-reference.
|
|
392 All \"*Note\" references will be changed to use this word instead.")
|
|
393
|
|
394 (defvar Info-current-file nil
|
|
395 "Info file that Info is now looking at, or nil.")
|
|
396
|
|
397 (defvar Info-current-subfile nil
|
|
398 "Info subfile that is actually in the *info* buffer now,
|
|
399 or nil if current info file is not split into subfiles.")
|
|
400
|
|
401 (defvar Info-current-node nil
|
|
402 "Name of node that Info is now looking at, or nil.")
|
|
403
|
|
404 (defvar Info-tag-table-marker (make-marker)
|
|
405 "Marker pointing at beginning of current Info file's tag table.
|
|
406 Marker points nowhere if file has no tag table.")
|
|
407
|
|
408 (defvar Info-current-file-completions nil
|
|
409 "Cached completion list for current Info file.")
|
|
410
|
|
411 (defvar Info-current-annotation-completions nil
|
|
412 "Cached completion list for current annotation files.")
|
|
413
|
|
414 (defvar Info-index-alternatives nil
|
|
415 "List of possible matches for last Info-index command.")
|
|
416 (defvar Info-index-first-alternative nil)
|
|
417
|
120
|
418 (defcustom Info-annotations-path '("~/.infonotes" "/usr/lib/info.notes")
|
0
|
419 "*Names of files that contain annotations for different Info nodes.
|
|
420 By convention, the first one should reside in your personal directory.
|
120
|
421 The last should be a world-writable \"public\" annotations file."
|
|
422 :type '(repeat file)
|
|
423 :group 'info)
|
0
|
424
|
|
425 (defvar Info-standalone nil
|
|
426 "Non-nil if Emacs was started solely as an Info browser.")
|
|
427
|
|
428 (defvar Info-in-cross-reference nil)
|
|
429 (defvar Info-window-configuration nil)
|
|
430
|
|
431 ;;;###autoload
|
|
432 (defun info (&optional file)
|
|
433 "Enter Info, the documentation browser.
|
|
434 Optional argument FILE specifies the file to examine;
|
|
435 the default is the top-level directory of Info.
|
|
436
|
|
437 In interactive use, a prefix argument directs this command
|
|
438 to read a file name from the minibuffer."
|
|
439 (interactive (if current-prefix-arg
|
|
440 (list (read-file-name "Info file name: " nil nil t))))
|
|
441 (let ((p command-line-args))
|
|
442 (while p
|
|
443 (and (string-match "^-[fe]" (car p))
|
|
444 (equal (nth 1 p) "info")
|
|
445 (not Info-standalone)
|
|
446 (setq Info-standalone t)
|
|
447 (= (length p) 3)
|
|
448 (not (string-match "^-" (nth 2 p)))
|
|
449 (setq file (nth 2 p))
|
|
450 (setq command-line-args-left nil))
|
|
451 (setq p (cdr p))))
|
|
452 ; (Info-setup-x)
|
|
453 (if file
|
|
454 (unwind-protect
|
|
455 (Info-goto-node (concat "(" file ")"))
|
|
456 (and Info-standalone (info)))
|
|
457 (if (get-buffer "*info*")
|
|
458 (switch-to-buffer "*info*")
|
|
459 (Info-directory))))
|
|
460
|
|
461 ;;;###autoload
|
|
462 (defun Info-query (file)
|
|
463 "Enter Info, the documentation browser. Prompt for name of Info file."
|
|
464 (interactive "sInfo topic (default = menu): ")
|
|
465 (info)
|
|
466 (if (equal file "")
|
|
467 (Info-goto-node "(dir)")
|
|
468 (Info-goto-node (concat "(" file ")"))))
|
|
469
|
|
470 (defun Info-setup-initial ()
|
|
471 (let ((f Info-annotations-path))
|
|
472 (while f
|
|
473 (if (and (file-exists-p (car f)) (not (get-file-buffer (car f))))
|
|
474 (bury-buffer (find-file-noselect (car f))))
|
|
475 (setq f (cdr f)))))
|
|
476
|
|
477 (defconst Info-emacs-info-file-name "xemacs")
|
|
478
|
|
479 ;; Go to an info node specified as separate filename and nodename.
|
|
480 ;; no-going-back is non-nil if recovering from an error in this function;
|
|
481 ;; it says do not attempt further (recursive) error recovery.
|
|
482 (defun Info-find-node (filename &optional nodename no-going-back tryfile line)
|
|
483 ;; Look for a plausible filename, or if not found then look for URls
|
|
484 ;; &c, and dispatch to the appropriate fn.
|
|
485
|
|
486 (Info-setup-initial)
|
|
487
|
|
488 (cond
|
|
489 ;; empty filename is simple case
|
|
490 ((null filename)
|
|
491 (Info-find-file-node nil nodename no-going-back tryfile line))
|
|
492 ;; Convert filename to lower case if not found as specified.
|
|
493 ;; Expand it, look harder...
|
|
494 ((let (temp temp-downcase found
|
|
495 (fname (substitute-in-file-name filename)))
|
|
496 ;; horrible kludge so that I can call the emacs doc
|
|
497 ;; "XEmacs" without having to make .../info/dir be ugly.
|
|
498 ;; I'd like to do this only if the "emacs" node wasn't
|
|
499 ;; found, but this 200+ line function is too hairy for me
|
|
500 ;; to want to think about any longer than I have to.
|
|
501 (if (equal (downcase fname) "emacs")
|
|
502 (setq fname Info-emacs-info-file-name))
|
|
503 (let ((dirs (if (string-match "^\\./" fname)
|
|
504 ;; If specified name starts with `./'
|
|
505 ;; then just try current directory.
|
|
506 (list default-directory) ; '("./")
|
|
507 Info-directory-list)))
|
|
508 ;; Search the directory list for file FNAME.
|
|
509 (while (and dirs (not found))
|
|
510 (setq temp (expand-file-name fname (car dirs)))
|
|
511 (setq temp-downcase
|
|
512 (expand-file-name (downcase fname) (car dirs)))
|
|
513 (if (equal temp-downcase temp) (setq temp-downcase nil))
|
|
514 ;; Try several variants of specified name.
|
|
515 ;; Try downcasing, appending a suffix, or both.
|
|
516 (setq found (Info-suffixed-file temp temp-downcase))
|
|
517 (setq dirs (cdr dirs)))
|
|
518 (if found
|
|
519 (progn (setq filename (expand-file-name found))
|
|
520 t))))
|
|
521 (Info-find-file-node filename nodename no-going-back tryfile line))
|
|
522 ;; Look for a URL. This pattern is stolen from w3.el to prevent
|
|
523 ;; loading it if we won't need it.
|
|
524 ((string-match "^\\(wais\\|solo\\|x-exec\\|newspost\\|www\\|mailto\\|news\\|tn3270\\|ftp\\|http\\|file\\|telnet\\|gopher\\):" filename)
|
|
525 (w3-fetch filename))
|
|
526 (t
|
|
527 (error "Info file %s does not exist" filename))))
|
|
528
|
|
529 (defun Info-find-file-node (filename nodename
|
|
530 &optional no-going-back tryfile line)
|
|
531 ;; This is the guts of what was Info-find-node. Whoever wrote this
|
|
532 ;; should be locked up where they can't do any more harm.
|
|
533
|
|
534 ;; Go into info buffer.
|
|
535 (switch-to-buffer "*info*")
|
|
536 (if (fboundp 'buffer-disable-undo)
|
|
537 (buffer-disable-undo (current-buffer)))
|
|
538 (run-hooks 'Info-startup-hook)
|
|
539 (or (eq major-mode 'Info-mode)
|
|
540 (Info-mode))
|
|
541 (or (null filename)
|
|
542 (equal Info-current-file filename)
|
|
543 (not Info-novice)
|
|
544 (string-match "^dir$" (file-name-nondirectory Info-current-file))
|
|
545 (if (y-or-n-p (format "Leave Info file `%s'? "
|
|
546 (file-name-nondirectory Info-current-file)))
|
|
547 (message "")
|
|
548 (keyboard-quit)))
|
|
549 ;; Record the node we are leaving.
|
|
550 (if (and Info-current-file (not no-going-back))
|
|
551 (Info-history-add Info-current-file Info-current-node (point)))
|
|
552 (widen)
|
|
553 (setq Info-current-node nil
|
|
554 Info-in-cross-reference nil)
|
|
555 (unwind-protect
|
|
556 (progn
|
|
557 ;; Switch files if necessary
|
|
558 (or (null filename)
|
|
559 (equal Info-current-file filename)
|
|
560 (let ((buffer-read-only nil))
|
|
561 (setq Info-current-file nil
|
|
562 Info-current-subfile nil
|
|
563 Info-index-alternatives nil
|
|
564 Info-current-file-completions nil
|
|
565 buffer-file-name nil)
|
|
566 (erase-buffer)
|
|
567 (Info-insert-file-contents filename t)
|
|
568 ;; Add all "localdir" files in search path to "dir" file.
|
|
569 (if (string-match "^dir$" (file-name-nondirectory filename))
|
|
570 (let ((d Info-directory-list)
|
|
571 name (lim -1))
|
|
572 (goto-char (point-max))
|
|
573 (if (re-search-backward "^ *\\* *Locals *: *\n" nil t)
|
|
574 (delete-region (match-beginning 0) (match-end 0))
|
|
575 (search-backward "\^L" nil t))
|
|
576 (while d
|
|
577 (setq name (expand-file-name "localdir" (car d)))
|
|
578 (if (or (file-exists-p name)
|
|
579 (file-exists-p
|
|
580 (setq name (concat name ".info"))))
|
|
581 ;; Insert menu part of the file
|
|
582 (let* ((pt (point))
|
|
583 (len (nth 1 (insert-file-contents name))))
|
|
584 ;; be careful to put the local info entries
|
|
585 ;; in the buffer in the order they were found
|
|
586 ;; in the search path.
|
|
587 (goto-char (+ pt len))
|
|
588 (save-excursion
|
|
589 (goto-char pt)
|
|
590 (if (search-forward "* menu:" (+ pt len) t)
|
|
591 (progn
|
|
592 (forward-line 1)
|
|
593 (delete-region pt (point)))))))
|
|
594 (setq d (cdr d)))
|
|
595 ;; Eliminate redundant menu entries.
|
|
596 (goto-char (point-min))
|
|
597 (while (re-search-forward "\n\\* \\([^:\n]*\\):" nil t)
|
|
598 (let ((str (buffer-substring (match-beginning 1)
|
|
599 (match-end 1))))
|
|
600 (if (> (point) lim)
|
|
601 (save-excursion
|
|
602 (setq lim (if (search-forward "\^_" nil t)
|
|
603 (point)
|
|
604 (point-max)))))
|
|
605 (save-excursion
|
|
606 (if (search-forward (format "\n* %s:" str) lim t)
|
|
607 (let ((pt (- (point) 3 (length str))))
|
|
608 (forward-line 1)
|
|
609 (delete-region pt (point)))))))))
|
|
610 (set-buffer-modified-p nil)
|
|
611 (setq default-directory (file-name-directory filename))
|
|
612 ;; See whether file has a tag table. Record the location if yes.
|
|
613 (set-marker Info-tag-table-marker nil)
|
|
614 (goto-char (point-max))
|
|
615 (forward-line -8)
|
|
616 (or (equal nodename "*")
|
|
617 (not (search-forward "\^_\nEnd tag table\n" nil t))
|
|
618 (let (pos)
|
|
619 ;; We have a tag table. Find its beginning.
|
|
620 ;; Is this an indirect file?
|
|
621 (search-backward "\nTag table:\n")
|
|
622 (setq pos (point))
|
|
623 (if (save-excursion
|
|
624 (forward-line 2)
|
|
625 (looking-at "(Indirect)\n"))
|
|
626 ;; It is indirect. Copy it to another buffer
|
|
627 ;; and record that the tag table is in that buffer.
|
|
628 (save-excursion
|
|
629 (let ((buf (current-buffer)))
|
|
630 (set-buffer
|
|
631 (get-buffer-create " *info tag table*"))
|
|
632 (if (fboundp 'buffer-disable-undo)
|
|
633 (buffer-disable-undo (current-buffer)))
|
|
634 (setq case-fold-search t)
|
|
635 (erase-buffer)
|
|
636 (insert-buffer-substring buf)
|
|
637 (set-marker Info-tag-table-marker
|
|
638 (match-end 0))))
|
|
639 (set-marker Info-tag-table-marker pos))))
|
|
640 (setq Info-current-file
|
|
641 (file-name-sans-versions buffer-file-name))))
|
|
642 (if (equal nodename "*")
|
|
643 (progn (setq Info-current-node nodename)
|
|
644 (Info-set-mode-line)
|
|
645 (goto-char (point-min)))
|
|
646 ;; Search file for a suitable node.
|
|
647 (let* ((qnode (regexp-quote nodename))
|
|
648 (regexp (concat "Node: *" qnode " *[,\t\n\177]"))
|
|
649 (guesspos (point-min))
|
|
650 (found t))
|
|
651 ;; First get advice from tag table if file has one.
|
|
652 ;; Also, if this is an indirect info file,
|
|
653 ;; read the proper subfile into this buffer.
|
|
654 (if (marker-position Info-tag-table-marker)
|
|
655 (save-excursion
|
|
656 (set-buffer (marker-buffer Info-tag-table-marker))
|
|
657 (goto-char Info-tag-table-marker)
|
|
658 (if (re-search-forward regexp nil t)
|
|
659 (progn
|
|
660 (setq guesspos (read (current-buffer)))
|
|
661 ;; If this is an indirect file,
|
|
662 ;; determine which file really holds this node
|
|
663 ;; and read it in.
|
|
664 (if (not (eq (current-buffer) (get-buffer "*info*")))
|
|
665 (setq guesspos
|
|
666 (Info-read-subfile guesspos)))))))
|
|
667 (goto-char (max (point-min) (- guesspos 1000)))
|
|
668 ;; Now search from our advised position (or from beg of buffer)
|
|
669 ;; to find the actual node.
|
|
670 (catch 'foo
|
|
671 (while (search-forward "\n\^_" nil t)
|
|
672 (forward-line 1)
|
|
673 (let ((beg (point)))
|
|
674 (forward-line 1)
|
|
675 (if (re-search-backward regexp beg t)
|
|
676 (throw 'foo t))))
|
|
677 (setq found nil)
|
|
678 (let ((bufs (delq nil (mapcar 'get-file-buffer
|
|
679 Info-annotations-path)))
|
|
680 (pattern (if (string-match "\\`<<.*>>\\'" qnode) qnode
|
|
681 (format "\"%s\"\\|<<%s>>" qnode qnode)))
|
|
682 (pat2 (concat "------ *File: *\\([^ ].*[^ ]\\) *Node: "
|
|
683 "*\\([^ ].*[^ ]\\) *Line: *\\([0-9]+\\)"))
|
|
684 (afile nil) anode aline)
|
|
685 (while (and bufs (not anode))
|
|
686 (save-excursion
|
|
687 (set-buffer (car bufs))
|
|
688 (goto-char (point-min))
|
|
689 (if (re-search-forward pattern nil t)
|
|
690 (if (re-search-backward pat2 nil t)
|
|
691 (setq afile (buffer-substring (match-beginning 1)
|
|
692 (match-end 1))
|
|
693 anode (buffer-substring (match-beginning 2)
|
|
694 (match-end 2))
|
|
695 aline (string-to-int
|
|
696 (buffer-substring (match-beginning 3)
|
|
697 (match-end 3)))))))
|
|
698 (setq bufs (cdr bufs)))
|
|
699 (if anode
|
|
700 (Info-find-node afile anode t nil aline)
|
|
701 (if tryfile
|
|
702 (condition-case nil
|
|
703 (Info-find-node nodename "Top" t)
|
|
704 (error nil)))))
|
|
705 (or Info-current-node
|
|
706 (error "No such node: %s" nodename)))
|
|
707 (if found
|
|
708 (progn
|
|
709 (Info-select-node)
|
|
710 (goto-char (point-min))
|
|
711 (if line (forward-line line)))))))
|
|
712 ;; If we did not finish finding the specified node,
|
|
713 ;; go back to the previous one.
|
|
714 (or Info-current-node no-going-back
|
|
715 (let ((hist (car Info-history)))
|
|
716 ;; The following is no longer safe with new Info-history system
|
|
717 ;; (setq Info-history (cdr Info-history))
|
|
718 (Info-goto-node (car hist) t)
|
|
719 (goto-char (+ (point-min) (nth 1 hist)))))))
|
|
720
|
|
721 (defun Info-history-add (file node point)
|
|
722 (if Info-keeping-history
|
|
723 (let* ((name (format "(%s)%s" (Info-file-name-only file) node))
|
|
724 (found (assoc name Info-history)))
|
|
725 (if found
|
|
726 (setq Info-history (delq found Info-history)))
|
|
727 (setq Info-history (cons (list name (- point (point-min))
|
|
728 (and (eq (window-buffer)
|
|
729 (current-buffer))
|
|
730 (- (window-start) (point-min))))
|
|
731 Info-history)))))
|
|
732
|
|
733 (defun Info-file-name-only (file)
|
|
734 (let ((dir (file-name-directory file))
|
|
735 (p Info-directory-list))
|
|
736 (while (and p (not (equal (car p) dir)))
|
|
737 (setq p (cdr p)))
|
|
738 (if p (file-name-nondirectory file) file)))
|
|
739
|
|
740 (defun Info-read-subfile (nodepos)
|
|
741 (set-buffer (marker-buffer Info-tag-table-marker))
|
|
742 (goto-char (point-min))
|
|
743 (search-forward "\n\^_")
|
|
744 (let (lastfilepos
|
|
745 lastfilename)
|
|
746 (forward-line 2)
|
|
747 (catch 'foo
|
|
748 (while (not (looking-at "\^_"))
|
|
749 (if (not (eolp))
|
|
750 (let ((beg (point))
|
|
751 thisfilepos thisfilename)
|
|
752 (search-forward ": ")
|
|
753 (setq thisfilename (buffer-substring beg (- (point) 2)))
|
|
754 (setq thisfilepos (read (current-buffer)))
|
|
755 ;; read in version 19 stops at the end of number.
|
|
756 ;; Advance to the next line.
|
|
757 (if (eolp)
|
|
758 (forward-line 1))
|
|
759 (if (> thisfilepos nodepos)
|
|
760 (throw 'foo t))
|
|
761 (setq lastfilename thisfilename)
|
|
762 (setq lastfilepos thisfilepos))
|
|
763 (throw 'foo t))))
|
|
764 (set-buffer (get-buffer "*info*"))
|
|
765 (or (equal Info-current-subfile lastfilename)
|
|
766 (let ((buffer-read-only nil))
|
|
767 (setq buffer-file-name nil)
|
|
768 (widen)
|
|
769 (erase-buffer)
|
|
770 (Info-insert-file-contents (Info-suffixed-file
|
|
771 (expand-file-name lastfilename
|
|
772 (file-name-directory
|
|
773 Info-current-file)))
|
|
774 t)
|
|
775 (set-buffer-modified-p nil)
|
|
776 (setq Info-current-subfile lastfilename)))
|
|
777 (goto-char (point-min))
|
|
778 (search-forward "\n\^_")
|
|
779 (+ (- nodepos lastfilepos) (point))))
|
|
780
|
|
781 (defun Info-suffixed-file (name &optional name2)
|
|
782 (let ((suff Info-suffix-list)
|
|
783 (found nil))
|
|
784 (while (and suff (not found))
|
|
785 (if (file-exists-p (concat name (car (car suff))))
|
|
786 (setq found (concat name (car (car suff))))
|
|
787 (if (and name2 (file-exists-p (concat name2 (car (car suff)))))
|
|
788 (setq found (concat name2 (car (car suff))))
|
|
789 (setq suff (cdr suff)))))
|
|
790 (or found
|
|
791 (and (file-exists-p name) name)
|
|
792 (and name2 (file-exists-p name2) name2))))
|
|
793
|
|
794 (defun Info-insert-file-contents (file &optional visit)
|
|
795 (setq file (expand-file-name file default-directory))
|
|
796 (let ((suff Info-suffix-list))
|
|
797 (while (and suff (or (<= (length file) (length (car (car suff))))
|
|
798 (not (equal (substring file
|
|
799 (- (length (car (car suff)))))
|
|
800 (car (car suff))))))
|
|
801 (setq suff (cdr suff)))
|
|
802 (if (stringp (cdr (car suff)))
|
|
803 (let ((command (if (string-match "%s" (cdr (car suff)))
|
|
804 (format (cdr (car suff)) file)
|
|
805 (concat (cdr (car suff)) " < " file))))
|
|
806 (message "%s..." command)
|
|
807 (if (eq system-type 'vax-vms)
|
|
808 (call-process command nil t nil)
|
|
809 (call-process shell-file-name nil t nil "-c" command))
|
|
810 (message "")
|
|
811 (if visit
|
|
812 (progn
|
|
813 (setq buffer-file-name file)
|
|
814 (set-buffer-modified-p nil)
|
|
815 (clear-visited-file-modtime))))
|
|
816 (insert-file-contents file visit))))
|
|
817
|
|
818 (defun Info-select-node ()
|
|
819 "Select the node that point is in, after using `g *' to select whole file."
|
|
820 (interactive)
|
|
821 (widen)
|
|
822 (save-excursion
|
|
823 ;; Find beginning of node.
|
|
824 (search-backward "\n\^_")
|
|
825 (forward-line 2)
|
|
826 ;; Get nodename spelled as it is in the node.
|
|
827 (re-search-forward "Node:[ \t]*")
|
|
828 (setq Info-current-node
|
|
829 (buffer-substring (point)
|
|
830 (progn
|
|
831 (skip-chars-forward "^,\t\n")
|
|
832 (point))))
|
|
833 (Info-set-mode-line)
|
|
834 ;; Find the end of it, and narrow.
|
|
835 (beginning-of-line)
|
|
836 (let (active-expression)
|
|
837 (narrow-to-region (point)
|
|
838 (if (re-search-forward "\n[\^_\f]" nil t)
|
|
839 (prog1
|
|
840 (1- (point))
|
|
841 (if (looking-at "[\n\^_\f]*execute: ")
|
|
842 (progn
|
|
843 (goto-char (match-end 0))
|
|
844 (setq active-expression
|
|
845 (read (current-buffer))))))
|
|
846 (point-max)))
|
|
847 (or (equal Info-footnote-tag "Note")
|
|
848 (progn
|
|
849 (goto-char (point-min))
|
|
850 (let ((buffer-read-only nil)
|
|
851 (bufmod (buffer-modified-p))
|
|
852 (case-fold-search t))
|
|
853 (while (re-search-forward "\\*Note\\([ \n]\\)" nil t)
|
|
854 (replace-match (concat "*" Info-footnote-tag "\ ")))
|
|
855 (set-buffer-modified-p bufmod))))
|
|
856 (Info-reannotate-node)
|
|
857 ;; XEmacs: remove v19 test
|
|
858 (and Info-fontify
|
|
859 (Info-fontify-node))
|
|
860 (run-hooks 'Info-select-hook)
|
|
861 (if Info-enable-active-nodes (eval active-expression)))))
|
|
862
|
|
863 (defun Info-set-mode-line ()
|
|
864 (setq modeline-buffer-identification
|
82
|
865 (list (cons modeline-buffer-id-left-extent "Info: ")
|
|
866 (cons modeline-buffer-id-right-extent
|
|
867 (concat
|
|
868 "("
|
|
869 (if Info-current-file
|
|
870 (let ((name (file-name-nondirectory Info-current-file)))
|
|
871 (if (string-match "\\.info$" name)
|
|
872 (substring name 0 -5)
|
|
873 name))
|
|
874 "")
|
|
875 ")"
|
|
876 (or Info-current-node ""))))))
|
|
877
|
0
|
878 ;; Go to an info node specified with a filename-and-nodename string
|
|
879 ;; of the sort that is found in pointers in nodes.
|
|
880
|
|
881 ;;;###autoload
|
|
882 (defun Info-goto-node (nodename &optional no-going-back tryfile)
|
|
883 "Go to info node named NAME. Give just NODENAME or (FILENAME)NODENAME.
|
|
884 Actually, the following interpretations of NAME are tried in order:
|
|
885 (FILENAME)NODENAME
|
|
886 (FILENAME) (using Top node)
|
|
887 NODENAME (in current file)
|
|
888 TAGNAME (see below)
|
|
889 FILENAME (using Top node)
|
|
890 where TAGNAME is a string that appears in quotes: \"TAGNAME\", in an
|
|
891 annotation for any node of any file. (See `a' and `x' commands.)"
|
|
892 (interactive (list (Info-read-node-name "Goto node, file or tag: ")
|
|
893 nil t))
|
|
894 (let (filename)
|
|
895 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
|
|
896 nodename)
|
|
897 (setq filename (if (= (match-beginning 1) (match-end 1))
|
|
898 ""
|
|
899 (substring nodename (match-beginning 2) (match-end 2)))
|
|
900 nodename (substring nodename (match-beginning 3) (match-end 3)))
|
|
901 (let ((trim (string-match "\\s *\\'" filename)))
|
|
902 (if trim (setq filename (substring filename 0 trim))))
|
|
903 (let ((trim (string-match "\\s *\\'" nodename)))
|
|
904 (if trim (setq nodename (substring nodename 0 trim))))
|
|
905 (Info-find-node (if (equal filename "") nil filename)
|
|
906 (if (equal nodename "") "Top" nodename)
|
|
907 no-going-back (and tryfile (equal filename "")))))
|
|
908
|
|
909 (defun Info-goto-bookmark ()
|
|
910 (interactive)
|
|
911
|
|
912 (let ((completion-ignore-case nil)
|
|
913 (tag (completing-read "Goto tag: "
|
|
914 (Info-build-annotation-completions)
|
|
915 nil t)))
|
|
916 (or (equal tag "") (Info-find-node nil (format "<<%s>>" tag)))))
|
|
917
|
|
918 ;;;###autoload
|
|
919 (defun Info-visit-file ()
|
|
920 "Directly visit an info file."
|
|
921 (interactive)
|
|
922 (let* ((insert-default-directory nil)
|
|
923 (file (read-file-name "Goto Info file: " "" "")))
|
|
924 (or (equal file "") (Info-find-node (expand-file-name file) "Top"))))
|
|
925
|
|
926 (defun Info-restore-point (&optional always)
|
|
927 "Restore point to same location it had last time we were in this node."
|
|
928 (interactive "p")
|
|
929 (if (or Info-restoring-point always)
|
|
930 (let* ((name (format "(%s)%s"
|
|
931 (Info-file-name-only Info-current-file)
|
|
932 Info-current-node))
|
|
933 (p (assoc name Info-history)))
|
|
934 (if p (Info-restore-history-entry p)))))
|
|
935
|
|
936 (defun Info-restore-history-entry (entry)
|
|
937 (goto-char (+ (nth 1 entry) (point-min)))
|
|
938 (and (nth 2 entry)
|
|
939 (get-buffer-window (current-buffer))
|
|
940 (set-window-start (get-buffer-window (current-buffer))
|
|
941 (+ (nth 2 entry) (point-min)))))
|
|
942
|
|
943 (defun Info-read-node-name (prompt &optional default)
|
|
944 (Info-setup-initial)
|
|
945 (let* ((completion-ignore-case t)
|
|
946 (nodename (completing-read prompt (Info-build-node-completions))))
|
|
947 (if (equal nodename "")
|
|
948 (or default
|
|
949 (Info-read-node-name prompt))
|
|
950 nodename)))
|
|
951
|
|
952 (defun Info-build-annotation-completions ()
|
|
953 (or Info-current-annotation-completions
|
|
954 (save-excursion
|
|
955 (let ((bufs (delq nil (mapcar 'get-file-buffer
|
|
956 Info-annotations-path)))
|
|
957 (compl nil))
|
|
958 (while bufs
|
|
959 (set-buffer (car bufs))
|
|
960 (goto-char (point-min))
|
|
961 (while (re-search-forward "<<\\(.*\\)>>" nil t)
|
|
962 (setq compl (cons (list (buffer-substring (match-beginning 1)
|
|
963 (match-end 1)))
|
|
964 compl)))
|
|
965 (setq bufs (cdr bufs)))
|
|
966 (setq Info-current-annotation-completions compl)))))
|
|
967
|
|
968 (defun Info-build-node-completions ()
|
|
969 (or Info-current-file-completions
|
|
970 (let ((compl (Info-build-annotation-completions)))
|
|
971 (save-excursion
|
|
972 (save-restriction
|
|
973 (if (marker-buffer Info-tag-table-marker)
|
|
974 (progn
|
|
975 (set-buffer (marker-buffer Info-tag-table-marker))
|
|
976 (goto-char Info-tag-table-marker)
|
|
977 (while (re-search-forward "\nNode: \\(.*\\)\177" nil t)
|
|
978 (setq compl
|
|
979 (cons (list (buffer-substring (match-beginning 1)
|
|
980 (match-end 1)))
|
|
981 compl))))
|
|
982 (widen)
|
|
983 (goto-char (point-min))
|
|
984 (while (search-forward "\n\^_" nil t)
|
|
985 (forward-line 1)
|
|
986 (let ((beg (point)))
|
|
987 (forward-line 1)
|
|
988 (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]"
|
|
989 beg t)
|
|
990 (setq compl
|
|
991 (cons (list (buffer-substring (match-beginning 1)
|
|
992 (match-end 1)))
|
|
993 compl))))))))
|
|
994 (setq Info-current-file-completions compl))))
|
|
995
|
|
996 (defvar Info-last-search nil
|
|
997 "Default regexp for \\<Info-mode-map>\\[Info-search] command to search for.")
|
|
998
|
|
999 ;;;###autoload
|
|
1000 (defun Info-search (regexp)
|
|
1001 "Search for REGEXP, starting from point, and select node it's found in."
|
|
1002 (interactive "sSearch (regexp): ")
|
|
1003 (if (equal regexp "")
|
|
1004 (setq regexp Info-last-search)
|
|
1005 (setq Info-last-search regexp))
|
120
|
1006 (with-caps-disable-folding regexp
|
|
1007 (let ((found ())
|
|
1008 (onode Info-current-node)
|
|
1009 (ofile Info-current-file)
|
|
1010 (opoint (point))
|
|
1011 (osubfile Info-current-subfile))
|
|
1012 (save-excursion
|
|
1013 (save-restriction
|
|
1014 (widen)
|
|
1015 (if (null Info-current-subfile)
|
|
1016 (progn (re-search-forward regexp) (setq found (point)))
|
|
1017 (condition-case nil
|
|
1018 (progn (re-search-forward regexp) (setq found (point)))
|
|
1019 (search-failed nil)))))
|
|
1020 (if (not found) ;can only happen in subfile case -- else would have erred
|
|
1021 (unwind-protect
|
|
1022 (let ((list ()))
|
|
1023 (set-buffer (marker-buffer Info-tag-table-marker))
|
|
1024 (goto-char (point-min))
|
|
1025 (search-forward "\n\^_\nIndirect:")
|
|
1026 (save-restriction
|
|
1027 (narrow-to-region (point)
|
|
1028 (progn (search-forward "\n\^_")
|
|
1029 (1- (point))))
|
|
1030 (goto-char (point-min))
|
|
1031 (search-forward (concat "\n" osubfile ": "))
|
|
1032 (beginning-of-line)
|
|
1033 (while (not (eobp))
|
|
1034 (re-search-forward "\\(^.*\\): [0-9]+$")
|
|
1035 (goto-char (+ (match-end 1) 2))
|
|
1036 (setq list (cons (cons (read (current-buffer))
|
|
1037 (buffer-substring (match-beginning 1)
|
|
1038 (match-end 1)))
|
|
1039 list))
|
|
1040 (goto-char (1+ (match-end 0))))
|
|
1041 (setq list (nreverse list)
|
|
1042 list (cdr list)))
|
|
1043 (while list
|
|
1044 (message "Searching subfile %s..." (cdr (car list)))
|
|
1045 (Info-read-subfile (car (car list)))
|
|
1046 (setq list (cdr list))
|
|
1047 (goto-char (point-min))
|
|
1048 (if (re-search-forward regexp nil t)
|
|
1049 (setq found (point) list ())))
|
|
1050 (if found
|
|
1051 (message "")
|
|
1052 (signal 'search-failed (list regexp))))
|
|
1053 (if (not found)
|
|
1054 (progn (Info-read-subfile opoint)
|
|
1055 (goto-char opoint)
|
|
1056 (Info-select-node)))))
|
|
1057 (widen)
|
|
1058 (goto-char found)
|
|
1059 (Info-select-node)
|
|
1060 (or (and (equal onode Info-current-node)
|
|
1061 (equal ofile Info-current-file))
|
|
1062 (Info-history-add ofile onode opoint)))))
|
0
|
1063
|
|
1064 ;; Extract the value of the node-pointer named NAME.
|
|
1065 ;; If there is none, use ERRORNAME in the error message;
|
|
1066 ;; if ERRORNAME is nil, just return nil.
|
|
1067 (defun Info-extract-pointer (name &optional errorname)
|
|
1068 (save-excursion
|
|
1069 (goto-char (point-min))
|
|
1070 (forward-line 1)
|
|
1071 (let ((case-fold-search t))
|
|
1072 (if (re-search-backward (concat name ":") nil t)
|
|
1073 (progn
|
|
1074 (goto-char (match-end 0))
|
|
1075 (Info-following-node-name))
|
|
1076 (if (eq errorname t)
|
|
1077 nil
|
|
1078 (error (concat "Node has no " (capitalize (or errorname name)))))))))
|
|
1079
|
|
1080 ;; Return the node name in the buffer following point.
|
|
1081 ;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
|
|
1082 ;; saying which chas may appear in the node name.
|
|
1083 (defun Info-following-node-name (&optional allowedchars)
|
|
1084 (skip-chars-forward " \t")
|
|
1085 (buffer-substring
|
|
1086 (point)
|
|
1087 (progn
|
|
1088 (while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
|
|
1089 (skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
|
|
1090 (if (looking-at "(")
|
|
1091 (skip-chars-forward "^)")))
|
|
1092 (skip-chars-backward " ")
|
|
1093 (point))))
|
|
1094
|
|
1095 (defun Info-next (&optional n)
|
|
1096 "Go to the next node of this node.
|
|
1097 A positive or negative prefix argument moves by multiple nodes."
|
|
1098 (interactive "p")
|
|
1099 (or n (setq n 1))
|
|
1100 (if (< n 0)
|
|
1101 (Info-prev (- n))
|
|
1102 (while (>= (setq n (1- n)) 0)
|
|
1103 (Info-goto-node (Info-extract-pointer "next")))))
|
|
1104
|
|
1105 (defun Info-prev (&optional n)
|
|
1106 "Go to the previous node of this node.
|
|
1107 A positive or negative prefix argument moves by multiple nodes."
|
|
1108 (interactive "p")
|
|
1109 (or n (setq n 1))
|
|
1110 (if (< n 0)
|
|
1111 (Info-next (- n))
|
|
1112 (while (>= (setq n (1- n)) 0)
|
|
1113 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous")))))
|
|
1114
|
|
1115 (defun Info-up (&optional n)
|
|
1116 "Go to the superior node of this node.
|
|
1117 A positive prefix argument moves up several times."
|
|
1118 (interactive "p")
|
|
1119 (or n (setq n 1))
|
|
1120 (while (>= (setq n (1- n)) 0)
|
|
1121 (Info-goto-node (Info-extract-pointer "up")))
|
|
1122 (if (interactive-p) (Info-restore-point)))
|
|
1123
|
|
1124 (defun Info-last (&optional n)
|
|
1125 "Go back to the last node visited.
|
|
1126 With a prefix argument, go to Nth most recently visited node. History is
|
|
1127 circular; after oldest node, history comes back around to most recent one.
|
|
1128 Argument can be negative to go through the circle in the other direction.
|
|
1129 \(In other words, `l' is like \"undo\" and `C-u - l' is like \"redo\".)"
|
|
1130 (interactive "p")
|
|
1131 (or n (setq n 1))
|
|
1132 (or Info-history
|
|
1133 (error "This is the first Info node you looked at"))
|
|
1134 (let ((len (1+ (length Info-history))))
|
|
1135 (setq n (% (+ n (* len 100)) len)))
|
|
1136 (if (> n 0)
|
|
1137 (let ((entry (nth (1- n) Info-history)))
|
|
1138 (Info-history-add Info-current-file Info-current-node (point))
|
|
1139 (while (>= (setq n (1- n)) 0)
|
|
1140 (setq Info-history (nconc (cdr Info-history)
|
|
1141 (list (car Info-history)))))
|
|
1142 (setq Info-history (cdr Info-history))
|
|
1143 (let ((Info-keeping-history nil))
|
|
1144 (Info-goto-node (car entry)))
|
|
1145 (Info-restore-history-entry entry))))
|
|
1146
|
|
1147 (defun Info-directory ()
|
|
1148 "Go to the Info directory node."
|
|
1149 (interactive)
|
|
1150 (Info-find-node "dir" "top"))
|
|
1151
|
|
1152 (defun Info-follow-reference (footnotename)
|
|
1153 "Follow cross reference named NAME to the node it refers to.
|
|
1154 NAME may be an abbreviation of the reference name."
|
|
1155 (interactive
|
|
1156 (let ((completion-ignore-case t)
|
|
1157 completions default (start-point (point)) str i)
|
|
1158 (save-excursion
|
|
1159 (goto-char (point-min))
|
|
1160 (while (re-search-forward (format "\\*%s[ \n\t]*\\([^:]*\\):"
|
|
1161 Info-footnote-tag)
|
|
1162 nil t)
|
|
1163 (setq str (buffer-substring
|
|
1164 (match-beginning 1)
|
|
1165 (1- (point))))
|
|
1166 ;; See if this one should be the default.
|
|
1167 (and (null default)
|
|
1168 (< (match-beginning 0) start-point)
|
|
1169 (<= start-point (point))
|
|
1170 (setq default t))
|
|
1171 (setq i 0)
|
|
1172 (while (setq i (string-match "[ \n\t]+" str i))
|
|
1173 (setq str (concat (substring str 0 i) " "
|
|
1174 (substring str (match-end 0))))
|
|
1175 (setq i (1+ i)))
|
|
1176 ;; Record as a completion and perhaps as default.
|
|
1177 (if (eq default t) (setq default str))
|
|
1178 (setq completions
|
|
1179 (cons (cons str nil)
|
|
1180 completions))))
|
|
1181 (if completions
|
|
1182 (let ((item (completing-read (if default
|
|
1183 (concat "Follow reference named: ("
|
|
1184 default ") ")
|
|
1185 "Follow reference named: ")
|
|
1186 completions nil t)))
|
|
1187 (if (and (string= item "") default)
|
|
1188 (list default)
|
|
1189 (list item)))
|
|
1190 (error "No cross-references in this node"))))
|
|
1191 (let (target i (str (concat "\\*" Info-footnote-tag " "
|
|
1192 (regexp-quote footnotename))))
|
|
1193 (while (setq i (string-match " " str i))
|
|
1194 (setq str (concat (substring str 0 i) "\\([ \t\n]+\\)"
|
|
1195 (substring str (1+ i))))
|
|
1196 (setq i (+ i 10)))
|
|
1197 (save-excursion
|
|
1198 (goto-char (point-min))
|
|
1199 (or (re-search-forward str nil t)
|
|
1200 (error "No cross-reference named %s" footnotename))
|
|
1201 (goto-char (match-end 1))
|
|
1202 (setq target
|
|
1203 (Info-extract-menu-node-name "Bad format cross reference" t)))
|
|
1204 (while (setq i (string-match "[ \t\n]+" target i))
|
|
1205 (setq target (concat (substring target 0 i) " "
|
|
1206 (substring target (match-end 0))))
|
|
1207 (setq i (+ i 1)))
|
|
1208 (Info-goto-node target)
|
|
1209 (setq Info-in-cross-reference t)))
|
|
1210
|
|
1211 (defun Info-next-reference (n)
|
|
1212 (interactive "p")
|
|
1213 (let ((pat (format "\\*%s[ \n\t]*\\([^:]*\\):\\|^\\* .*:\\|<<.*>>"
|
|
1214 Info-footnote-tag))
|
|
1215 (case-fold-search nil)
|
|
1216 (old-pt (point)))
|
|
1217 (while (< n 0)
|
|
1218 (save-excursion
|
|
1219 (goto-char (point-min))
|
|
1220 (while (re-search-forward pat nil t)
|
|
1221 (setq n (1+ n)))
|
|
1222 (goto-char (point-min))
|
|
1223 (if (re-search-forward "^\\* Menu:" nil t)
|
|
1224 (setq n (1- n)))))
|
|
1225 (while (>= (setq n (1- n)) 0)
|
|
1226 (or (eobp) (forward-char 1))
|
|
1227 (or (re-search-forward pat nil t)
|
|
1228 (progn
|
|
1229 (goto-char (point-min))
|
|
1230 (or (re-search-forward pat nil t)
|
|
1231 (progn
|
|
1232 (goto-char old-pt)
|
|
1233 (error "No cross references in this node")))))
|
|
1234 (goto-char (match-beginning 0))
|
|
1235 (if (looking-at "\\* Menu:")
|
|
1236 (setq n (1+ n))))))
|
|
1237
|
|
1238 (defun Info-prev-reference (n)
|
|
1239 (interactive "p")
|
|
1240 (Info-next-reference (- n)))
|
|
1241
|
|
1242 (defun Info-extract-menu-node-name (&optional errmessage multi-line)
|
|
1243 (skip-chars-forward " \t\n")
|
|
1244 (let ((beg (point))
|
|
1245 str i)
|
|
1246 (skip-chars-forward "^:")
|
|
1247 (forward-char 1)
|
|
1248 (setq str
|
|
1249 (if (looking-at ":")
|
|
1250 (buffer-substring beg (1- (point)))
|
|
1251 (skip-chars-forward " \t\n")
|
|
1252 (Info-following-node-name (if multi-line "^.,\t" "^.,\t\n"))))
|
|
1253 (while (setq i (string-match "\n" str i))
|
|
1254 (aset str i ?\ ))
|
|
1255 str))
|
|
1256
|
|
1257 (defun Info-menu (menu-item)
|
|
1258 "Go to node for menu item named (or abbreviated) NAME.
|
|
1259 Completion is allowed, and the menu item point is on is the default."
|
|
1260 (interactive
|
|
1261 (let ((completions '())
|
|
1262 ;; If point is within a menu item, use that item as the default
|
|
1263 (default nil)
|
|
1264 (p (point))
|
|
1265 (last nil))
|
|
1266 (save-excursion
|
|
1267 (goto-char (point-min))
|
|
1268 (let ((case-fold-search t))
|
|
1269 (if (not (search-forward "\n* menu:" nil t))
|
|
1270 (error "No menu in this node")))
|
|
1271 (while (re-search-forward
|
|
1272 "\n\\* \\([^:\t\n]*\\):" nil t)
|
|
1273 (if (and (null default)
|
|
1274 (prog1 (if last (< last p) nil)
|
|
1275 (setq last (match-beginning 0)))
|
|
1276 (<= p last))
|
|
1277 (setq default (car (car completions))))
|
|
1278 (setq completions (cons (cons (buffer-substring
|
|
1279 (match-beginning 1)
|
|
1280 (match-end 1))
|
|
1281 (match-beginning 1))
|
|
1282 completions)))
|
|
1283 (if (and (null default) last
|
|
1284 (< last p)
|
|
1285 (<= p (progn (end-of-line) (point))))
|
|
1286 (setq default (car (car completions)))))
|
|
1287 (let ((item nil))
|
|
1288 (while (null item)
|
|
1289 (setq item (let ((completion-ignore-case t))
|
|
1290 (completing-read (if default
|
|
1291 (format "Menu item (default %s): "
|
|
1292 default)
|
|
1293 "Menu item: ")
|
|
1294 completions nil t)))
|
|
1295 ;; we rely on the fact that completing-read accepts an input
|
|
1296 ;; of "" even when the require-match argument is true and ""
|
|
1297 ;; is not a valid possibility
|
|
1298 (if (string= item "")
|
|
1299 (if default
|
|
1300 (setq item default)
|
|
1301 ;; ask again
|
|
1302 (setq item nil))))
|
|
1303 (list item))))
|
|
1304 ;; there is a problem here in that if several menu items have the same
|
|
1305 ;; name you can only go to the node of the first with this command.
|
|
1306 (Info-goto-node (Info-extract-menu-item menu-item) nil t))
|
|
1307
|
|
1308 (defun Info-extract-menu-item (menu-item &optional noerror)
|
|
1309 (save-excursion
|
|
1310 (goto-char (point-min))
|
|
1311 (if (let ((case-fold-search t))
|
|
1312 (search-forward "\n* menu:" nil t))
|
|
1313 (if (or (search-forward (concat "\n* " menu-item ":") nil t)
|
|
1314 (search-forward (concat "\n* " menu-item) nil t))
|
|
1315 (progn
|
|
1316 (beginning-of-line)
|
|
1317 (forward-char 2)
|
|
1318 (Info-extract-menu-node-name))
|
|
1319 (and (not noerror) (error "No such item in menu")))
|
|
1320 (and (not noerror) (error "No menu in this node")))))
|
|
1321
|
|
1322 ;; If COUNT is nil, use the last item in the menu.
|
|
1323 (defun Info-extract-menu-counting (count &optional noerror noindex)
|
|
1324 (save-excursion
|
|
1325 (goto-char (point-min))
|
|
1326 (if (let ((case-fold-search t))
|
|
1327 (and (search-forward "\n* menu:" nil t)
|
|
1328 (or (not noindex)
|
|
1329 (not (string-match "\\<Index\\>" Info-current-node)))))
|
|
1330 (if (search-forward "\n* " nil t count)
|
|
1331 (progn
|
|
1332 (or count
|
|
1333 (while (search-forward "\n* " nil t)))
|
|
1334 (Info-extract-menu-node-name))
|
|
1335 (and (not noerror) (error "Too few items in menu")))
|
|
1336 (and (not noerror) (error "No menu in this node")))))
|
|
1337
|
|
1338 (defun Info-nth-menu-item (n)
|
|
1339 "Go to the node of the Nth menu item."
|
|
1340 (interactive "P")
|
|
1341 (or n (setq n (- last-command-char ?0)))
|
|
1342 (if (< n 1) (error "Index must be at least 1"))
|
|
1343 (Info-goto-node (Info-extract-menu-counting n) nil t))
|
|
1344
|
|
1345 (defun Info-last-menu-item ()
|
|
1346 "Go to the node of the tenth menu item."
|
|
1347 (interactive)
|
|
1348 (Info-goto-node (Info-extract-menu-counting nil) nil t))
|
|
1349
|
|
1350 (defun Info-top ()
|
|
1351 "Go to the Top node of this file."
|
|
1352 (interactive)
|
|
1353 (Info-goto-node "Top"))
|
|
1354
|
|
1355 (defun Info-end ()
|
|
1356 "Go to the final node in this file."
|
|
1357 (interactive)
|
|
1358 (Info-top)
|
|
1359 (let ((Info-keeping-history nil)
|
|
1360 node)
|
|
1361 (Info-last-menu-item)
|
|
1362 (while (setq node (or (Info-extract-pointer "next" t)
|
|
1363 (Info-extract-menu-counting nil t t)))
|
|
1364 (Info-goto-node node))
|
|
1365 (or (equal (Info-extract-pointer "up" t) "Top")
|
|
1366 (let ((executing-kbd-macro "")) ; suppress messages
|
|
1367 (condition-case nil
|
|
1368 (Info-global-next 10000)
|
|
1369 (error nil))))))
|
|
1370
|
|
1371 (defun Info-global-next (&optional n)
|
|
1372 "Go to the next node in this file, traversing node structure as necessary.
|
|
1373 This works only if the Info file is structured as a hierarchy of nodes.
|
|
1374 A positive or negative prefix argument moves by multiple nodes."
|
|
1375 (interactive "p")
|
|
1376 (or n (setq n 1))
|
|
1377 (if (< n 0)
|
|
1378 (Info-global-prev (- n))
|
|
1379 (while (>= (setq n (1- n)) 0)
|
|
1380 (let (node)
|
|
1381 (cond ((and (string-match "^Top$" Info-current-node)
|
|
1382 (setq node (Info-extract-pointer "next" t))
|
|
1383 (Info-extract-menu-item node t))
|
|
1384 (Info-goto-node node))
|
|
1385 ((setq node (Info-extract-menu-counting 1 t t))
|
|
1386 (message "Going down...")
|
|
1387 (Info-goto-node node))
|
|
1388 (t
|
|
1389 (let ((Info-keeping-history Info-keeping-history)
|
|
1390 (orignode Info-current-node)
|
|
1391 (ups ""))
|
|
1392 (while (not (Info-extract-pointer "next" t))
|
|
1393 (if (and (setq node (Info-extract-pointer "up" t))
|
|
1394 (not (equal node "Top")))
|
|
1395 (progn
|
|
1396 (message "Going%s..." (setq ups (concat ups " up")))
|
|
1397 (Info-goto-node node)
|
|
1398 (setq Info-keeping-history nil))
|
|
1399 (if orignode
|
|
1400 (let ((Info-keeping-history nil))
|
|
1401 (Info-goto-node orignode)))
|
|
1402 (error "Last node in file")))
|
|
1403 (Info-next))))))))
|
|
1404
|
|
1405 (defun Info-page-next (&optional n)
|
|
1406 "Scroll forward one screenful, or go to next global node.
|
|
1407 A positive or negative prefix argument moves by multiple screenfuls."
|
|
1408 (interactive "p")
|
|
1409 (or n (setq n 1))
|
|
1410 (if (< n 0)
|
|
1411 (Info-page-prev (- n))
|
|
1412 (while (>= (setq n (1- n)) 0)
|
|
1413 (if (pos-visible-in-window-p (point-max))
|
|
1414 (progn
|
|
1415 (Info-global-next)
|
|
1416 (message "Node: %s" Info-current-node))
|
|
1417 (scroll-up)))))
|
|
1418
|
|
1419 (defun Info-scroll-next (arg)
|
|
1420 (interactive "P")
|
|
1421 (if Info-auto-advance
|
|
1422 (if (and (pos-visible-in-window-p (point-max))
|
|
1423 (not (eq Info-auto-advance t))
|
|
1424 (not (eq last-command this-command)))
|
|
1425 (message "Hit %s again to go to next node"
|
|
1426 (if (= last-command-char 0)
|
|
1427 "mouse button"
|
|
1428 (key-description (char-to-string last-command-char))))
|
|
1429 (Info-page-next)
|
|
1430 (setq this-command 'Info))
|
|
1431 (scroll-up arg)))
|
|
1432
|
|
1433 (defun Info-global-prev (&optional n)
|
|
1434 "Go to the previous node in this file, traversing structure as necessary.
|
|
1435 This works only if the Info file is structured as a hierarchy of nodes.
|
|
1436 A positive or negative prefix argument moves by multiple nodes."
|
|
1437 (interactive "p")
|
|
1438 (or n (setq n 1))
|
|
1439 (if (< n 0)
|
|
1440 (Info-global-next (- n))
|
|
1441 (while (>= (setq n (1- n)) 0)
|
|
1442 (let ((upnode (Info-extract-pointer "up" t))
|
|
1443 (prevnode (Info-extract-pointer "prev[ious]*" t)))
|
|
1444 (if (or (not prevnode)
|
|
1445 (equal prevnode upnode))
|
|
1446 (if (string-match "^Top$" Info-current-node)
|
|
1447 (error "First node in file")
|
|
1448 (message "Going up...")
|
|
1449 (Info-up))
|
|
1450 (Info-goto-node prevnode)
|
|
1451 (let ((downs "")
|
|
1452 (Info-keeping-history nil)
|
|
1453 node)
|
|
1454 (while (setq node (Info-extract-menu-counting nil t t))
|
|
1455 (message "Going%s..." (setq downs (concat downs " down")))
|
|
1456 (Info-goto-node node))))))))
|
|
1457
|
|
1458 (defun Info-page-prev (&optional n)
|
|
1459 "Scroll backward one screenful, or go to previous global node.
|
|
1460 A positive or negative prefix argument moves by multiple screenfuls."
|
|
1461 (interactive "p")
|
|
1462 (or n (setq n 1))
|
|
1463 (if (< n 0)
|
|
1464 (Info-page-next (- n))
|
|
1465 (while (>= (setq n (1- n)) 0)
|
|
1466 (if (pos-visible-in-window-p (point-min))
|
|
1467 (progn
|
|
1468 (Info-global-prev)
|
|
1469 (message "Node: %s" Info-current-node)
|
|
1470 (sit-for 0)
|
|
1471 ;;(scroll-up 1) ; work around bug in pos-visible-in-window-p
|
|
1472 ;;(scroll-down 1)
|
|
1473 (while (not (pos-visible-in-window-p (point-max)))
|
|
1474 (scroll-up)))
|
|
1475 (scroll-down)))))
|
|
1476
|
|
1477 (defun Info-scroll-prev (arg)
|
|
1478 (interactive "P")
|
|
1479 (if Info-auto-advance
|
|
1480 (if (and (pos-visible-in-window-p (point-min))
|
|
1481 (not (eq Info-auto-advance t))
|
|
1482 (not (eq last-command this-command)))
|
|
1483 (message "Hit %s again to go to previous node"
|
|
1484 (if (= last-command-char 0)
|
|
1485 "mouse button"
|
|
1486 (key-description (char-to-string last-command-char))))
|
|
1487 (Info-page-prev)
|
|
1488 (setq this-command 'Info))
|
|
1489 (scroll-down arg)))
|
|
1490
|
|
1491 (defun Info-index (topic)
|
|
1492 "Look up a string in the index for this file.
|
|
1493 The index is defined as the first node in the top-level menu whose
|
|
1494 name contains the word \"Index\", plus any immediately following
|
|
1495 nodes whose names also contain the word \"Index\".
|
|
1496 If there are no exact matches to the specified topic, this chooses
|
|
1497 the first match which is a case-insensitive substring of a topic.
|
|
1498 Use the `,' command to see the other matches.
|
|
1499 Give a blank topic name to go to the Index node itself."
|
|
1500 (interactive "sIndex topic: ")
|
|
1501 (let ((pattern (format "\n\\* \\([^\n:]*%s[^\n:]*\\):[ \t]*%s"
|
|
1502 (regexp-quote topic)
|
|
1503 "\\([^.\n]*\\)\\.[ t]*\\([0-9]*\\)"))
|
|
1504 node)
|
|
1505 (message "Searching index for `%s'..." topic)
|
|
1506 (Info-goto-node "Top")
|
|
1507 (let ((case-fold-search t))
|
|
1508 (or (search-forward "\n* menu:" nil t)
|
|
1509 (error "No index"))
|
|
1510 (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
|
|
1511 (error "No index")))
|
|
1512 (goto-char (match-beginning 1))
|
|
1513 (let ((Info-keeping-history nil)
|
|
1514 (Info-fontify (and Info-fontify (equal topic ""))))
|
|
1515 (Info-goto-node (Info-extract-menu-node-name)))
|
|
1516 (or (equal topic "")
|
|
1517 (let ((matches nil)
|
|
1518 (exact nil)
|
|
1519 (Info-keeping-history nil)
|
|
1520 found)
|
|
1521 (while
|
|
1522 (progn
|
|
1523 (goto-char (point-min))
|
|
1524 (while (re-search-forward pattern nil t)
|
|
1525 (setq matches
|
|
1526 (cons (list (buffer-substring (match-beginning 1)
|
|
1527 (match-end 1))
|
|
1528 (buffer-substring (match-beginning 2)
|
|
1529 (match-end 2))
|
|
1530 Info-current-node
|
|
1531 (string-to-int (concat "0"
|
|
1532 (buffer-substring
|
|
1533 (match-beginning 3)
|
|
1534 (match-end 3)))))
|
|
1535 matches)))
|
|
1536 (and (setq node (Info-extract-pointer "next" t))
|
|
1537 (string-match "\\<Index\\>" node)))
|
|
1538 (let ((Info-fontify nil))
|
|
1539 (Info-goto-node node)))
|
|
1540 (or matches
|
|
1541 (progn
|
|
1542 (Info-last)
|
|
1543 (error "No \"%s\" in index" topic)))
|
|
1544 ;; Here it is a feature that assoc is case-sensitive.
|
|
1545 (while (setq found (assoc topic matches))
|
|
1546 (setq exact (cons found exact)
|
|
1547 matches (delq found matches)))
|
|
1548 (setq Info-index-alternatives (nconc exact (nreverse matches))
|
|
1549 Info-index-first-alternative (car Info-index-alternatives))
|
|
1550 (Info-index-next 0)))))
|
|
1551
|
|
1552 (defun Info-index-next (num)
|
|
1553 "Go to the next matching index item from the last `i' command."
|
|
1554 (interactive "p")
|
|
1555 (or Info-index-alternatives
|
|
1556 (error "No previous `i' command in this file"))
|
|
1557 (while (< num 0)
|
|
1558 (setq num (+ num (length Info-index-alternatives))))
|
|
1559 (while (> num 0)
|
|
1560 (setq Info-index-alternatives
|
|
1561 (nconc (cdr Info-index-alternatives)
|
|
1562 (list (car Info-index-alternatives)))
|
|
1563 num (1- num)))
|
|
1564 (Info-goto-node (nth 1 (car Info-index-alternatives)))
|
|
1565 (if (> (nth 3 (car Info-index-alternatives)) 0)
|
|
1566 (forward-line (nth 3 (car Info-index-alternatives)))
|
|
1567 (forward-line 3) ; don't search in headers
|
|
1568 (let ((name (car (car Info-index-alternatives))))
|
|
1569 (if (or (re-search-forward (format
|
|
1570 "\\(Function\\|Command\\): %s\\( \\|$\\)"
|
|
1571 (regexp-quote name)) nil t)
|
|
1572 (re-search-forward (format "^`%s[ ']" (regexp-quote name)) nil t)
|
|
1573 (search-forward (format "`%s'" name) nil t)
|
|
1574 (and (string-match "\\`.*\\( (.*)\\)\\'" name)
|
|
1575 (search-forward
|
|
1576 (format "`%s'" (substring name 0 (match-beginning 1)))
|
|
1577 nil t))
|
|
1578 (search-forward name nil t))
|
|
1579 (beginning-of-line)
|
|
1580 (goto-char (point-min)))))
|
|
1581 (message "Found \"%s\" in %s. %s"
|
|
1582 (car (car Info-index-alternatives))
|
|
1583 (nth 2 (car Info-index-alternatives))
|
|
1584 (if (cdr Info-index-alternatives)
|
|
1585 (if (eq (car (cdr Info-index-alternatives))
|
|
1586 Info-index-first-alternative)
|
|
1587 "(Press `,' to repeat)"
|
|
1588 (format "(Press `,' for %d more)"
|
|
1589 (- (1- (length Info-index-alternatives))
|
|
1590 (length (memq Info-index-first-alternative
|
|
1591 (cdr Info-index-alternatives))))))
|
|
1592 "(Only match)")))
|
|
1593
|
|
1594
|
|
1595 ;;;###autoload
|
|
1596 (defun Info-emacs-command (command)
|
|
1597 "Look up an Emacs command in the Emacs manual in the Info system.
|
|
1598 This command is designed to be used whether you are already in Info or not."
|
|
1599 (interactive "CLook up command in Emacs manual: ")
|
|
1600 (save-window-excursion
|
|
1601 (info)
|
|
1602 (Info-find-node Info-emacs-info-file-name "Top")
|
|
1603 (Info-index (symbol-name command)))
|
|
1604 (pop-to-buffer "*info*"))
|
|
1605
|
|
1606 ;;;###autoload
|
|
1607 (defun Info-goto-emacs-command-node (key)
|
|
1608 "Look up an Emacs command in the Emacs manual in the Info system.
|
|
1609 This command is designed to be used whether you are already in Info or not."
|
|
1610 (interactive "CLook up command in Emacs manual: ")
|
|
1611 (Info-emacs-command key))
|
|
1612
|
|
1613 ;;;###autoload
|
|
1614 (defun Info-goto-emacs-key-command-node (key)
|
|
1615 "Look up an Emacs key sequence in the Emacs manual in the Info system.
|
|
1616 This command is designed to be used whether you are already in Info or not."
|
|
1617 (interactive "kLook up key in Emacs manual: ")
|
|
1618 (let ((command (key-binding key)))
|
|
1619 (cond ((eq command 'keyboard-quit)
|
|
1620 (keyboard-quit))
|
|
1621 ((null command)
|
|
1622 (error "%s is undefined" (key-description key)))
|
|
1623 ((and (interactive-p) (eq command 'execute-extended-command))
|
|
1624 (call-interactively 'Info-goto-emacs-command-node))
|
|
1625 (t
|
|
1626 (Info-goto-emacs-command-node command)))))
|
|
1627
|
|
1628 ;;;###autoload
|
|
1629 (defun Info-emacs-key (key)
|
|
1630 "Look up an Emacs key sequence in the Emacs manual in the Info system.
|
|
1631 This command is designed to be used whether you are already in Info or not."
|
|
1632 (interactive "kLook up key in Emacs manual: ")
|
|
1633 (cond ((eq (key-binding key) 'keyboard-quit)
|
|
1634 (keyboard-quit))
|
|
1635 ((and (interactive-p) (eq (key-binding key) 'execute-extended-command))
|
|
1636 (call-interactively 'Info-goto-emacs-command-node))
|
|
1637 (t
|
|
1638 (save-window-excursion
|
|
1639 (info)
|
|
1640 (Info-find-node Info-emacs-info-file-name "Top")
|
|
1641 (setq key (key-description key))
|
|
1642 (let (p)
|
|
1643 (if (setq p (string-match "[@{}]" key))
|
|
1644 (setq key (concat (substring key 0 p) "@" (substring key p))))
|
|
1645 (if (string-match "^ESC " key)
|
|
1646 (setq key (concat "M-" (substring key 4))))
|
|
1647 (if (string-match "^M-C-" key)
|
|
1648 (setq key (concat "C-M-" (substring key 4)))))
|
|
1649 (Info-index key))
|
|
1650 (pop-to-buffer "*info*"))))
|
|
1651
|
|
1652 ;;;###autoload
|
|
1653 (defun Info-elisp-ref (func)
|
|
1654 "Look up an Emacs Lisp function in the Elisp manual in the Info system.
|
|
1655 This command is designed to be used whether you are already in Info or not."
|
|
1656 (interactive (let ((fn (function-called-at-point))
|
|
1657 (enable-recursive-minibuffers t)
|
|
1658 val)
|
|
1659 (setq val (completing-read
|
|
1660 (format "Look up Emacs Lisp function%s: "
|
|
1661 (if fn
|
|
1662 (format " (default %s)" fn)
|
|
1663 ""))
|
|
1664 obarray 'fboundp t))
|
|
1665 (list (if (equal val "")
|
|
1666 fn (intern val)))))
|
|
1667 (save-window-excursion
|
|
1668 (info)
|
|
1669 (condition-case nil
|
116
|
1670 (Info-find-node "lispref" "Top")
|
|
1671 (error (Info-find-node "elisp" "Top")))
|
0
|
1672 (Info-index (symbol-name func)))
|
|
1673 (pop-to-buffer "*info*"))
|
|
1674
|
|
1675 (defun Info-reannotate-node ()
|
|
1676 (let ((bufs (delq nil (mapcar 'get-file-buffer Info-annotations-path))))
|
|
1677 (if bufs
|
|
1678 (let ((ibuf (current-buffer))
|
|
1679 (file (concat "\\(" (regexp-quote
|
|
1680 (file-name-nondirectory Info-current-file))
|
|
1681 "\\|" (regexp-quote Info-current-file) "\\)"))
|
|
1682 (node (regexp-quote Info-current-node))
|
|
1683 (savept (point)))
|
|
1684 (goto-char (point-min))
|
|
1685 (if (search-forward "\n------ NOTE:\n" nil t)
|
|
1686 (let ((buffer-read-only nil)
|
|
1687 (bufmod (buffer-modified-p))
|
|
1688 top)
|
|
1689 (setq savept (copy-marker savept))
|
|
1690 (goto-char (point-min))
|
|
1691 (while (search-forward "\n------ NOTE:" nil t)
|
|
1692 (setq top (1+ (match-beginning 0)))
|
|
1693 (if (search-forward "\n------\n" nil t)
|
|
1694 (delete-region top (point)))
|
|
1695 (backward-char 1))
|
|
1696 (set-buffer-modified-p bufmod)))
|
|
1697 (save-excursion
|
|
1698 (while bufs
|
|
1699 (set-buffer (car bufs))
|
|
1700 (goto-char (point-min))
|
|
1701 (while (re-search-forward
|
|
1702 (format
|
|
1703 "------ *File: *%s *Node: *%s *Line: *\\([0-9]+\\) *\n"
|
|
1704 file node)
|
|
1705 nil t)
|
|
1706 (let ((line (string-to-int
|
|
1707 (buffer-substring (match-beginning 2)
|
|
1708 (match-end 2))))
|
|
1709 (top (point))
|
|
1710 bot)
|
|
1711 (search-forward "\n------\n" nil t)
|
|
1712 (setq bot (point))
|
|
1713 (save-excursion
|
|
1714 (set-buffer ibuf)
|
|
1715 (if (integerp savept) (setq savept (copy-marker savept)))
|
|
1716 (if (= line 0)
|
|
1717 (goto-char (point-max))
|
|
1718 (goto-char (point-min))
|
|
1719 (forward-line line))
|
|
1720 (let ((buffer-read-only nil)
|
|
1721 (bufmod (buffer-modified-p)))
|
|
1722 (insert "------ NOTE:\n")
|
|
1723 (insert-buffer-substring (car bufs) top bot)
|
|
1724 (set-buffer-modified-p bufmod)))))
|
|
1725 (setq bufs (cdr bufs))))
|
|
1726 (goto-char savept)))))
|
|
1727
|
|
1728 (defvar Info-annotate-map nil
|
|
1729 "Local keymap used within `a' command of Info.")
|
|
1730 (if Info-annotate-map
|
|
1731 nil
|
|
1732 ;; (setq Info-annotate-map (nconc (make-sparse-keymap) text-mode-map))
|
|
1733 (setq Info-annotate-map (copy-keymap text-mode-map))
|
|
1734 (define-key Info-annotate-map "\C-c\C-c" 'Info-cease-annotate))
|
|
1735
|
|
1736 (defun Info-annotate-mode ()
|
|
1737 "Major mode for adding an annotation to an Info node.
|
|
1738 Like text mode with the addition of Info-cease-annotate
|
|
1739 which returns to Info mode for browsing.
|
|
1740 \\{Info-annotate-map}")
|
|
1741
|
|
1742 (defun Info-annotate (arg)
|
|
1743 "Add a personal annotation to the current Info node.
|
|
1744 Only you will be able to see this annotation.
|
|
1745 Annotations are stored in the file ~/.infonotes by default.
|
|
1746 If point is inside an existing annotation, edit that annotation.
|
|
1747 A prefix argument specifies which annotations file (from
|
|
1748 Info-annotations-path) is to be edited; default is 1."
|
|
1749 (interactive "p")
|
|
1750 (setq arg (1- arg))
|
|
1751 (if (or (< arg 0) (not (nth arg Info-annotations-path)))
|
|
1752 (if (= arg 0)
|
|
1753 (setq Info-annotations-path
|
|
1754 (list (read-file-name
|
|
1755 "Annotations file: " "~/" "~/.infonotes")))
|
|
1756 (error "File number must be in the range from 1 to %d"
|
|
1757 (length Info-annotations-path))))
|
|
1758 (let ((which nil)
|
|
1759 (file (file-name-nondirectory Info-current-file))
|
|
1760 (d Info-directory-list)
|
|
1761 where pt)
|
|
1762 (while (and d (not (equal (expand-file-name file (car d))
|
|
1763 Info-current-file)))
|
|
1764 (setq d (cdr d)))
|
|
1765 (or d (setq file Info-current-file))
|
|
1766 (if (and (save-excursion
|
|
1767 (goto-char (min (point-max) (+ (point) 13)))
|
|
1768 (and (search-backward "------ NOTE:\n" nil t)
|
|
1769 (setq pt (match-end 0))
|
|
1770 (search-forward "\n------\n" nil t)))
|
|
1771 (< (point) (match-end 0)))
|
|
1772 (setq which (format "File: *%s *Node: *%s *Line:.*\n%s"
|
|
1773 (regexp-quote file)
|
|
1774 (regexp-quote Info-current-node)
|
|
1775 (regexp-quote
|
|
1776 (buffer-substring pt (match-beginning 0))))
|
|
1777 where (max (- (point) pt) 0)))
|
|
1778 (let ((node Info-current-node)
|
|
1779 (line (if (looking-at "[ \n]*\\'") 0
|
|
1780 (count-lines (point-min) (point)))))
|
|
1781 (or which
|
|
1782 (let ((buffer-read-only nil)
|
|
1783 (bufmod (buffer-modified-p)))
|
|
1784 (beginning-of-line)
|
|
1785 (if (bobp) (goto-char (point-max)))
|
|
1786 (insert "------ NOTE:\n------\n")
|
|
1787 (backward-char 20)
|
|
1788 (set-buffer-modified-p bufmod)))
|
|
1789 ;; (setq Info-window-start (window-start))
|
|
1790 (setq Info-window-configuration (current-window-configuration))
|
|
1791 (pop-to-buffer (find-file-noselect (nth arg Info-annotations-path)))
|
|
1792 (use-local-map Info-annotate-map)
|
|
1793 (setq major-mode 'Info-annotate-mode)
|
|
1794 (setq mode-name "Info Annotate")
|
|
1795 (if which
|
|
1796 (if (save-excursion
|
|
1797 (goto-char (point-min))
|
|
1798 (re-search-forward which nil t))
|
|
1799 (progn
|
|
1800 (goto-char (match-beginning 0))
|
|
1801 (forward-line 1)
|
|
1802 (forward-char where)))
|
|
1803 (let ((bufmod (buffer-modified-p)))
|
|
1804 (goto-char (point-max))
|
|
1805 (insert (format "\n------ File: %s Node: %s Line: %d\n"
|
|
1806 file node line))
|
|
1807 (setq pt (point))
|
|
1808 (insert "\n------\n"
|
|
1809 "\nPress C-c C-c to save and return to Info.\n")
|
|
1810 (goto-char pt)
|
|
1811 (set-buffer-modified-p bufmod))))))
|
|
1812
|
|
1813 (defun Info-cease-annotate ()
|
|
1814 (interactive)
|
|
1815 (let ((bufmod (buffer-modified-p)))
|
|
1816 (while (save-excursion
|
|
1817 (goto-char (point-min))
|
|
1818 (re-search-forward "\n\n?Press .* to save and return to Info.\n"
|
|
1819 nil t))
|
|
1820 (delete-region (1+ (match-beginning 0)) (match-end 0)))
|
|
1821 (while (save-excursion
|
|
1822 (goto-char (point-min))
|
|
1823 (re-search-forward "\n------ File:.*Node:.*Line:.*\n+------\n"
|
|
1824 nil t))
|
|
1825 (delete-region (match-beginning 0) (match-end 0)))
|
|
1826 (set-buffer-modified-p bufmod))
|
|
1827 (save-buffer)
|
|
1828 (fundamental-mode)
|
|
1829 (bury-buffer)
|
|
1830 (or (one-window-p) (delete-window))
|
|
1831 (info)
|
|
1832 (setq Info-current-annotation-completions nil)
|
|
1833 (set-window-configuration Info-window-configuration)
|
|
1834 (Info-reannotate-node))
|
|
1835
|
|
1836 (defun Info-bookmark (arg tag)
|
|
1837 (interactive "p\nsBookmark name: ")
|
|
1838 (Info-annotate arg)
|
|
1839 (if (or (string-match "^\"\\(.*\\)\"$" tag)
|
|
1840 (string-match "^<<\\(.*\\)>>$" tag))
|
|
1841 (setq tag (substring tag (match-beginning 1) (match-end 1))))
|
|
1842 (let ((pt (point)))
|
|
1843 (search-forward "\n------\n")
|
|
1844 (let ((end (- (point) 8)))
|
|
1845 (goto-char pt)
|
|
1846 (if (re-search-forward "<<[^>\n]*>>" nil t)
|
|
1847 (delete-region (match-beginning 0) (match-end 0))
|
|
1848 (goto-char end))
|
|
1849 (or (equal tag "")
|
|
1850 (insert "<<" tag ">>"))))
|
|
1851 (Info-cease-annotate))
|
|
1852
|
|
1853 (defun Info-exit ()
|
|
1854 "Exit Info by selecting some other buffer."
|
|
1855 (interactive)
|
|
1856 (if Info-standalone
|
|
1857 (save-buffers-kill-emacs)
|
98
|
1858 (bury-buffer (current-buffer))
|
|
1859 (if (and (featurep 'toolbar)
|
|
1860 (eq toolbar-info-frame (selected-frame)))
|
|
1861 (delete-frame toolbar-info-frame)
|
|
1862 (switch-to-buffer (other-buffer (current-buffer))))))
|
0
|
1863
|
|
1864 (defun Info-undefined ()
|
|
1865 "Make command be undefined in Info."
|
|
1866 (interactive)
|
|
1867 (ding))
|
|
1868
|
|
1869 (defun Info-help ()
|
|
1870 "Enter the Info tutorial."
|
|
1871 (interactive)
|
|
1872 (delete-other-windows)
|
|
1873 (Info-find-node "info"
|
|
1874 (if (< (window-height) 23)
|
|
1875 "Help-Small-Screen"
|
|
1876 "Help")))
|
|
1877
|
|
1878 (defun Info-summary ()
|
|
1879 "Display a brief summary of all Info commands."
|
|
1880 (interactive)
|
|
1881 (save-window-excursion
|
|
1882 (switch-to-buffer "*Help*")
|
|
1883 (erase-buffer)
|
|
1884 (insert (documentation 'Info-mode))
|
|
1885 (goto-char (point-min))
|
|
1886 (let (flag)
|
|
1887 (while (progn (setq flag (not (pos-visible-in-window-p (point-max))))
|
|
1888 (message (if flag "Type Space to see more"
|
|
1889 "Type Space to return to Info"))
|
|
1890 (let ((e (next-command-event)))
|
|
1891 (if (/= ?\ (event-to-character e))
|
|
1892 (progn (setq unread-command-event e) nil)
|
|
1893 flag)))
|
|
1894 (scroll-up)))
|
|
1895 (message "")
|
|
1896 (bury-buffer "*Help*")))
|
|
1897
|
|
1898 (defun Info-get-token (pos start all &optional errorstring)
|
|
1899 "Return the token around POS,
|
|
1900 POS must be somewhere inside the token
|
|
1901 START is a regular expression which will match the
|
|
1902 beginning of the tokens delimited string
|
|
1903 ALL is a regular expression with a single
|
|
1904 parenthized subpattern which is the token to be
|
|
1905 returned. E.g. '{\(.*\)}' would return any string
|
|
1906 enclosed in braces around POS.
|
|
1907 SIG optional fourth argument, controls action on no match
|
|
1908 nil: return nil
|
|
1909 t: beep
|
|
1910 a string: signal an error, using that string."
|
|
1911 (save-excursion
|
|
1912 (goto-char (point-min))
|
|
1913 (re-search-backward "\\`") ; Bug fix due to Nicholas J. Foskett.
|
|
1914 (goto-char pos)
|
|
1915 (re-search-backward start (max (point-min) (- pos 200)) 'yes)
|
|
1916 (let (found)
|
|
1917 (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes)
|
|
1918 (not (setq found (and (<= (match-beginning 0) pos)
|
|
1919 (> (match-end 0) pos))))))
|
|
1920 (if (and found (<= (match-beginning 0) pos)
|
|
1921 (> (match-end 0) pos))
|
|
1922 (buffer-substring (match-beginning 1) (match-end 1))
|
|
1923 (cond ((null errorstring)
|
|
1924 nil)
|
|
1925 ((eq errorstring t)
|
|
1926 (beep)
|
|
1927 nil)
|
|
1928 (t
|
|
1929 (error "No %s around position %d" errorstring pos)))))))
|
|
1930
|
|
1931 (defun Info-follow-clicked-node (event)
|
|
1932 "Follow a node reference near clicked point. Like M, F, N, P or U command.
|
|
1933 At end of the node's text, moves to the next node."
|
|
1934 (interactive "@e")
|
|
1935 (or (and (event-point event)
|
|
1936 (Info-follow-nearest-node
|
|
1937 (max (progn
|
|
1938 (select-window (event-window event))
|
|
1939 (event-point event))
|
|
1940 (1+ (point-min)))))
|
|
1941 (error "click on a cross-reference to follow")))
|
|
1942
|
|
1943 (defun Info-maybe-follow-clicked-node (event &optional click-count)
|
|
1944 "Follow a node reference (if any) near clicked point.
|
|
1945 Like M, F, N, P or U command. At end of the node's text, moves to the
|
|
1946 next node. No error is given if there is no node to follow."
|
|
1947 (interactive "@e")
|
|
1948 (and (event-point event)
|
|
1949 (Info-follow-nearest-node
|
|
1950 (max (progn
|
|
1951 (select-window (event-window event))
|
|
1952 (event-point event))
|
|
1953 (1+ (point-min))))))
|
|
1954
|
|
1955 (defun Info-find-nearest-node (point)
|
|
1956 (let (node)
|
|
1957 (cond
|
|
1958 ((= point (point-min)) nil) ; don't trigger on accidental RET.
|
|
1959 ((setq node (Info-get-token point
|
|
1960 (format "\\*%s[ \n]" Info-footnote-tag)
|
|
1961 (format "\\*%s[ \n]\\([^:]*\\):"
|
|
1962 Info-footnote-tag)))
|
|
1963 (list "Following cross-reference %s..."
|
|
1964 (list 'Info-follow-reference node)))
|
|
1965 ((setq node (Info-get-token point "\\* " "\\* \\([^:]*\\)::"))
|
|
1966 (list "Selecting menu item %s..."
|
|
1967 (list 'Info-goto-node node nil t)))
|
|
1968 ((setq node (Info-get-token point "\\* " "\\* \\([^:]*\\):"))
|
|
1969 (list "Selecting menu item %s..."
|
|
1970 (list 'Info-menu node)))
|
|
1971 ((setq node (Info-get-token point "Up: " "Up: \\([^,\n\t]*\\)"))
|
|
1972 (list "Going up..."
|
|
1973 (list 'Info-goto-node node)))
|
|
1974 ((setq node (Info-get-token point "Next: " "Next: \\([^,\n\t]*\\)"))
|
|
1975 (list "Next node..."
|
|
1976 (list 'Info-goto-node node)))
|
|
1977 ((setq node (Info-get-token point "File: " "File: \\([^,\n\t]*\\)"))
|
|
1978 (list "Top node..."
|
|
1979 (list 'Info-goto-node "Top")))
|
|
1980 ((setq node (Info-get-token point "Prev[ious]*: "
|
|
1981 "Prev[ious]*: \\([^,\n\t]*\\)"))
|
|
1982 (list "Previous node..."
|
|
1983 (list 'Info-goto-node node)))
|
|
1984 ((setq node (Info-get-token point "Node: " "Node: \\([^,\n\t]*\\)"))
|
|
1985 (list "Reselecting %s..."
|
|
1986 (list 'Info-goto-node node)))
|
|
1987 ((save-excursion (goto-char point) (looking-at "[ \n]*\\'"))
|
|
1988 (if Info-in-cross-reference
|
|
1989 (list "Back to last node..."
|
|
1990 '(Info-last))
|
|
1991 (list "Next node..."
|
|
1992 '(Info-global-next)))))
|
|
1993 ))
|
|
1994
|
|
1995 (defun Info-follow-nearest-node (point)
|
|
1996 "Follow a node reference near point. Like M, F, N, P or U command.
|
|
1997 At end of the node's text, moves to the next node."
|
|
1998 (interactive "d")
|
|
1999 (let ((data (Info-find-nearest-node point)))
|
|
2000 (if (null data)
|
|
2001 nil
|
|
2002 (let ((msg (format (car data) (nth 1 (nth 1 data)))))
|
|
2003 (message "%s" msg)
|
|
2004 (eval (nth 1 data))
|
|
2005 (message "%sdone" msg))
|
|
2006 t)))
|
|
2007
|
|
2008 (defun Info-indicated-node (event)
|
|
2009 (condition-case ()
|
|
2010 (save-excursion
|
|
2011 (cond ((eventp event)
|
|
2012 (set-buffer (event-buffer event))
|
|
2013 (setq event (event-point event))))
|
|
2014 (let* ((data (Info-find-nearest-node event))
|
|
2015 (name (nth 1 (nth 1 data))))
|
|
2016 (and name (nth 1 data))))
|
|
2017 (error nil)))
|
|
2018
|
|
2019
|
|
2020 (defvar Info-mode-map nil
|
|
2021 "Keymap containing Info commands.")
|
|
2022 (if Info-mode-map
|
|
2023 nil
|
|
2024 (setq Info-mode-map (make-keymap))
|
|
2025 (suppress-keymap Info-mode-map)
|
|
2026 (define-key Info-mode-map "." 'beginning-of-buffer)
|
|
2027 (define-key Info-mode-map " " 'Info-scroll-next)
|
|
2028 (define-key Info-mode-map "1" 'Info-nth-menu-item)
|
|
2029 (define-key Info-mode-map "2" 'Info-nth-menu-item)
|
|
2030 (define-key Info-mode-map "3" 'Info-nth-menu-item)
|
|
2031 (define-key Info-mode-map "4" 'Info-nth-menu-item)
|
|
2032 (define-key Info-mode-map "5" 'Info-nth-menu-item)
|
|
2033 (define-key Info-mode-map "6" 'Info-nth-menu-item)
|
|
2034 (define-key Info-mode-map "7" 'Info-nth-menu-item)
|
|
2035 (define-key Info-mode-map "8" 'Info-nth-menu-item)
|
|
2036 (define-key Info-mode-map "9" 'Info-nth-menu-item)
|
|
2037 (define-key Info-mode-map "0" 'Info-last-menu-item)
|
|
2038 (define-key Info-mode-map "?" 'Info-summary)
|
|
2039 (define-key Info-mode-map "a" 'Info-annotate)
|
|
2040 (define-key Info-mode-map "b" 'beginning-of-buffer)
|
|
2041 (define-key Info-mode-map "d" 'Info-directory)
|
|
2042 (define-key Info-mode-map "e" 'Info-edit)
|
|
2043 (define-key Info-mode-map "f" 'Info-follow-reference)
|
|
2044 (define-key Info-mode-map "g" 'Info-goto-node)
|
|
2045 (define-key Info-mode-map "h" 'Info-help)
|
|
2046 (define-key Info-mode-map "i" 'Info-index)
|
|
2047 (define-key Info-mode-map "j" 'Info-goto-bookmark)
|
|
2048 (define-key Info-mode-map "k" 'Info-emacs-key)
|
|
2049 (define-key Info-mode-map "l" 'Info-last)
|
|
2050 (define-key Info-mode-map "m" 'Info-menu)
|
|
2051 (define-key Info-mode-map "n" 'Info-next)
|
|
2052 (define-key Info-mode-map "p" 'Info-prev)
|
|
2053 (define-key Info-mode-map "q" 'Info-exit)
|
|
2054 (define-key Info-mode-map "r" 'Info-follow-reference)
|
|
2055 (define-key Info-mode-map "s" 'Info-search)
|
|
2056 (define-key Info-mode-map "t" 'Info-top)
|
|
2057 (define-key Info-mode-map "u" 'Info-up)
|
|
2058 (define-key Info-mode-map "v" 'Info-visit-file)
|
|
2059 (define-key Info-mode-map "x" 'Info-bookmark)
|
|
2060 (define-key Info-mode-map "<" 'Info-top)
|
|
2061 (define-key Info-mode-map ">" 'Info-end)
|
|
2062 (define-key Info-mode-map "[" 'Info-global-prev)
|
|
2063 (define-key Info-mode-map "]" 'Info-global-next)
|
|
2064 (define-key Info-mode-map "{" 'Info-page-prev)
|
|
2065 (define-key Info-mode-map "}" 'Info-page-next)
|
|
2066 (define-key Info-mode-map "=" 'Info-restore-point)
|
|
2067 (define-key Info-mode-map "!" 'Info-select-node)
|
|
2068 (define-key Info-mode-map "@" 'Info-follow-nearest-node)
|
|
2069 (define-key Info-mode-map "," 'Info-index-next)
|
|
2070 (define-key Info-mode-map "*" 'Info-elisp-ref)
|
|
2071 (define-key Info-mode-map "\t" 'Info-next-reference)
|
|
2072 (define-key Info-mode-map "\e\t" 'Info-prev-reference)
|
|
2073 (define-key Info-mode-map "\r" 'Info-follow-nearest-node)
|
|
2074 (define-key Info-mode-map "\177" 'Info-scroll-prev)
|
|
2075 ;; XEmacs addition
|
|
2076 (define-key Info-mode-map [backspace] 'Info-scroll-prev)
|
|
2077
|
|
2078 (define-key Info-mode-map 'button2 'Info-follow-clicked-node)
|
|
2079 (define-key Info-mode-map 'button3 'Info-select-node-menu))
|
|
2080
|
|
2081
|
|
2082 ;; Info mode is suitable only for specially formatted data.
|
|
2083 (put 'info-mode 'mode-class 'special)
|
|
2084
|
|
2085 (defun Info-mode ()
|
|
2086 "Info mode is for browsing through the Info documentation tree.
|
|
2087 Documentation in Info is divided into \"nodes\", each of which
|
|
2088 discusses one topic and contains references to other nodes
|
|
2089 which discuss related topics. Info has commands to follow
|
|
2090 the references and show you other nodes.
|
|
2091
|
|
2092 h Invoke the Info tutorial.
|
|
2093 q Quit Info: return to the previously selected file or buffer.
|
|
2094
|
|
2095 Selecting other nodes:
|
|
2096 n Move to the \"next\" node of this node.
|
|
2097 p Move to the \"previous\" node of this node.
|
|
2098 m Pick menu item specified by name (or abbreviation).
|
|
2099 1-9, 0 Pick first..ninth, last item in node's menu.
|
|
2100 Menu items select nodes that are \"subsections\" of this node.
|
|
2101 u Move \"up\" from this node (i.e., from a subsection to a section).
|
|
2102 f or r Follow a cross reference by name (or abbrev). Type `l' to get back.
|
|
2103 RET Follow cross reference or menu item indicated by cursor.
|
|
2104 i Look up a topic in this file's Index and move to that node.
|
|
2105 , (comma) Move to the next match from a previous `i' command.
|
|
2106 l (letter L) Move back to the last node you were in.
|
|
2107
|
|
2108 Moving within a node:
|
|
2109 Space Scroll forward a full screen. DEL Scroll backward.
|
|
2110 b Go to beginning of node. Meta-> Go to end of node.
|
|
2111 TAB Go to next cross-reference. Meta-TAB Go to previous ref.
|
|
2112
|
|
2113 Mouse commands:
|
|
2114 Left Button Set point.
|
|
2115 Middle Button Click on a highlighted node reference to go to it.
|
|
2116 Right Button Pop up a menu of applicable Info commands.
|
|
2117
|
|
2118 Advanced commands:
|
|
2119 g Move to node, file, or annotation tag specified by name.
|
|
2120 Examples: `g Rectangles' `g (Emacs)Rectangles' `g Emacs'.
|
|
2121 v Move to file, with filename completion.
|
|
2122 k Look up a key sequence in Emacs manual (also C-h C-k at any time).
|
|
2123 * Look up a function name in Emacs Lisp manual (also C-h C-f).
|
|
2124 d Go to the main directory of Info files.
|
|
2125 < or t Go to Top (first) node of this file.
|
|
2126 > Go to last node in this file.
|
|
2127 \[ Go to previous node, treating file as one linear document.
|
|
2128 \] Go to next node, treating file as one linear document.
|
|
2129 { Scroll backward, or go to previous node if at top.
|
|
2130 } Scroll forward, or go to next node if at bottom.
|
|
2131 = Restore cursor position from last time in this node.
|
|
2132 a Add a private note (annotation) to the current node.
|
|
2133 x, j Add, jump to a bookmark (annotation tag).
|
|
2134 s Search this Info file for a node containing the specified regexp.
|
|
2135 e Edit the contents of the current node."
|
|
2136 (kill-all-local-variables)
|
|
2137 (setq major-mode 'Info-mode)
|
|
2138 (setq mode-name "Info")
|
|
2139 (use-local-map Info-mode-map)
|
|
2140 (set-syntax-table text-mode-syntax-table)
|
|
2141 (setq local-abbrev-table text-mode-abbrev-table)
|
|
2142 (setq case-fold-search t)
|
|
2143 (setq buffer-read-only t)
|
|
2144 ; (setq buffer-mouse-map Info-mode-mouse-map)
|
|
2145 (make-local-variable 'Info-current-file)
|
|
2146 (make-local-variable 'Info-current-subfile)
|
|
2147 (make-local-variable 'Info-current-node)
|
|
2148 (make-local-variable 'Info-tag-table-marker)
|
|
2149 (make-local-variable 'Info-current-file-completions)
|
|
2150 (make-local-variable 'Info-current-annotation-completions)
|
|
2151 (make-local-variable 'Info-index-alternatives)
|
|
2152 (make-local-variable 'Info-history)
|
|
2153 (if t ;; XEmacs: remove v19 test
|
|
2154 (progn
|
|
2155 (or (and (fboundp 'find-face) (find-face 'info-node))
|
|
2156 (make-face 'info-node "used for node links in info"))
|
|
2157 (or (and (fboundp 'find-face) (find-face 'info-xref))
|
|
2158 (make-face 'info-xref "used for cross-references in info"))
|
|
2159 (or (face-differs-from-default-p 'info-node)
|
|
2160 (if (face-differs-from-default-p 'bold-italic)
|
|
2161 (copy-face 'bold-italic 'info-node)
|
|
2162 (copy-face 'bold 'info-node)))
|
|
2163 (or (face-differs-from-default-p 'info-xref)
|
|
2164 (copy-face 'bold 'info-xref))))
|
|
2165 (make-local-variable 'mouse-track-click-hook)
|
|
2166 (add-hook 'mouse-track-click-hook 'Info-maybe-follow-clicked-node)
|
|
2167 ;; #### The console-on-window-system-p check is to allow this to
|
|
2168 ;; work on tty's. The real problem here is that featurep really
|
|
2169 ;; needs to have some device/console domain knowledge added to it.
|
|
2170 (if (and (featurep 'toolbar)
|
|
2171 (console-on-window-system-p)
|
|
2172 (not Info-inhibit-toolbar))
|
|
2173 (set-specifier default-toolbar (cons (current-buffer) info::toolbar)))
|
|
2174 (if (featurep 'menubar)
|
|
2175 (progn
|
|
2176 ;; make a local copy of the menubar, so our modes don't
|
|
2177 ;; change the global menubar
|
|
2178 (set-buffer-menubar current-menubar)
|
|
2179 (add-submenu nil '("Info"
|
|
2180 :filter Info-menu-filter))))
|
|
2181 (run-hooks 'Info-mode-hook)
|
|
2182 (Info-set-mode-line))
|
|
2183
|
|
2184 (defvar Info-edit-map nil
|
|
2185 "Local keymap used within `e' command of Info.")
|
|
2186 (if Info-edit-map
|
|
2187 nil
|
|
2188 ;; XEmcas: remove FSF stuff
|
|
2189 (setq Info-edit-map (make-sparse-keymap))
|
|
2190 (set-keymap-name Info-edit-map 'Info-edit-map)
|
|
2191 (set-keymap-parents Info-edit-map (list text-mode-map))
|
|
2192 (define-key Info-edit-map "\C-c\C-c" 'Info-cease-edit))
|
|
2193
|
|
2194 ;; Info-edit mode is suitable only for specially formatted data.
|
|
2195 (put 'info-edit-mode 'mode-class 'special)
|
|
2196
|
|
2197 (defun Info-edit-mode ()
|
|
2198 "Major mode for editing the contents of an Info node.
|
|
2199 Like text mode with the addition of `Info-cease-edit'
|
|
2200 which returns to Info mode for browsing.
|
|
2201 \\{Info-edit-map}"
|
|
2202 )
|
|
2203
|
|
2204 (defun Info-edit ()
|
|
2205 "Edit the contents of this Info node.
|
|
2206 Allowed only if variable `Info-enable-edit' is non-nil."
|
|
2207 (interactive)
|
|
2208 (or Info-enable-edit
|
|
2209 (error "Editing info nodes is not enabled"))
|
|
2210 (use-local-map Info-edit-map)
|
|
2211 (setq major-mode 'Info-edit-mode)
|
|
2212 (setq mode-name "Info Edit")
|
|
2213 (kill-local-variable 'modeline-buffer-identification)
|
|
2214 (setq buffer-read-only nil)
|
|
2215 ;; Make mode line update.
|
|
2216 (set-buffer-modified-p (buffer-modified-p))
|
|
2217 (message (substitute-command-keys
|
|
2218 "Editing: Type \\[Info-cease-edit] to return to info")))
|
|
2219
|
|
2220 (defun Info-cease-edit ()
|
|
2221 "Finish editing Info node; switch back to Info proper."
|
|
2222 (interactive)
|
|
2223 ;; Do this first, so nothing has changed if user C-g's at query.
|
|
2224 (and (buffer-modified-p)
|
|
2225 (y-or-n-p "Save the file? ")
|
|
2226 (save-buffer))
|
|
2227 (use-local-map Info-mode-map)
|
|
2228 (setq major-mode 'Info-mode)
|
|
2229 (setq mode-name "Info")
|
|
2230 (Info-set-mode-line)
|
|
2231 (setq buffer-read-only t)
|
|
2232 ;; Make mode line update.
|
|
2233 (set-buffer-modified-p (buffer-modified-p))
|
|
2234 (and (marker-position Info-tag-table-marker)
|
|
2235 (buffer-modified-p)
|
|
2236 (message "Tags may have changed. Use Info-tagify if necessary")))
|
|
2237
|
|
2238 (defun Info-find-emacs-command-nodes (command)
|
|
2239 "Return a list of locations documenting COMMAND in the XEmacs Info manual.
|
|
2240 The locations are of the format used in Info-history, i.e.
|
|
2241 \(FILENAME NODENAME BUFFERPOS\)."
|
|
2242 (let ((where '())
|
|
2243 (cmd-desc (concat "^\\* " (regexp-quote (symbol-name command))
|
|
2244 ":\\s *\\(.*\\)\\.$")))
|
|
2245 (save-excursion
|
|
2246 (Info-find-node "XEmacs" "Command Index")
|
|
2247 ;; Take the index node off the Info history.
|
|
2248 (setq Info-history (cdr Info-history))
|
|
2249 (goto-char (point-max))
|
|
2250 (while (re-search-backward cmd-desc nil t)
|
|
2251 (setq where (cons (list Info-current-file
|
|
2252 (buffer-substring
|
|
2253 (match-beginning 1)
|
|
2254 (match-end 1))
|
|
2255 0)
|
|
2256 where)))
|
|
2257 where)))
|
|
2258
|
|
2259
|
|
2260 ;;; fontification and mousability for info
|
|
2261
|
|
2262 (defun Info-highlight-region (start end face)
|
|
2263 (let ((extent (make-extent start end)))
|
|
2264 (set-extent-face extent face)
|
|
2265 (set-extent-property extent 'info t)
|
|
2266 (set-extent-property extent 'highlight t)))
|
|
2267
|
|
2268 (defun Info-fontify-node ()
|
|
2269 (save-excursion
|
|
2270 (let (;(lucid (string-match "Lucid" emacs-version))
|
|
2271 (case-fold-search t)
|
|
2272 (xref-regexp (concat "\\*"
|
|
2273 (regexp-quote Info-footnote-tag)
|
|
2274 "[ \n\t]*\\([^:]*\\):")))
|
|
2275 ; (if lucid
|
|
2276 (map-extents (function (lambda (x y) (delete-extent x)))
|
|
2277 (current-buffer) (point-min) (point-max) nil)
|
|
2278 ; )
|
|
2279 (goto-char (point-min))
|
|
2280 (if (looking-at "^File: [^,: \t]+,?[ \t]+")
|
|
2281 (progn
|
|
2282 (goto-char (match-end 0))
|
|
2283 (while
|
|
2284 (looking-at "[ \t]*[^:, \t\n]+:[ \t]+\\([^:,\t\n]+\\),?")
|
|
2285 (goto-char (match-end 0))
|
|
2286 (Info-highlight-region (match-beginning 1) (match-end 1)
|
|
2287 'info-xref ;lucid
|
|
2288 ))))
|
|
2289 (goto-char (point-min))
|
|
2290 (while (re-search-forward xref-regexp nil t)
|
|
2291 (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
|
|
2292 nil
|
|
2293 (Info-highlight-region (match-beginning 1) (match-end 1)
|
|
2294 'info-xref ;lucid
|
|
2295 )))
|
|
2296 (goto-char (point-min))
|
|
2297 (if (and (search-forward "\n* menu:" nil t)
|
|
2298 ;; principle of least astonishment, dude...
|
|
2299 ;; (Also, in xemacs this is fast even on indexes, and without it, nodes don't
|
|
2300 ;; highlight when you move over them.)
|
|
2301 ;; (not (string-match "\\<Index\\>" Info-current-node))
|
|
2302 ;; (< (- (point-max) (point)) 10000)
|
|
2303 )
|
|
2304 (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t)
|
|
2305 (Info-highlight-region (match-beginning 1) (match-end 1)
|
|
2306 'info-node ;lucid
|
|
2307 )))
|
|
2308 (set-buffer-modified-p nil))))
|
|
2309
|
|
2310 (defun Info-construct-menu (&optional event)
|
|
2311 "Construct a menu of Info commands.
|
|
2312 Adds an entry for the node at EVENT, or under point if EVENT is omitted.
|
|
2313 Used to construct the menubar submenu and popup menu."
|
|
2314 (or event (setq event (point)))
|
|
2315 (let ((case-fold-search t)
|
|
2316 (xref-regexp (concat "\\*"
|
|
2317 (regexp-quote Info-footnote-tag)
|
|
2318 "[ \n\t]*\\([^:]*\\):"))
|
|
2319 up-p prev-p next-p menu
|
|
2320 i text xrefs subnodes in)
|
|
2321 (save-excursion
|
|
2322 (goto-char (point-min))
|
|
2323 (if (looking-at ".*\\bNext:") (setq next-p t))
|
|
2324 (if (looking-at ".*\\bPrev:") (setq prev-p t))
|
|
2325 (if (looking-at ".*Up:") (setq up-p t))
|
|
2326 (setq menu (nconc
|
|
2327 (if (setq in (Info-indicated-node event))
|
|
2328 (list (vector (car (cdr in)) in t)))
|
|
2329 (list
|
|
2330 ["Goto Info Top-level" Info-directory t]
|
|
2331 (vector "Next Node" 'Info-next next-p)
|
|
2332 (vector "Previous Node" 'Info-prev prev-p)
|
|
2333 (vector "Parent Node (Up)" 'Info-up up-p)
|
|
2334 ["Goto Node..." Info-goto-node t]
|
|
2335 ["Goto Last Visited Node" Info-last t])))
|
|
2336 (while (re-search-forward xref-regexp nil t)
|
|
2337 (setq text (buffer-substring (match-beginning 1) (match-end 1)))
|
|
2338 (while (setq i (string-match "[ \n\t]+" text i))
|
|
2339 (setq text (concat (substring text 0 i) " "
|
|
2340 (substring text (match-end 0))))
|
|
2341 (setq i (1+ i)))
|
|
2342 (setq xrefs (cons text xrefs)))
|
|
2343 (setq xrefs (nreverse xrefs))
|
|
2344 (if (> (length xrefs) 21) (setcdr (nthcdr 20 xrefs) '(more)))
|
|
2345 (goto-char (point-min))
|
|
2346 (if (search-forward "\n* menu:" nil t)
|
|
2347 (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t)
|
|
2348 (setq text (buffer-substring (match-beginning 1) (match-end 1)))
|
|
2349 (setq subnodes (cons text subnodes))))
|
|
2350 (setq subnodes (nreverse subnodes))
|
|
2351 (if (> (length subnodes) 21) (setcdr (nthcdr 20 subnodes) '(more)))
|
|
2352 )
|
|
2353 (if xrefs
|
|
2354 (nconc menu (list "----" "Cross-References:" "----")
|
|
2355 (mapcar (function (lambda (xref)
|
|
2356 (if (eq xref 'more)
|
|
2357 "...more..."
|
|
2358 (vector xref
|
|
2359 (list 'Info-follow-reference xref)
|
|
2360 t))))
|
|
2361 xrefs)))
|
|
2362 (if subnodes
|
|
2363 (nconc menu (list "----" "Sub-Nodes:" "----")
|
|
2364 (mapcar (function (lambda (node)
|
|
2365 (if (eq node 'more)
|
|
2366 "...more..."
|
|
2367 (vector node (list 'Info-menu node)
|
|
2368 t))))
|
|
2369 subnodes)))
|
|
2370 menu))
|
|
2371
|
|
2372 (defun Info-menu-filter (menu)
|
|
2373 "This is the menu filter for the \"Info\" submenu."
|
|
2374 (Info-construct-menu))
|
|
2375
|
|
2376 (defun Info-select-node-menu (event)
|
|
2377 "Pops up a menu of applicable Info commands."
|
|
2378 (interactive "e")
|
|
2379 (select-window (event-window event))
|
|
2380 (let ((menu (Info-construct-menu event)))
|
|
2381 (setq menu (nconc (list "Info" ; title: not shown
|
|
2382 "Info Commands:" "----")
|
|
2383 menu))
|
|
2384 (let ((popup-menu-titles nil))
|
|
2385 (popup-menu menu))))
|
|
2386
|
|
2387 ;;; Info toolbar support
|
|
2388
|
|
2389 ;; exit icon taken from GNUS
|
|
2390 (defvar info::toolbar-exit-icon
|
|
2391 (if (featurep 'toolbar)
|
|
2392 (toolbar-make-button-list
|
|
2393 (expand-file-name (if (featurep 'xpm) "info-exit.xpm" "info-exit.xbm")
|
|
2394 toolbar-icon-directory)))
|
|
2395 "Exit Info icon")
|
|
2396
|
|
2397 (defvar info::toolbar-up-icon
|
|
2398 (if (featurep 'toolbar)
|
|
2399 (toolbar-make-button-list
|
|
2400 (expand-file-name (if (featurep 'xpm) "info-up.xpm" "info-up.xbm")
|
|
2401 toolbar-icon-directory)))
|
|
2402 "Up icon")
|
|
2403
|
|
2404 (defvar info::toolbar-next-icon
|
|
2405 (if (featurep 'toolbar)
|
|
2406 (toolbar-make-button-list
|
|
2407 (expand-file-name (if (featurep 'xpm) "info-next.xpm" "info-next.xbm")
|
|
2408 toolbar-icon-directory)))
|
|
2409 "Next icon")
|
|
2410
|
|
2411 (defvar info::toolbar-prev-icon
|
|
2412 (if (featurep 'toolbar)
|
|
2413 (toolbar-make-button-list
|
|
2414 (expand-file-name (if (featurep 'xpm) "info-prev.xpm" "info-prev.xbm")
|
|
2415 toolbar-icon-directory)))
|
|
2416 "Prev icon")
|
|
2417
|
|
2418 (defvar info::toolbar
|
|
2419 (if (featurep 'toolbar)
|
|
2420 ; disabled until we get the next/prev-win icons working again.
|
|
2421 ; (cons (first initial-toolbar-spec)
|
|
2422 ; (cons (second initial-toolbar-spec)
|
|
2423 '([info::toolbar-exit-icon
|
|
2424 Info-exit
|
|
2425 t
|
|
2426 "Exit info"]
|
|
2427 [info::toolbar-prev-icon
|
|
2428 Info-prev
|
|
2429 t
|
|
2430 "Prev entry in same section"]
|
|
2431 [info::toolbar-next-icon
|
|
2432 Info-next
|
|
2433 t
|
|
2434 "Next entry in same section"]
|
|
2435 [info::toolbar-up-icon
|
|
2436 Info-up
|
|
2437 t
|
|
2438 "Up entry to enclosing section"]
|
|
2439 )))
|
|
2440 ;))
|
|
2441
|
|
2442
|
|
2443 (provide 'info)
|
|
2444
|
|
2445 (run-hooks 'Info-load-hook)
|
|
2446
|
|
2447 ;;; info.el ends here
|