annotate lisp/info.el @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents 7d59cb494b73
children a86b2b5e0111
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1 ;;; info.el --- info package for Emacs.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2 ;; Keywords: help
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
4 ;; Copyright (C) 1985, 1986, 1993, 1997 Free Software Foundation, Inc.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
5
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
6 ;; Author: Dave Gillespie <daveg@synaptics.com>
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
7 ;; Richard Stallman <rms@gnu.ai.mit.edu>
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
8 ;; Maintainer: Dave Gillespie <daveg@synaptics.com>
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
9 ;; Version: 1.07 of 7/22/93
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
10 ;; Keywords: docs, help
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
11
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
12 ;; This file is part of XEmacs.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
13
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
14 ;; XEmacs is free software; you can redistribute it and/or modify it
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
15 ;; under the terms of the GNU General Public License as published by
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
17 ;; any later version.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
18
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
19 ;; XEmacs is distributed in the hope that it will be useful, but
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
22 ;; General Public License for more details.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
23
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
25 ;; along with XEmacs; see the file COPYING. If not, write to the
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
27 ;; Boston, MA 02111-1307, USA.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
28
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
29 ;;; Synched up with: Not synched with FSF.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
30
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
31 ;; Commentary:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
32
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
33 ;; This is based on an early Emacs 19 info.el file.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
34 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
35 ;; Note that Info-directory has been replaced by Info-directory-list,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
36 ;; a search path of directories in which to find Info files.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
37 ;; Also, Info tries adding ".info" to a file name if the name itself
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
38 ;; is not found.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
39 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
40 ;; See the change log below for further details.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
41
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
42
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
43 ;; LCD Archive Entry:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
44 ;; info-dg|Dave Gillespie|daveg@synaptics.com
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
45 ;; |Info reader with many enhancements; replaces standard info.el.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
46 ;; |93-07-22|1.07|~/modes/info.el
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
47
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
48 ;; Also available from anonymous FTP on csvax.cs.caltech.edu.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
49
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
50
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
51 ;; Change Log:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
52
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
53 ;; Modified 3/7/1991 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
54 ;; (Author's address: daveg@synaptics.com or daveg@csvax.cs.caltech.edu)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
55 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
56 ;; Added keys: i, t, <, >, [, ], {, }, 6, 7, 8, 9, 0.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
57 ;; Look at help for info-mode (type ? in Info) for descriptions.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
58 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
59 ;; If Info-directory-list is undefined and there is no INFOPATH
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
60 ;; in the environment, use value of Info-directory for compatibility
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
61 ;; with Emacs 18.57.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
62 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
63 ;; All files named "localdir" found in the path are appended to "dir",
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
64 ;; the Info directory. For this to work, "dir" should contain only
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
65 ;; one node (Top), and each "localdir" should contain no ^_ or ^L
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
66 ;; characters. Generally they will contain only one or several
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
67 ;; additional lines for the top-level menu. Note that "dir" is
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
68 ;; modified in memory each time it is loaded, but not on disk.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
69 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
70 ;; If "dir" contains a line of the form: "* Locals:"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
71 ;; then the "localdir"s are inserted there instead of at the end.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
72
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
73
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
74 ;; Modified 4/3/1991 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
75 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
76 ;; Added Info-mode-hook (suggested by Sebastian Kremer).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
77 ;; Also added epoch-info-startup/select-hooks from Simon Spero's info.el.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
78 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
79 ;; Added automatic decoding of compressed Info files.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
80 ;; See documentation for the variable Info-suffix-list. Default is to
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
81 ;; run "uncompress" on ".Z" files and "unyabba" on ".Y" files.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
82 ;; (See comp.sources.unix v24i073-076 for yabba/unyabba, a free software
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
83 ;; alternative to compress/uncompress.)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
84 ;; Note: "dir" and "localdir" files should not be compressed.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
85 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
86 ;; Changed variables like Info-enable-edit to be settable by M-x set-variable.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
87 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
88 ;; Added Info-auto-advance variable. If t, SPC and DEL will act like
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
89 ;; } and {, i.e., they advance to the next/previous node if at the end
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
90 ;; of the buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
91 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
92 ;; Changed `u' to restore point to most recent location in that node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
93 ;; Added `=' to do this manually at any time. (Suggested by David Fox).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
94 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
95 ;; Changed `m' and `0-9' to try interpreting menu name as a file name
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
96 ;; if not found as a node name. This allows (dir) menus of the form,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
97 ;; Emacs:: Cool text editor
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
98 ;; as a shorthand for
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
99 ;; Emacs:(emacs). Cool text editor
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
100 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
101 ;; Enhanced `i' to use line-number information in the index.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
102 ;; Added `,' to move among all matches to a previous `i' command.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
103 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
104 ;; Added `a' (Info-annotate) for adding personal notes to any Info node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
105 ;; Notes are not stored in the actual Info files, but in the user's own
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
106 ;; ~/.infonotes file.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
107 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
108 ;; Added Info-footnote-tag, made default be "Ref" instead of "Note".
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
109 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
110 ;; Got mouse-click stuff to work under Emacs version 18. Check it out!
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
111 ;; Left and right clicks scroll the Info window.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
112 ;; Middle click goes to clicked-on node, e.g., "Next:", a menu, or a note.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
113
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
114
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
115 ;; Modified 6/29/1991 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
116 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
117 ;; Renamed epoch-info-startup/select-hooks to Info-startup/select-hook.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
118 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
119 ;; Made Info-select-node into a command on the `!' key.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
120 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
121 ;; Added Info-mouse-support user option.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
122 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
123 ;; Cleaned up the implementation of some routines.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
124 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
125 ;; Added special treatment of quoted words in annotations: The `g'
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
126 ;; command for a nonexistent node name scans for an annotation
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
127 ;; (in any node of any file) containing that name in quotes: g foo RET
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
128 ;; looks for an annotation containing: "foo" or: <<foo>>
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
129 ;; If found, it goes to that file and node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
130 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
131 ;; Added a call to set up Info-directory-list in Info-find-node to
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
132 ;; work around a bug in GNUS where it calls Info-goto-node before info.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
133 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
134 ;; Added completion for `g' command (inspired by Richard Kim's infox.el).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
135 ;; Completion knows all node names for the current file, and all annotation
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
136 ;; tags (see above). It does not complete file names or node names in
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
137 ;; other files.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
138 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
139 ;; Added `k' (Info-emacs-key) and `*' (Info-elisp-ref) commands. You may
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
140 ;; wish to bind these to global keys outside of Info mode.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
141 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
142 ;; Allowed localdir files to be full dir-like files; only the menu part
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
143 ;; of each localdir is copied. Also, redundant menu items are omitted.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
144 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
145 ;; Changed Info-history to hold only one entry at a time for each node,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
146 ;; and to be circular so that multiple `l's come back again to the most
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
147 ;; recent node. Note that the format of Info-history entries has changed,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
148 ;; which may interfere with external programs that try to operate on it.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
149 ;; (Also inspired by Kim's infox.el).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
150 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
151 ;; Changed `n', `]', `l', etc. to accept prefix arguments to move several
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
152 ;; steps at once. Most accept negative arguments to move oppositely.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
153 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
154 ;; Changed `?' to bury *Help* buffer afterwards to keep it out of the way.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
155 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
156 ;; Rearranged `?' key's display to be a little better for new users.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
157 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
158 ;; Changed `a' to save whole window configuration and restore on C-c C-c.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
159 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
160 ;; Fixed the bug reported by Bill Reynolds on gnu.emacs.bugs.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
161 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
162 ;; Changed Info-last to restore window-start as well as cursor position.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
163 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
164 ;; Changed middle mouse button in space after end of node to do Info-last
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
165 ;; if we got here by following a cross reference, else do Info-global-next.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
166 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
167 ;; Added some new mouse bindings: shift-left = Info-global-next,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
168 ;; shift-right = Info-global-prev, shift-middle = Info-last.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
169 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
170 ;; Fixed Info-follow-reference not to make assumptions about length
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
171 ;; of Info-footnote-tag [Linus Tolke].
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
172 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
173 ;; Changed default for Info-auto-advance mode to be press-twice-for-next-node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
174 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
175 ;; Modified x-mouse-ignore to preserve last-command variable, so that
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
176 ;; press-twice Info-auto-advance mode works with the mouse.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
177
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
178
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
179 ;; Modified 3/4/1992 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
180 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
181 ;; Added an "autoload" command to help autoload.el.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
182 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
183 ;; Changed `*' command to look for file `elisp' as well as for `lispref'.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
184 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
185 ;; Fixed a bug involving footnote names containing regexp special characters.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
186 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
187 ;; Fixed a bug in completion during `f' (or `r') command.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
188 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
189 ;; Added TAB (Info-next-reference), M-TAB, and RET keys to Info mode.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
190 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
191 ;; Added new bindings, `C-h C-k' for Info-emacs-key and `C-h C-f' for
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
192 ;; Info-elisp-ref. These bindings are made when info.el is loaded, and
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
193 ;; only if those key sequences were previously unbound. These bindings
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
194 ;; work at any time, not just when Info is already running.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
195
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
196
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
197 ;; Modified 3/8/1992 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
198 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
199 ;; Fixed some long lines that were causing trouble with mailers.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
200
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
201
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
202 ;; Modified 3/9/1992 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
203 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
204 ;; Added `C-h C-i' (Info-query).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
205 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
206 ;; Added Info-novice mode, warns if the user attempts to switch to
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
207 ;; a different Info file.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
208 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
209 ;; Fixed a bug that caused problems using compressed Info files
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
210 ;; and Info-directory-list at the same time.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
211 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
212 ;; Disabled Info-mouse-support by default if Epoch or Hyperbole is in use.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
213 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
214 ;; Added an expand-file-name call to Info-find-node to fix a small bug.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
215
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
216
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
217 ;; Modified 5/22/1992 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
218 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
219 ;; Added "standalone" operation: "emacs -f info" runs Emacs specifically
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
220 ;; for use as an Info browser. In this mode, the `q' key quits Emacs
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
221 ;; itself. Also, "emacs -f info arg" starts in Info file "arg" instead
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
222 ;; of "dir".
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
223 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
224 ;; Changed to prefer "foo.info" over "foo". If both exist, "foo" is
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
225 ;; probably a directory or executable program!
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
226 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
227 ;; Made control-mouse act like regular-mouse does in other buffers.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
228 ;; (In most systems, this will be set-cursor for left-mouse, x-cut
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
229 ;; for right-mouse, and x-paste, which will be an error, for
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
230 ;; middle-mouse.)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
231 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
232 ;; Improved prompting and searching for `,' key.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
233 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
234 ;; Fixed a bug where some "* Menu:" lines disappeared when "dir"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
235 ;; contained several nodes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
236
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
237
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
238 ;; Modified 9/10/1992 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
239 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
240 ;; Mixed in support for XEmacs. Mouse works the same as in
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
241 ;; the other Emacs versions by default; added Info-lucid-mouse-style
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
242 ;; variable, which enables mouse operation similar to XEmacs's default.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
243 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
244 ;; Fixed a bug where RET couldn't understand "* Foo::" if "Foo" was a
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
245 ;; file name instead of a node name.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
246 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
247 ;; Added `x' (Info-bookmark), a simple interface to the annotation
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
248 ;; tags feature. Added `j' (Info-goto-bookmark), like `g' but only
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
249 ;; completes bookmarks.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
250 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
251 ;; Added `<<tag>>' as alternate to `"tag"' in annotations.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
252 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
253 ;; Added `v' (Info-visit-file), like Info-goto-node but specialized
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
254 ;; for going to a new Info file (with file name completion).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
255 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
256 ;; Added recognition of gzip'd ".z" files.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
257
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
258
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
259 ;; Modified 5/9/1993 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
260 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
261 ;; Merged in various things from FSF's latest Emacs 19 info.el.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
262
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
263 ;; Modified 6/2/1993 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
264 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
265 ;; Changed to use new suffix ".gz" for gzip files.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
266
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
267
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
268 ;; Modified 7/22/1993 by Dave Gillespie:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
269 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
270 ;; Changed Info-footnote-tag to "See" instead of "Ref".
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
271 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
272 ;; Extended Info-fontify-node to work with FSF version of Emacs 19.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
273
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
274 ;; Modified 7/30/1993 by Jamie Zawinski:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
275 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
276 ;; Commented out the tty and fsf19 mouse support, because why bother.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
277 ;; Commented out the politically incorrect version of XEmacs mouse support.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
278 ;; Commented out mouse scrolling bindings because the party line on that
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
279 ;; is "scrollbars are coming soon."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
280 ;; Commented out munging of help-for-help's doc; put it in help.el.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
281 ;; Did Info-edit-map the modern XEmacs way.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
282 ;; Pruned extra cruft from fontification and mouse handling code.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
283 ;; Fixed ASCII-centric bogosity in unreading of events.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
284
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
285 ;; Modified 8/11/95 by Chuck Thompson:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
286 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
287 ;; Removed any pretense of ever referencing Info-directory since it
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
288 ;; wasn't working anyhow.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
289
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
290 ;; Modified 4/5/97 by Tomasz J. Cholewo:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
291 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
292 ;; Modified Info-search to use with-caps-disable-folding
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
293
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
294 ;; Modified 6/21/97 by Hrvoje Niksic
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
295 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
296 ;; Fixed up Info-next-reference to work sanely when n < 0.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
297 ;; Added S-tab binding.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
298
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
299 ;; Modified 1997-07-10 by Karl M. Hegbloom
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
300 ;;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
301 ;; Added `Info-minibuffer-history'
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
302 ;; (also added to defaults in "lisp/utils/savehist.el")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
303 ;; Other changes in main ChangeLog.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
304
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
305 ;; Modified 1998-03-29 by Oscar Figueiredo
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
306 ;;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
307 ;; Added automatic dir/localdir (re)building capability for directories that
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
308 ;; contain none or when it has become older than info files in the same
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
309 ;; directory.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
310
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
311 ;; Modified 1998-09-23 by Didier Verna <verna@inf.enst.fr>
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
312 ;;
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
313 ;; Use the new macro `with-search-caps-disable-folding'
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
314
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
315 ;; Code:
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
316 (eval-when-compile
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
317 (condition-case nil (require 'browse-url) (error nil)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
318
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
319 (defgroup info nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
320 "The info package for Emacs."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
321 :group 'help
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
322 :group 'docs)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
323
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
324 (defgroup info-faces nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
325 "The faces used by info browser."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
326 :group 'info
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
327 :group 'faces)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
328
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
329
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
330 (defcustom Info-inhibit-toolbar nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
331 "*Non-nil means don't use the specialized Info toolbar."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
332 :type 'boolean
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
333 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
334
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
335 (defcustom Info-novice nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
336 "*Non-nil means to ask for confirmation before switching Info files."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
337 :type 'boolean
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
338 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
339
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
340 (defvar Info-history nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
341 "List of info nodes user has visited.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
342 Each element of list is a list (\"(FILENAME)NODENAME\" BUFPOS WINSTART).")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
343
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
344 (defvar Info-keeping-history t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
345 "Non-nil if Info-find-node should modify Info-history.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
346 This is for use only by certain internal Info routines.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
347
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
348 (defvar Info-minibuffer-history nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
349 "Minibuffer history for Info.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
350
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
351 (defcustom Info-enable-edit nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
352 "*Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
353 can edit the current node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
354 This is convenient if you want to write info files by hand.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
355 However, we recommend that you not do this.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
356 It is better to write a Texinfo file and generate the Info file from that,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
357 because that gives you a printed manual as well."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
358 :type 'boolean
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
359 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
360
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
361 (defcustom Info-enable-active-nodes t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
362 "*Non-nil allows Info to execute Lisp code associated with nodes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
363 The Lisp code is executed when the node is selected."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
364 :type 'boolean
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
365 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
366
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
367 (defcustom Info-restoring-point t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
368 "*Non-nil means to restore the cursor position when re-entering a node."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
369 :type 'boolean
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
370 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
371
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
372 (defcustom Info-auto-advance 'twice
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
373 "*Control what SPC and DEL do when they can't scroll any further.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
374 If nil, they beep and remain in the current node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
375 If t, they move to the next node (like Info-global-next/prev).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
376 If anything else, they must be pressed twice to move to the next node."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
377 :type '(choice (const :tag "off" nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
378 (const :tag "advance" t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
379 (const :tag "confirm" twice))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
380 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
381
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
382 (defcustom Info-fontify t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
383 "*Non-nil enables font features in XEmacs.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
384 This variable is ignored unless running under XEmacs."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
385 :type 'boolean
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
386 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
387
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
388 (defcustom Info-additional-search-directory-list nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
389 "*List of additional directories to search for Info documentation
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
390 files. These directories are not searched for merging the `dir'
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
391 file. An example might be something like:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
392 \"/usr/local/lib/xemacs/packages/lisp/calc/\""
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
393 :type '(repeat directory)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
394 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
395
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
396 (defcustom Info-auto-generate-directory 'if-missing
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
397 "*When to auto generate an info directory listing.
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
398 Possible values are:
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
399 nil or `never' never auto-generate a directory listing,
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
400 use any existing `dir' or `localdir' file and ignore info
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
401 directories containing none
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
402 `always' auto-generate a directory listing ignoring existing
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
403 `dir' and `localdir' files
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
404 `if-missing', the default, auto-generates a directory listing
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
405 if no `dir' or `localdir' file is present. Otherwise the
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
406 contents of any of these files is used instead.
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
407 `if-outdated' auto-generates a directory listing if the `dir'
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
408 and `localdir' are either inexistent or outdated (touched
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
409 less recently than an info file in the same directory)."
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
410 :type '(choice (const :tag "never" never)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
411 (const :tag "always" always)
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
412 (const :tag "if-missing" if-missing)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
413 (const :tag "if-outdated" if-outdated))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
414 :group 'info)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
415
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
416 (defcustom Info-save-auto-generated-dir nil
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
417 "*Whether an auto-generated info directory listing should be saved.
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
418 Possible values are:
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
419 nil or `never', the default, auto-generated info directory
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
420 information will never be saved.
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
421 `always', auto-generated info directory information will be saved to
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
422 a `dir' file in the same directory overwriting it if it exists
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
423 `conservative', auto-generated info directory information will be saved
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
424 to a `dir' file in the same directory but the user is asked before
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
425 overwriting any existing file."
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
426 :type '(choice (const :tag "never" never)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
427 (const :tag "always" always)
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
428 (const :tag "conservative" conservative))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
429 :group 'info)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
430
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
431 (defvar Info-emacs-info-file-name "xemacs.info"
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
432 "The filename of the XEmacs info for
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
433 `Info-goto-emacs-command-node' (`\\<help-mode-map>\\[Info-goto-emacs-command-node]')")
239
41f2f0e326e9 Import from CVS: tag r20-5b18
cvs
parents: 219
diff changeset
434
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 263
diff changeset
435 ;;;###autoload
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 263
diff changeset
436 (defvar Info-directory-list nil
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
437 "List of directories to search for Info documentation files.
243
f220cc83d72e Import from CVS: tag r20-5b20
cvs
parents: 239
diff changeset
438
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 263
diff changeset
439 The first directory in this list, the \"dir\" file there will become
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
440 the (dir)Top node of the Info documentation tree.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
441
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
442 Note: DO NOT use the `customize' interface to change the value of this
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
443 variable. Its value is created dynamically on each startup, depending
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
444 on XEmacs packages installed on the system. If you want to change the
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
445 search path, make the needed modifications on the variable's value
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
446 from .emacs. For instance:
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
447
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
448 (setq Info-directory-list (cons \"~/info\" Info-directory-list))")
359
8e84bee8ddd0 Import from CVS: tag r21-1-9
cvs
parents: 357
diff changeset
449
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
450 (defcustom Info-localdir-heading-regexp
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
451 "^Locally installed XEmacs Packages:?"
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
452 "The menu part of localdir files will be inserted below this topic
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
453 heading."
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
454 :type 'regexp
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
455 :group 'info)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
456
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
457 (defface info-node '((t (:bold t :italic t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
458 "Face used for node links in info."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
459 :group 'info-faces)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
460
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
461 (defface info-xref '((t (:bold t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
462 "Face used for cross-references in info."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
463 :group 'info-faces)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
464
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
465 ;; Is this right for NT? .zip, with -c for to stdout, right?
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
466 (defvar Info-suffix-list '( ("" . nil)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
467 (".info" . nil)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
468 (".info.bz2" . "bzip2 -dc %s")
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
469 (".info.gz" . "gzip -dc %s")
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
470 (".info-z" . "gzip -dc %s")
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
471 (".info.Z" . "uncompress -c %s")
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
472 (".bz2" . "bzip2 -dc %s")
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
473 (".gz" . "gzip -dc %s")
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
474 (".Z" . "uncompress -c %s")
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
475 (".zip" . "unzip -c %s") )
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
476 "List of file name suffixes and associated decoding commands.
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
477 Each entry should be (SUFFIX . STRING); if STRING contains %s, that is
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
478 changed to name of the file to decode, otherwise the file is given to
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
479 the command as standard input. If STRING is nil, no decoding is done.")
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
480
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
481 (defvar Info-footnote-tag "Note"
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
482 "*Symbol that identifies a footnote or cross-reference.
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
483 All \"*Note\" references will be changed to use this word instead.")
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
484
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
485 (defvar Info-current-file nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
486 "Info file that Info is now looking at, or nil.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
487 This is the name that was specified in Info, not the actual file name.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
488 It doesn't contain directory names or file name extensions added by Info.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
489
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
490 (defvar Info-current-subfile nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
491 "Info subfile that is actually in the *info* buffer now,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
492 or nil if current info file is not split into subfiles.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
493
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
494 (defvar Info-current-node nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
495 "Name of node that Info is now looking at, or nil.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
496
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
497 (defvar Info-tag-table-marker (make-marker)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
498 "Marker pointing at beginning of current Info file's tag table.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
499 Marker points nowhere if file has no tag table.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
500
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
501 (defvar Info-current-file-completions nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
502 "Cached completion list for current Info file.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
503
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
504 (defvar Info-current-annotation-completions nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
505 "Cached completion list for current annotation files.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
506
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
507 (defvar Info-index-alternatives nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
508 "List of possible matches for last Info-index command.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
509 (defvar Info-index-first-alternative nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
510
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
511 (defcustom Info-annotations-path
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
512 (list
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
513 (paths-construct-path (list user-init-directory "info.notes"))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
514 (paths-construct-path '("~" ".infonotes"))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
515 (paths-construct-path '("usr" "lib" "info.notes")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
516 (char-to-string directory-sep-char)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
517 "*Names of files that contain annotations for different Info nodes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
518 By convention, the first one should reside in your personal directory.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
519 The last should be a world-writable \"public\" annotations file."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
520 :type '(repeat file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
521 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
522
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
523 (defcustom Info-button1-follows-hyperlink nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
524 "*Non-nil means mouse button1 click will follow hyperlink."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
525 :type 'boolean
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
526 :group 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
527
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
528 (defvar Info-standalone nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
529 "Non-nil if Emacs was started solely as an Info browser.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
530
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
531 (defvar Info-in-cross-reference nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
532 (defvar Info-window-configuration nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
533
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
534 (defvar Info-dir-prologue "-*- Text -*-
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
535 This is the file .../info/dir, which contains the topmost node of the
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
536 Info hierarchy. The first time you invoke Info you start off
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
537 looking at that node, which is (dir)Top.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
538 
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
539 File: dir Node: Top This is the top of the INFO tree
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
540 This (the Directory node) gives a menu of major topics.
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
541
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
542 * Menu: The list of major topics begins on the next line.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
543
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
544 ")
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
545
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
546 (defvar Info-no-description-string "[No description available]"
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
547 "Description string for info files that have none")
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
548
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
549 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
550 (defun info (&optional file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
551 "Enter Info, the documentation browser.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
552 Optional argument FILE specifies the file to examine;
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
553 the default is the top-level directory of Info.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
554
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
555 In interactive use, a prefix argument directs this command
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
556 to read a file name from the minibuffer."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
557 (interactive (if current-prefix-arg
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
558 (list (read-file-name "Info file name: " nil nil t))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
559 (let ((p command-line-args))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
560 (while p
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
561 (and (string-match "^-[fe]" (car p))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
562 (equal (nth 1 p) "info")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
563 (not Info-standalone)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
564 (setq Info-standalone t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
565 (= (length p) 3)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
566 (not (string-match "^-" (nth 2 p)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
567 (setq file (nth 2 p))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
568 (setq command-line-args-left nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
569 (setq p (cdr p))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
570 ; (Info-setup-x) ??? What was this going to be? Can anyone tell karlheg?
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
571 (if file
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
572 (unwind-protect
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
573 (Info-goto-node (concat "(" file ")"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
574 (and Info-standalone (info)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
575 (if (get-buffer "*info*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
576 (switch-to-buffer "*info*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
577 (Info-directory))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
578
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
579 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
580 (defun Info-query (file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
581 "Enter Info, the documentation browser. Prompt for name of Info file."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
582 (interactive "sInfo topic (default = menu): ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
583 (info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
584 (if (equal file "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
585 (Info-goto-node "(dir)")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
586 (Info-goto-node (concat "(" file ")"))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
587
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
588 (defun Info-setup-initial ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
589 (let ((f Info-annotations-path))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
590 (while f
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
591 (if (and (file-exists-p (car f)) (not (get-file-buffer (car f))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
592 (bury-buffer (find-file-noselect (car f))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
593 (setq f (cdr f)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
594
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
595 (defun Info-find-node (filename &optional nodename no-going-back tryfile line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
596 "Go to an info node specified as separate FILENAME and NODENAME.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
597 Look for a plausible filename, or if not found then look for URL's and
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
598 dispatch to the appropriate fn. NO-GOING-BACK is non-nil if
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
599 recovering from an error in this function; it says do not attempt
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
600 further (recursive) error recovery. TRYFILE is ??"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
601
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
602 (Info-setup-initial)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
603
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
604 (cond
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
605 ;; empty filename is simple case
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
606 ((null filename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
607 (Info-find-file-node nil nodename no-going-back tryfile line))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
608 ;; Convert filename to lower case if not found as specified.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
609 ;; Expand it, look harder...
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
610 ((let (temp temp-downcase found
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
611 (fname (substitute-in-file-name filename)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
612 (let ((dirs (cond
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
613 ((string-match "^\\./" fname) ; If specified name starts with `./'
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
614 (list default-directory)) ; then just try current directory.
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
615 ((file-name-absolute-p fname)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
616 '(nil)) ; No point in searching for an absolute file name
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
617 (Info-additional-search-directory-list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
618 (append Info-directory-list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
619 Info-additional-search-directory-list))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
620 (t Info-directory-list))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
621 ;; Search the directory list for file FNAME.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
622 (while (and dirs (not found))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
623 (setq temp (expand-file-name fname (car dirs)))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
624 (setq temp-downcase
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
625 (expand-file-name (downcase fname) (car dirs)))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
626 (if (equal temp-downcase temp) (setq temp-downcase nil))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
627 ;; Try several variants of specified name.
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
628 ;; Try downcasing, appending a suffix, or both.
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
629 (setq found (Info-suffixed-file temp temp-downcase))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
630 (setq dirs (cdr dirs)))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
631 (if found
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
632 (progn (setq filename (expand-file-name found))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
633 t))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
634 (Info-find-file-node filename nodename no-going-back tryfile line))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
635 ;; Look for a URL. This pattern is stolen from w3.el to prevent
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
636 ;; loading it if we won't need it.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
637 ((string-match (concat "^\\(wais\\|solo\\|x-exec\\|newspost\\|www\\|"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
638 "mailto\\|news\\|tn3270\\|ftp\\|http\\|file\\|"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
639 "telnet\\|gopher\\):")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
640 filename)
219
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 217
diff changeset
641 (if (fboundp 'browse-url)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 217
diff changeset
642 (browse-url filename)
262b8bb4a523 Import from CVS: tag r20-4b8
cvs
parents: 217
diff changeset
643 (error "Cannot follow URLs in this XEmacs")))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
644 (t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
645 (error "Info file %s does not exist" filename))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
646
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
647 (defun Info-find-file-node (filename nodename
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
648 &optional no-going-back tryfile line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
649 ;; This is the guts of what was Info-find-node. Whoever wrote this
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
650 ;; should be locked up where they can't do any more harm.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
651
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
652 ;; Go into info buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
653 (switch-to-buffer "*info*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
654 (buffer-disable-undo (current-buffer))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
655 (run-hooks 'Info-startup-hook)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
656 (or (eq major-mode 'Info-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
657 (Info-mode))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
658 (or (null filename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
659 (equal Info-current-file filename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
660 (not Info-novice)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
661 (string= "dir" (file-name-nondirectory Info-current-file))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
662 (if (y-or-n-p-maybe-dialog-box
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
663 (format "Leave Info file `%s'? "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
664 (file-name-nondirectory Info-current-file)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
665 (message "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
666 (keyboard-quit)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
667 ;; Record the node we are leaving.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
668 (if (and Info-current-file (not no-going-back))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
669 (Info-history-add Info-current-file Info-current-node (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
670 (widen)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
671 (setq Info-current-node nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
672 Info-in-cross-reference nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
673 (unwind-protect
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
674 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
675 ;; Switch files if necessary
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
676 (or (null filename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
677 (equal Info-current-file filename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
678 (let ((buffer-read-only nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
679 (setq Info-current-file nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
680 Info-current-subfile nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
681 Info-current-file-completions nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
682 Info-index-alternatives nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
683 buffer-file-name nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
684 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
685 (if (string= "dir" (file-name-nondirectory filename))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
686 (Info-insert-dir)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
687 (Info-insert-file-contents filename t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
688 (setq default-directory (file-name-directory filename)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
689 (set-buffer-modified-p nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
690 ;; See whether file has a tag table. Record the location if yes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
691 (set-marker Info-tag-table-marker nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
692 (goto-char (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
693 (forward-line -8)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
694 (or (equal nodename "*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
695 (not (search-forward "\^_\nEnd tag table\n" nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
696 (let (pos)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
697 ;; We have a tag table. Find its beginning.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
698 ;; Is this an indirect file?
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
699 (search-backward "\nTag table:\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
700 (setq pos (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
701 (if (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
702 (forward-line 2)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
703 (looking-at "(Indirect)\n"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
704 ;; It is indirect. Copy it to another buffer
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
705 ;; and record that the tag table is in that buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
706 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
707 (let ((buf (current-buffer)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
708 (set-buffer
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
709 (get-buffer-create " *info tag table*"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
710 (buffer-disable-undo (current-buffer))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
711 (setq case-fold-search t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
712 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
713 (insert-buffer-substring buf)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
714 (set-marker Info-tag-table-marker
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
715 (match-end 0))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
716 (set-marker Info-tag-table-marker pos))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
717 (setq Info-current-file
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
718 (file-name-sans-versions buffer-file-name))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
719 (if (equal nodename "*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
720 (progn (setq Info-current-node nodename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
721 (Info-set-mode-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
722 (goto-char (point-min)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
723 ;; Search file for a suitable node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
724 (let* ((qnode (regexp-quote nodename))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
725 (regexp (concat "Node: *" qnode " *[,\t\n\177]"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
726 (guesspos (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
727 (found t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
728 ;; First get advice from tag table if file has one.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
729 ;; Also, if this is an indirect info file,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
730 ;; read the proper subfile into this buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
731 (if (marker-position Info-tag-table-marker)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
732 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
733 (set-buffer (marker-buffer Info-tag-table-marker))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
734 (goto-char Info-tag-table-marker)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
735 (if (re-search-forward regexp nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
736 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
737 (setq guesspos (read (current-buffer)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
738 ;; If this is an indirect file,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
739 ;; determine which file really holds this node
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
740 ;; and read it in.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
741 (if (not (eq (current-buffer) (get-buffer "*info*")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
742 (setq guesspos
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
743 (Info-read-subfile guesspos)))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
744 (goto-char (max (point-min) (- guesspos 1000)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
745 ;; Now search from our advised position (or from beg of buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
746 ;; to find the actual node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
747 (catch 'foo
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
748 (while (search-forward "\n\^_" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
749 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
750 (let ((beg (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
751 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
752 (if (re-search-backward regexp beg t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
753 (throw 'foo t))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
754 (setq found nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
755 (let ((bufs (delq nil (mapcar 'get-file-buffer
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
756 Info-annotations-path)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
757 (pattern (if (string-match "\\`<<.*>>\\'" qnode) qnode
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
758 (format "\"%s\"\\|<<%s>>" qnode qnode)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
759 (pat2 (concat "------ *File: *\\([^ ].*[^ ]\\) *Node: "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
760 "*\\([^ ].*[^ ]\\) *Line: *\\([0-9]+\\)"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
761 (afile nil) anode aline)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
762 (while (and bufs (not anode))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
763 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
764 (set-buffer (car bufs))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
765 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
766 (if (re-search-forward pattern nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
767 (if (re-search-backward pat2 nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
768 (setq afile (buffer-substring (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
769 (match-end 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
770 anode (buffer-substring (match-beginning 2)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
771 (match-end 2))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
772 aline (string-to-int
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
773 (buffer-substring (match-beginning 3)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
774 (match-end 3)))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
775 (setq bufs (cdr bufs)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
776 (if anode
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
777 (Info-find-node afile anode t nil aline)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
778 (if tryfile
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
779 (condition-case nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
780 (Info-find-node nodename "Top" t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
781 (error nil)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
782 (or Info-current-node
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
783 (error "No such node: %s" nodename)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
784 (if found
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
785 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
786 (Info-select-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
787 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
788 (if line (forward-line line)))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
789 ;; If we did not finish finding the specified node,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
790 ;; go back to the previous one.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
791 (or Info-current-node no-going-back
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
792 (let ((hist (car Info-history)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
793 ;; The following is no longer safe with new Info-history system
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
794 ;; (setq Info-history (cdr Info-history))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
795 (Info-goto-node (car hist) t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
796 (goto-char (+ (point-min) (nth 1 hist)))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
797
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
798 ;; Cache the contents of the (virtual) dir file, once we have merged
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
799 ;; it for the first time, so we can save time subsequently.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
800 (defvar Info-dir-contents nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
801
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
802 ;; Cache for the directory we decided to use for the default-directory
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
803 ;; of the merged dir text.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
804 (defvar Info-dir-contents-directory nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
805
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
806 ;; Record the file attributes of all the files from which we
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
807 ;; constructed Info-dir-contents.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
808 (defvar Info-dir-file-attributes nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
809
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
810 (defun Info-insert-dir ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
811 "Construct the Info directory node by merging the files named
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
812 \"dir\" or \"localdir\" from the directories in `Info-directory-list'
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
813 The \"dir\" files will take precedence in cases where both exist. It
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
814 sets the *info* buffer's `default-directory' to the first directory we
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
815 actually get any text from."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
816 (if (and Info-dir-contents Info-dir-file-attributes
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
817 ;; Verify that none of the files we used has changed
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
818 ;; since we used it.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
819 (eval (cons 'and
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
820 (mapcar #'(lambda (elt)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
821 (let ((curr (file-attributes (car elt))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
822 ;; Don't compare the access time.
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
823 (if curr (setcar (nthcdr 4 curr) 0))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
824 (setcar (nthcdr 4 (cdr elt)) 0)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
825 (equal (cdr elt) curr)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
826 Info-dir-file-attributes))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
827 (insert Info-dir-contents)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
828 (let ((dirs (reverse Info-directory-list))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
829 buffers lbuffers buffer others nodes dirs-done)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
830
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
831 (setq Info-dir-file-attributes nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
832
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
833 ;; Search the directory list for the directory file.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
834 (while dirs
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
835 (let ((truename (file-truename (expand-file-name (car dirs)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
836 (or (member truename dirs-done)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
837 (member (directory-file-name truename) dirs-done)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
838 ;; Try several variants of specified name.
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
839 ;; Try upcasing, appending `.info', or both.
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
840 (let* (buf
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
841 file
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
842 (attrs
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
843 (or
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
844 (progn (setq file (expand-file-name "dir" truename))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
845 (file-attributes file))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
846 (progn (setq file (expand-file-name "DIR" truename))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
847 (file-attributes file))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
848 (progn (setq file (expand-file-name "dir.info" truename))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
849 (file-attributes file))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
850 (progn (setq file (expand-file-name "DIR.INFO" truename))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
851 (file-attributes file))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
852 (progn (setq file (expand-file-name "localdir" truename))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
853 (file-attributes file))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
854 (progn (setq file (expand-file-name "dir" truename))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
855 nil)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
856 )))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
857 (setq dirs-done
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
858 (cons truename
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
859 (cons (directory-file-name truename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
860 dirs-done)))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
861 (Info-maybe-update-dir file)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
862 (setq attrs (file-attributes file))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
863 (if (or (setq buf (find-buffer-visiting file))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
864 attrs)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
865 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
866 (or buffers
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
867 (message "Composing main Info directory..."))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
868 (set-buffer (or buf
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
869 (generate-new-buffer
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
870 (if (string-match "localdir" file)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
871 "localdir"
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
872 "info dir"))))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
873 (if (not buf)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
874 (insert-file-contents file))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
875 (if (string-match "localdir" (buffer-name))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
876 (setq lbuffers (cons (current-buffer) lbuffers))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
877 (setq buffers (cons (current-buffer) buffers)))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
878 (if attrs
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
879 (setq Info-dir-file-attributes
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
880 (cons (cons file attrs)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
881 Info-dir-file-attributes)))))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
882 (or (cdr dirs) (setq Info-dir-contents-directory (car dirs)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
883 (setq dirs (cdr dirs))))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
884
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
885 ;; ensure that the localdir files are inserted last, and reverse
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
886 ;; the list of them so that when they get pushed in, they appear
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
887 ;; in the same order they got specified in the path, from top to
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
888 ;; bottom.
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 292
diff changeset
889 (nconc buffers (reverse lbuffers))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
890
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
891 (or buffers
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
892 (error "Can't find the Info directory node"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
893 ;; Distinguish the dir file that comes with Emacs from all the
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
894 ;; others. Yes, that is really what this is supposed to do.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
895 ;; If it doesn't work, fix it.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
896 (setq buffer (car buffers)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
897 ;; reverse it since they are pushed down from the top. the
269
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 263
diff changeset
898 ;; `Info-directory-list can be specified in natural order
b2472a1930f2 Import from CVS: tag r20-5b33
cvs
parents: 263
diff changeset
899 ;; this way.
294
4b85ae5eabfb Import from CVS: tag r21-0b45
cvs
parents: 292
diff changeset
900 others (reverse (cdr buffers)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
901
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
902 ;; Insert the entire original dir file as a start; note that we've
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
903 ;; already saved its default directory to use as the default
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
904 ;; directory for the whole concatenation.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
905 (insert-buffer buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
906
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
907 ;; Look at each of the other buffers one by one.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
908 (while others
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
909 (let ((other (car others))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
910 (info-buffer (current-buffer)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
911 (if (string-match "localdir" (buffer-name other))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
912 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
913 (set-buffer info-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
914 (goto-char (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
915 (cond
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
916 ((re-search-backward "^ *\\* *Locals *: *$" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
917 (delete-region (match-beginning 0) (match-end 0)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
918 ;; look for a line like |Local XEmacs packages:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
919 ;; or mismatch on some text ...
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
920 ((re-search-backward Info-localdir-heading-regexp nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
921 ;; This is for people who underline topic headings with
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
922 ;; equal signs or dashes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
923 (when (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
924 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
925 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
926 (looking-at "^[ \t]*[-=*]+"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
927 (forward-line 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
928 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
929 (beginning-of-line))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
930 (t (search-backward "\^L" nil t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
931 ;; Insert menu part of the file
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
932 (let* ((pt (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
933 (len (length (buffer-string nil nil other))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
934 (insert (buffer-string nil nil other))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
935 (goto-char (+ pt len))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
936 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
937 (goto-char pt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
938 (if (search-forward "* Menu:" (+ pt len) t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
939 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
940 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
941 (delete-region pt (point)))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
942 ;; In each, find all the menus.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
943 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
944 (set-buffer other)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
945 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
946 ;; Find each menu, and add an elt to NODES for it.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
947 (while (re-search-forward "^\\* Menu:" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
948 (let (beg nodename end)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
949 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
950 (setq beg (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
951 (search-backward "\n\^_")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
952 (search-forward "Node: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
953 (setq nodename (Info-following-node-name))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
954 (search-forward "\n\^_" nil 'move)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
955 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
956 (setq end (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
957 (setq nodes (cons (list nodename other beg end) nodes))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
958 (setq others (cdr others))))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
959
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
960 ;; Add to the main menu a menu item for each other node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
961 (re-search-forward "^\\* Menu:" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
962 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
963 (let ((menu-items '("top"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
964 (nodes nodes)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
965 (case-fold-search t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
966 (end (save-excursion (search-forward "\^_" nil t) (point))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
967 (while nodes
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
968 (let ((nodename (car (car nodes))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
969 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
970 (or (member (downcase nodename) menu-items)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
971 (re-search-forward (concat "^\\* "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
972 (regexp-quote nodename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
973 "::")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
974 end t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
975 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
976 (insert "* " nodename "::" "\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
977 (setq menu-items (cons nodename menu-items))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
978 (setq nodes (cdr nodes))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
979 ;; Now take each node of each of the other buffers
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
980 ;; and merge it into the main buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
981 (while nodes
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
982 (let ((nodename (car (car nodes))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
983 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
984 ;; Find the like-named node in the main buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
985 (if (re-search-forward (concat "\n\^_.*\n.*Node: "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
986 (regexp-quote nodename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
987 "[,\n\t]")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
988 nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
989 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
990 (search-forward "\n\^_" nil 'move)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
991 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
992 (insert "\n"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
993 ;; If none exists, add one.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
994 (goto-char (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
995 (insert "\^_\nFile: dir\tNode: " nodename "\n\n* Menu:\n\n"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
996 ;; Merge the text from the other buffer's menu
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
997 ;; into the menu in the like-named node in the main buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
998 (apply 'insert-buffer-substring (cdr (car nodes))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
999 (setq nodes (cdr nodes)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1000 ;; Kill all the buffers we just made.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1001 (while buffers
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1002 (kill-buffer (car buffers))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1003 (setq buffers (cdr buffers)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1004 (while lbuffers
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1005 (kill-buffer (car lbuffers))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1006 (setq lbuffers (cdr lbuffers)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1007 (message "Composing main Info directory...done"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1008 (setq Info-dir-contents (buffer-string)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1009 (setq default-directory Info-dir-contents-directory)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1010 (setq buffer-file-name (caar Info-dir-file-attributes)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1011
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1012 (defun Info-maybe-update-dir (file)
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1013 "Rebuild dir or localdir according to `Info-auto-generate-directory'."
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1014 (unless (or (not (file-exists-p (file-name-directory file)))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1015 (null (directory-files (file-name-directory file) nil "\\.info")))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1016 (if (not (find-buffer-visiting file))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1017 (if (not (file-exists-p file))
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1018 (if (or (eq Info-auto-generate-directory 'always)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1019 (eq Info-auto-generate-directory 'if-missing))
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1020 (Info-build-dir-anew (file-name-directory file)))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1021 (if (or (eq Info-auto-generate-directory 'always)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1022 (and (eq Info-auto-generate-directory 'if-outdated)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1023 (Info-dir-outdated-p file)))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1024 (Info-rebuild-dir file))))))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1025
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1026 ;; Record which *.info files are newer than the dir file
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1027 (defvar Info-dir-newer-info-files nil)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1028
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1029 (defun Info-dir-outdated-p (file)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1030 "Return non-nil if dir or localdir is outdated.
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1031 dir or localdir are outdated when an info file in the same
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1032 directory has been modified more recently."
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1033 (let ((dir-mod-time (nth 5 (file-attributes file)))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1034 f-mod-time
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1035 newer)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1036 (setq Info-dir-newer-info-files nil)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1037 (mapcar
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1038 #'(lambda (f)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1039 (prog2
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1040 (setq f-mod-time (nth 5 (file-attributes f)))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1041 (setq newer (or (> (car f-mod-time) (car dir-mod-time))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1042 (and (= (car f-mod-time) (car dir-mod-time))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1043 (> (car (cdr f-mod-time)) (car (cdr dir-mod-time))))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1044 (if (and (file-readable-p f)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1045 newer)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1046 (setq Info-dir-newer-info-files
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1047 (cons f Info-dir-newer-info-files)))))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1048 (directory-files (file-name-directory file)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1049 'fullname
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1050 ".*\\.info\\(\\.gz\\|\\.bz2\\|\\.Z\\|-z\\|\\.zip\\)?$"
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1051 'nosort
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1052 t))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1053 Info-dir-newer-info-files))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1054
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1055 (defun Info-extract-dir-entry-from (file)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1056 "Extract the dir entry from the info FILE.
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1057 The dir entry is delimited by the markers `START-INFO-DIR-ENTRY'
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1058 and `END-INFO-DIR-ENTRY'"
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1059 (save-excursion
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1060 (set-buffer (get-buffer-create " *Info-tmp*"))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1061 (when (file-readable-p file)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1062 (insert-file-contents file nil nil nil t)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1063 (goto-char (point-min))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1064 (let (beg)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1065 (unless (null (re-search-forward "^START-INFO-DIR-ENTRY" nil t))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1066 (forward-line 1)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1067 (setq beg (point))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1068 (unless (null (re-search-forward "^END-INFO-DIR-ENTRY" nil t))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1069 (goto-char (match-beginning 0))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1070 (car (Info-parse-dir-entries beg (point)))))))))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1071
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1072 ;; Parse dir entries contained between BEG and END into a list of the form
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1073 ;; (filename topic node (description-line-1 description-line-2 ...))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1074 (defun Info-parse-dir-entries (beg end)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1075 (let (entry entries)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1076 (save-excursion
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1077 (save-restriction
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1078 (narrow-to-region beg end)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1079 (goto-char beg)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1080 (while (re-search-forward "^\\* \\([^:]+\\):\\([ \t]*(\\([^)]*\\))\\w*\\.\\|:\\)" nil t)
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1081 (setq entry (list (match-string 2)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1082 (match-string 1)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1083 (downcase (or (match-string 3)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1084 (match-string 1)))))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1085 (setq entry
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1086 (cons (nreverse
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1087 (cdr
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1088 (nreverse
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1089 (split-string
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1090 (buffer-substring
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1091 (re-search-forward "[ \t]*" nil t)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1092 (or (and (re-search-forward "^[^ \t]" nil t)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1093 (goto-char (match-beginning 0)))
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1094 (point-max)))
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1095 "[ \t]*\n[ \t]*"))))
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1096 entry))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1097 (setq entries (cons (nreverse entry) entries)))))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1098 (nreverse entries)))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1099
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1100 (defun Info-dump-dir-entries (entries)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1101 (let ((tab-width 8)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1102 (description-col 0)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1103 len)
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1104 (mapcar #'(lambda (e)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1105 (setq e (cdr e)) ; Drop filename
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1106 (setq len (length (concat (car e)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1107 (car (cdr e)))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1108 (if (> len description-col)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1109 (setq description-col len)))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1110 entries)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1111 (setq description-col (+ 5 description-col))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1112 (mapcar #'(lambda (e)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1113 (setq e (cdr e)) ; Drop filename
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1114 (insert "* " (car e) ":" (car (cdr e)))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1115 (setq e (car (cdr (cdr e))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1116 (while e
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1117 (indent-to-column description-col)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1118 (insert (car e) "\n")
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1119 (setq e (cdr e))))
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1120 entries)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1121 (insert "\n")))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1122
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1123
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1124 (defun Info-build-dir-anew (directory)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1125 "Build info directory information for DIRECTORY.
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1126 The generated directory listing may be saved to a `dir' according
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1127 to the value of `Info-save-auto-generated-dir'"
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1128 (save-excursion
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1129 (let* ((dirfile (expand-file-name "dir" directory))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1130 (to-temp (or (null Info-save-auto-generated-dir)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1131 (eq Info-save-auto-generated-dir 'never)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1132 (and (not (file-writable-p dirfile))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1133 (message "File not writable %s. Using temporary." dirfile))))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1134 (info-files
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1135 (directory-files directory
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1136 'fullname
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1137 ".*\\.info\\(.gz\\|.Z\\|-z\\|.zip\\)?$"
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1138 nil
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1139 t)))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1140 (if to-temp
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1141 (message "Creating temporary dir in %s..." directory)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1142 (message "Creating %s..." dirfile))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1143 (set-buffer (find-file-noselect dirfile t))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1144 (setq buffer-read-only nil)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1145 (erase-buffer)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1146 (insert Info-dir-prologue
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1147 "Info files in " directory ":\n\n")
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1148 (Info-dump-dir-entries
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1149 (mapcar
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1150 #'(lambda (f)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1151 (or (Info-extract-dir-entry-from f)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1152 (list 'dummy
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1153 (progn
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1154 (string-match "\\(.*\\)\\.info\\(.gz\\|.Z\\|-z\\|.zip\\)?$"
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1155 (file-name-nondirectory f))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1156 (capitalize (match-string 1 (file-name-nondirectory f))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1157 ":"
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1158 (list Info-no-description-string))))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1159 info-files))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1160 (if to-temp
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1161 (set-buffer-modified-p nil)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1162 (save-buffer))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1163 (if to-temp
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1164 (message "Creating temporary dir in %s...done" directory)
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1165 (message "Creating %s...done" dirfile)))))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1166
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1167
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1168 (defun Info-rebuild-dir (file)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1169 "Build info directory information in the directory of dir FILE.
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1170 Description of info files are merged from the info files in the
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1171 directory and the contents of FILE with the description in info files
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1172 taking precedence over descriptions in FILE.
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1173 The generated directory listing may be saved to a `dir' according to
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1174 the value of `Info-save-auto-generated-dir' "
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1175 (save-excursion
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1176 (save-restriction
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1177 (let (dir-section-contents dir-full-contents
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1178 dir-entry
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1179 file-dir-entry
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1180 mark next-section
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1181 not-first-section
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1182 (to-temp
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1183 (or (null Info-save-auto-generated-dir)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1184 (eq Info-save-auto-generated-dir 'never)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1185 (and (eq Info-save-auto-generated-dir 'always)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1186 (not (file-writable-p file))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1187 (message "File not writable %s. Using temporary." file))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1188 (and (eq Info-save-auto-generated-dir 'conservative)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1189 (or (and (not (file-writable-p file))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1190 (message "File not writable %s. Using temporary." file))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1191 (not (y-or-n-p
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1192 (message "%s is outdated. Overwrite ? "
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1193 file))))))))
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1194 (set-buffer (find-file-noselect file t))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1195 (setq buffer-read-only nil)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1196 (if to-temp
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1197 (message "Rebuilding temporary %s..." file)
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1198 (message "Rebuilding %s..." file))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1199 (catch 'done
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1200 (setq buffer-read-only nil)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1201 (goto-char (point-min))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1202 (unless (and (search-forward "\^_")
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1203 (re-search-forward "^\\* Menu:.*$" nil t)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1204 (setq mark (and (re-search-forward "^\\* " nil t)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1205 (match-beginning 0))))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1206 (throw 'done nil))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1207 (setq dir-full-contents (Info-parse-dir-entries mark (point-max)))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1208 (setq next-section (or (and (re-search-forward "^[^* \t].*:[ \t]*$" nil t)
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1209 (match-beginning 0))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1210 (point-max)))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1211 (while next-section
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1212 (narrow-to-region mark next-section)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1213 (setq dir-section-contents (nreverse (Info-parse-dir-entries (point-min)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1214 (point-max))))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1215 (mapcar
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1216 #'(lambda (file)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1217 (setq dir-entry (assoc (downcase
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1218 (file-name-sans-extension
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1219 (file-name-nondirectory file)))
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1220 dir-section-contents)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1221 file-dir-entry (Info-extract-dir-entry-from file))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1222 (if dir-entry
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1223 (if file-dir-entry
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1224 ;; A dir entry in the info file takes precedence over an
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1225 ;; existing entry in the dir file
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1226 (setcdr dir-entry (cdr file-dir-entry)))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1227 (unless (or not-first-section
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1228 (assoc (downcase
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1229 (file-name-sans-extension
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1230 (file-name-nondirectory file)))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1231 dir-full-contents))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1232 (if file-dir-entry
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1233 (setq dir-section-contents (cons file-dir-entry
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1234 dir-section-contents))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1235 (setq dir-section-contents
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1236 (cons (list 'dummy
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1237 (capitalize (file-name-sans-extension
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1238 (file-name-nondirectory file)))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1239 ":"
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1240 (list Info-no-description-string))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1241 dir-section-contents))))))
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1242 Info-dir-newer-info-files)
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1243 (delete-region (point-min) (point-max))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1244 (Info-dump-dir-entries (nreverse dir-section-contents))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1245 (widen)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1246 (if (= next-section (point-max))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1247 (setq next-section nil)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1248 (or (setq mark (and (re-search-forward "^\\* " nil t)
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1249 (match-beginning 0)))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1250 (throw 'done nil))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1251 (setq next-section (or (and (re-search-forward "^[^* \t].*:[ \t]*$" nil t)
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1252 (match-beginning 0))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1253 (point-max))))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1254 (setq not-first-section t)))
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1255 (if to-temp
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1256 (progn
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1257 (set-buffer-modified-p nil)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1258 (message "Rebuilding temporary %s...done" file))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1259 (save-buffer)
274
ca9a9ec9c1c1 Import from CVS: tag r21-0b35
cvs
parents: 272
diff changeset
1260 (message "Rebuilding %s...done" file))))))
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1261
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1262 ;;;###autoload
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1263 (defun Info-batch-rebuild-dir ()
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1264 "(Re)build info `dir' files in the directories remaining on the command line.
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1265 Use this from the command line, with `-batch';
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1266 it won't work in an interactive Emacs.
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1267 Each file is processed even if an error occurred previously.
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1268 For example, invoke \"xemacs -batch -f Info-batch-rebuild-dir /usr/local/info\""
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1269 ;; command-line-args-left is what is left of the command line (from
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1270 ;; startup.el)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1271 (defvar command-line-args-left) ; Avoid 'free variable' warning
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1272 (if (not noninteractive)
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
1273 (error "`Info-batch-rebuild-dir' is to be used only with -batch"))
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1274 (let ((Info-save-auto-generated-dir 'always)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1275 dir localdir)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1276 (while command-line-args-left
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1277 (if (not (file-directory-p (car command-line-args-left)))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1278 (message "Warning: Skipped %s. Not a directory."
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1279 (car command-line-args-left))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1280 (setq dir (expand-file-name "dir" (car command-line-args-left)))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1281 (setq localdir (expand-file-name "localdir" (car command-line-args-left)))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1282 (cond
292
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1283 ((file-exists-p dir)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1284 (Info-rebuild-dir dir))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1285 ((file-exists-p localdir)
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1286 (Info-rebuild-dir localdir))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1287 (t
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1288 (Info-build-dir-anew (car command-line-args-left)))))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1289 (setq command-line-args-left (cdr command-line-args-left)))
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1290 (message "Done")
6cb5e14cd98e Import from CVS: tag r21-0b44
cvs
parents: 284
diff changeset
1291 (kill-emacs 0)))
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 269
diff changeset
1292
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1293 (defun Info-history-add (file node point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1294 (if Info-keeping-history
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1295 (let* ((name (format "(%s)%s" (Info-file-name-only file) node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1296 (found (assoc name Info-history)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1297 (if found
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1298 (setq Info-history (delq found Info-history)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1299 (setq Info-history (cons (list name (- point (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1300 (and (eq (window-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1301 (current-buffer))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1302 (- (window-start) (point-min))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1303 Info-history)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1304
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1305 (defun Info-file-name-only (file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1306 (let ((dir (file-name-directory file))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1307 (p Info-directory-list))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1308 (while (and p (not (equal (car p) dir)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1309 (setq p (cdr p)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1310 (if p (file-name-nondirectory file) file)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1311
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1312 (defun Info-read-subfile (nodepos)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1313 (set-buffer (marker-buffer Info-tag-table-marker))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1314 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1315 (search-forward "\n\^_")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1316 (let (lastfilepos
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1317 lastfilename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1318 (forward-line 2)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1319 (catch 'foo
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1320 (while (not (looking-at "\^_"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1321 (if (not (eolp))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1322 (let ((beg (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1323 thisfilepos thisfilename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1324 (search-forward ": ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1325 (setq thisfilename (buffer-substring beg (- (point) 2)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1326 (setq thisfilepos (read (current-buffer)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1327 ;; read in version 19 stops at the end of number.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1328 ;; Advance to the next line.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1329 (if (eolp)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1330 (forward-line 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1331 (if (> thisfilepos nodepos)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1332 (throw 'foo t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1333 (setq lastfilename thisfilename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1334 (setq lastfilepos thisfilepos))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1335 (throw 'foo t))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1336 (set-buffer (get-buffer "*info*"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1337 (or (equal Info-current-subfile lastfilename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1338 (let ((buffer-read-only nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1339 (setq buffer-file-name nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1340 (widen)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1341 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1342 (Info-insert-file-contents (Info-suffixed-file
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1343 (expand-file-name lastfilename
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1344 (file-name-directory
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1345 Info-current-file)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1346 t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1347 (set-buffer-modified-p nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1348 (setq Info-current-subfile lastfilename)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1349 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1350 (search-forward "\n\^_")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1351 (+ (- nodepos lastfilepos) (point))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1352
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1353 (defun Info-suffixed-file (name &optional name2)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1354 "Look for NAME with each of the `Info-suffix-list' extensions in
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1355 turn. Optional NAME2 is the name of a fallback info file to check
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1356 for; usually a downcased version of NAME."
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1357 (let ((suff Info-suffix-list)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1358 (found nil)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1359 file file2)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1360 (while (and suff (not found))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1361 (setq file (concat name (caar suff))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1362 file2 (and name2 (concat name2 (caar suff))))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1363 (cond
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1364 ((file-regular-p file)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1365 (setq found file))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1366 ((and file2 (file-regular-p file2))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1367 (setq found file2))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1368 (t
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1369 (setq suff (cdr suff)))))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1370 (or found
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1371 (and name (when (file-regular-p name)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1372 name))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1373 (and name2 (when (file-regular-p name2)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1374 name2)))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1375
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1376 (defun Info-insert-file-contents (file &optional visit)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1377 (setq file (expand-file-name file default-directory))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1378 (let ((suff Info-suffix-list))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1379 (while (and suff (or (<= (length file) (length (car (car suff))))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1380 (not (equal (substring file
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1381 (- (length (car (car suff)))))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1382 (car (car suff))))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1383 (setq suff (cdr suff)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1384 (if (stringp (cdr (car suff)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1385 (let ((command (if (string-match "%s" (cdr (car suff)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1386 (format (cdr (car suff)) file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1387 (concat (cdr (car suff)) " < " file))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1388 (message "%s..." command)
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1389 (call-process shell-file-name nil t nil "-c" command)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1390 (message "")
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1391 (when visit
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1392 (setq buffer-file-name file)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1393 (set-buffer-modified-p nil)
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
1394 (clear-visited-file-modtime)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1395 (insert-file-contents file visit))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1396
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1397 (defun Info-select-node ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1398 "Select the node that point is in, after using `g *' to select whole file."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1399 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1400 (widen)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1401 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1402 ;; Find beginning of node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1403 (search-backward "\n\^_")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1404 (forward-line 2)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1405 ;; Get nodename spelled as it is in the node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1406 (re-search-forward "Node:[ \t]*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1407 (setq Info-current-node
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1408 (buffer-substring (point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1409 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1410 (skip-chars-forward "^,\t\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1411 (point))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1412 (Info-set-mode-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1413 ;; Find the end of it, and narrow.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1414 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1415 (let (active-expression)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1416 (narrow-to-region (point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1417 (if (re-search-forward "\n[\^_\f]" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1418 (prog1
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1419 (1- (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1420 (if (looking-at "[\n\^_\f]*execute: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1421 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1422 (goto-char (match-end 0))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1423 (setq active-expression
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1424 (read (current-buffer))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1425 (point-max)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1426 (or (equal Info-footnote-tag "Note")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1427 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1428 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1429 (let ((buffer-read-only nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1430 (bufmod (buffer-modified-p))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1431 (case-fold-search t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1432 (while (re-search-forward "\\*[Nn]ote\\([ \n]\\)" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1433 (replace-match (concat "*" Info-footnote-tag "\ ")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1434 (set-buffer-modified-p bufmod))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1435 (Info-reannotate-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1436 ;; XEmacs: remove v19 test
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1437 (and Info-fontify
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1438 (Info-fontify-node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1439 (run-hooks 'Info-select-hook)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1440 (if Info-enable-active-nodes (eval active-expression)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1441
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1442 (defun Info-set-mode-line ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1443 (setq modeline-buffer-identification
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1444 (list (cons modeline-buffer-id-left-extent "Info: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1445 (cons modeline-buffer-id-right-extent
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1446 (concat
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1447 "("
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1448 (if Info-current-file
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1449 (let ((name (file-name-nondirectory Info-current-file)))
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1450 (if (string-match "\\.info$" name)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1451 (substring name 0 -5)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1452 name))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1453 "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1454 ")"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1455 (or Info-current-node ""))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1456
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1457 ;; Go to an info node specified with a filename-and-nodename string
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1458 ;; of the sort that is found in pointers in nodes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1459
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1460 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1461 (defun Info-goto-node (nodename &optional no-going-back tryfile)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1462 "Go to info node named NAME. Give just NODENAME or (FILENAME)NODENAME.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1463 Actually, the following interpretations of NAME are tried in order:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1464 (FILENAME)NODENAME
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1465 (FILENAME) (using Top node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1466 NODENAME (in current file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1467 TAGNAME (see below)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1468 FILENAME (using Top node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1469 where TAGNAME is a string that appears in quotes: \"TAGNAME\", in an
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1470 annotation for any node of any file. (See `a' and `x' commands.)"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1471 (interactive (list (Info-read-node-name "Goto node, file or tag: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1472 nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1473 (let (filename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1474 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1475 nodename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1476 (setq filename (if (= (match-beginning 1) (match-end 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1477 ""
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1478 (substring nodename (match-beginning 2) (match-end 2)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1479 nodename (substring nodename (match-beginning 3) (match-end 3)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1480 (let ((trim (string-match "\\s *\\'" filename)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1481 (if trim (setq filename (substring filename 0 trim))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1482 (let ((trim (string-match "\\s *\\'" nodename)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1483 (if trim (setq nodename (substring nodename 0 trim))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1484 (Info-find-node (if (equal filename "") nil filename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1485 (if (equal nodename "") "Top" nodename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1486 no-going-back (and tryfile (equal filename "")))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1487
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1488 (defun Info-goto-bookmark ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1489 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1490 (let ((completion-ignore-case nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1491 (tag (completing-read "Goto tag: "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1492 (Info-build-annotation-completions)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1493 nil t nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1494 'Info-minibuffer-history)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1495 (or (equal tag "") (Info-find-node nil (format "<<%s>>" tag)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1496
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1497 ;;;###autoload
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1498 (defun Info-visit-file (file)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1499 "Directly visit an info file."
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1500 (interactive "fVisit Info file: ")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1501 (Info-find-node (expand-file-name file) "Top"))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1502
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1503 (defun Info-restore-point (&optional always)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1504 "Restore point to same location it had last time we were in this node."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1505 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1506 (if (or Info-restoring-point always)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1507 (let* ((name (format "(%s)%s"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1508 (Info-file-name-only Info-current-file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1509 Info-current-node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1510 (p (assoc name Info-history)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1511 (if p (Info-restore-history-entry p)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1512
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1513 (defun Info-restore-history-entry (entry)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1514 (goto-char (+ (nth 1 entry) (point-min)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1515 (and (nth 2 entry)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1516 (get-buffer-window (current-buffer))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1517 (set-window-start (get-buffer-window (current-buffer))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1518 (+ (nth 2 entry) (point-min)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1519
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1520 (defvar Info-read-node-completion-table)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1521
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1522 ;; This function is used as the "completion table" while reading a node name.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1523 ;; It does completion using the alist in Info-read-node-completion-table
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1524 ;; unless STRING starts with an open-paren.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1525 (defun Info-read-node-name-1 (string predicate code)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1526 (let ((no-completion (and (> (length string) 0) (eq (aref string 0) ?\())))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1527 (cond ((eq code nil)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1528 (if no-completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1529 string
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1530 (try-completion string Info-read-node-completion-table predicate)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1531 ((eq code t)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1532 (if no-completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1533 nil
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1534 (all-completions string Info-read-node-completion-table predicate)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1535 ((eq code 'lambda)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1536 (if no-completion
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1537 t
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1538 (assoc string Info-read-node-completion-table))))))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1539
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1540 (defun Info-read-node-name (prompt &optional default)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1541 (Info-setup-initial)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1542 (let* ((completion-ignore-case t)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1543 (Info-read-node-completion-table (Info-build-node-completions))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1544 (nodename (completing-read prompt 'Info-read-node-name-1
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1545 nil t nil 'Info-minibuffer-history
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1546 default)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1547 (if (equal nodename "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1548 (or default
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1549 (Info-read-node-name prompt))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1550 nodename)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1551
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1552 (defun Info-build-annotation-completions ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1553 (or Info-current-annotation-completions
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1554 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1555 (let ((bufs (delq nil (mapcar 'get-file-buffer
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1556 Info-annotations-path)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1557 (compl nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1558 (while bufs
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1559 (set-buffer (car bufs))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1560 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1561 (while (re-search-forward "<<\\(.*\\)>>" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1562 (setq compl (cons (list (buffer-substring (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1563 (match-end 1)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1564 compl)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1565 (setq bufs (cdr bufs)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1566 (setq Info-current-annotation-completions compl)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1567
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1568 (defun Info-build-node-completions ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1569 (or Info-current-file-completions
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1570 (let ((compl (Info-build-annotation-completions)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1571 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1572 (save-restriction
394
7d59cb494b73 Import from CVS: tag r21-2-12
cvs
parents: 380
diff changeset
1573 (widen)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1574 (if (marker-buffer Info-tag-table-marker)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1575 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1576 (set-buffer (marker-buffer Info-tag-table-marker))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1577 (goto-char Info-tag-table-marker)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1578 (while (re-search-forward "\nNode: \\(.*\\)\177" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1579 (setq compl
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1580 (cons (list (buffer-substring (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1581 (match-end 1)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1582 compl))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1583 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1584 (while (search-forward "\n\^_" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1585 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1586 (let ((beg (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1587 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1588 (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1589 beg t)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1590 (setq compl
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1591 (cons (list (buffer-substring (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1592 (match-end 1)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1593 compl))))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1594 (setq Info-current-file-completions compl))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1595
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1596 (defvar Info-last-search nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1597 "Default regexp for \\<Info-mode-map>\\[Info-search] command to search for.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1598
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1599
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1600 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1601 (defun Info-search (regexp)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1602 "Search for REGEXP, starting from point, and select node it's found in."
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1603 (interactive (list
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1604 (read-from-minibuffer
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1605 (if Info-last-search
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1606 (format "Search (regexp, default %s): "
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1607 Info-last-search)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1608 "Search (regexp): ")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1609 nil nil nil nil nil Info-last-search)))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1610 (setq Info-last-search regexp)
375
a300bb07d72d Import from CVS: tag r21-2b3
cvs
parents: 373
diff changeset
1611 (with-search-caps-disable-folding regexp t
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1612 (let ((found ())
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1613 (onode Info-current-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1614 (ofile Info-current-file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1615 (opoint (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1616 (osubfile Info-current-subfile))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1617 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1618 (save-restriction
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1619 (widen)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1620 (if (null Info-current-subfile)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1621 (progn (re-search-forward regexp) (setq found (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1622 (condition-case nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1623 (progn (re-search-forward regexp) (setq found (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1624 (search-failed nil)))))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1625 (if (not found) ;can only happen in subfile case -- else would have erred
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1626 (unwind-protect
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1627 (let ((list ()))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1628 (set-buffer (marker-buffer Info-tag-table-marker))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1629 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1630 (search-forward "\n\^_\nIndirect:")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1631 (save-restriction
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1632 (narrow-to-region (point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1633 (progn (search-forward "\n\^_")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1634 (1- (point))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1635 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1636 (search-forward (concat "\n" osubfile ": "))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1637 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1638 (while (not (eobp))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1639 (re-search-forward "\\(^.*\\): [0-9]+$")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1640 (goto-char (+ (match-end 1) 2))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1641 (setq list (cons (cons (read (current-buffer))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1642 (buffer-substring (match-beginning 1)
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1643 (match-end 1)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1644 list))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1645 (goto-char (1+ (match-end 0))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1646 (setq list (nreverse list)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1647 list (cdr list)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1648 (while list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1649 (message "Searching subfile %s..." (cdr (car list)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1650 (Info-read-subfile (car (car list)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1651 (setq list (cdr list))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1652 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1653 (if (re-search-forward regexp nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1654 (setq found (point) list ())))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1655 (if found
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1656 (message "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1657 (signal 'search-failed (list regexp))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1658 (if (not found)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1659 (progn (Info-read-subfile opoint)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1660 (goto-char opoint)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1661 (Info-select-node)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1662 (widen)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1663 (goto-char found)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1664 (Info-select-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1665 (or (and (equal onode Info-current-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1666 (equal ofile Info-current-file))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1667 (Info-history-add ofile onode opoint)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1668
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1669 ;; Extract the value of the node-pointer named NAME.
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1670 ;; If there is none, use ERRORNAME in the error message;
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1671 ;; if ERRORNAME is nil, just return nil.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1672 (defun Info-extract-pointer (name &optional errorname)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1673 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1674 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1675 (forward-line 4)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1676 (let ((case-fold-search t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1677 (if (re-search-backward (concat name ":") nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1678 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1679 (goto-char (match-end 0))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1680 (Info-following-node-name))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1681 (if (eq errorname t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1682 nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1683 (error (concat "Node has no " (capitalize (or errorname name)))))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1684
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1685 ;; Return the node name in the buffer following point.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1686 ;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1687 ;; saying which chars may appear in the node name.
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1688 (defun Info-following-node-name (&optional allowedchars)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1689 (skip-chars-forward " \t")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1690 (buffer-substring
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1691 (point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1692 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1693 (while (looking-at (concat "[" (or allowedchars "^,\t\n") "]"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1694 (skip-chars-forward (concat (or allowedchars "^,\t\n") "("))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1695 (if (looking-at "(")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1696 (skip-chars-forward "^)")))
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1697 (skip-chars-backward " .")
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1698 (point))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1699
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1700 (defun Info-next (&optional n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1701 "Go to the next node of this node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1702 A positive or negative prefix argument moves by multiple nodes."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1703 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1704 (or n (setq n 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1705 (if (< n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1706 (Info-prev (- n))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1707 (while (>= (setq n (1- n)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1708 (Info-goto-node (Info-extract-pointer "next")))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1709
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1710 (defun Info-prev (&optional n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1711 "Go to the previous node of this node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1712 A positive or negative prefix argument moves by multiple nodes."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1713 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1714 (or n (setq n 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1715 (if (< n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1716 (Info-next (- n))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1717 (while (>= (setq n (1- n)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1718 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous")))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1719
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1720 (defun Info-up (&optional n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1721 "Go to the superior node of this node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1722 A positive prefix argument moves up several times."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1723 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1724 (or n (setq n 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1725 (while (>= (setq n (1- n)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1726 (Info-goto-node (Info-extract-pointer "up")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1727 (if (interactive-p) (Info-restore-point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1728
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1729 (defun Info-last (&optional n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1730 "Go back to the last node visited.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1731 With a prefix argument, go to Nth most recently visited node. History is
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1732 circular; after oldest node, history comes back around to most recent one.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1733 Argument can be negative to go through the circle in the other direction.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1734 \(In other words, `l' is like \"undo\" and `C-u - l' is like \"redo\".)"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1735 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1736 (or n (setq n 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1737 (or Info-history
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1738 (error "This is the first Info node you looked at"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1739 (let ((len (1+ (length Info-history))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1740 (setq n (% (+ n (* len 100)) len)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1741 (if (> n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1742 (let ((entry (nth (1- n) Info-history)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1743 (Info-history-add Info-current-file Info-current-node (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1744 (while (>= (setq n (1- n)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1745 (setq Info-history (nconc (cdr Info-history)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1746 (list (car Info-history)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1747 (setq Info-history (cdr Info-history))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1748 (let ((Info-keeping-history nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1749 (Info-goto-node (car entry)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1750 (Info-restore-history-entry entry))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1751
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1752 (defun Info-directory ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1753 "Go to the Info directory node."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1754 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1755 (Info-find-node "dir" "top"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1756
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1757 (defun Info-follow-reference (footnotename)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1758 "Follow cross reference named NAME to the node it refers to.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1759 NAME may be an abbreviation of the reference name."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1760 (interactive
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1761 (let ((completion-ignore-case t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1762 completions default (start-point (point)) str i)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1763 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1764 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1765 (while (re-search-forward (format "\\*%s[ \n\t]*\\([^:]*\\):"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1766 Info-footnote-tag)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1767 nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1768 (setq str (buffer-substring
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1769 (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1770 (1- (point))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1771 ;; See if this one should be the default.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1772 (and (null default)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1773 (< (match-beginning 0) start-point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1774 (<= start-point (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1775 (setq default t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1776 (setq i 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1777 (while (setq i (string-match "[ \n\t]+" str i))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1778 (setq str (concat (substring str 0 i) " "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1779 (substring str (match-end 0))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1780 (setq i (1+ i)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1781 ;; Record as a completion and perhaps as default.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1782 (if (eq default t) (setq default str))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1783 (setq completions
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1784 (cons (cons str nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1785 completions))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1786 (if completions
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1787 (let ((item (completing-read (if default
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1788 (concat "Follow reference named: ("
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1789 default ") ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1790 "Follow reference named: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1791 completions nil t nil
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1792 'Info-minibuffer-history
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1793 default)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1794 (if (and (string= item "") default)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1795 (list default)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1796 (list item)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1797 (error "No cross-references in this node"))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1798 (let (target i (str (concat "\\*" Info-footnote-tag " "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1799 (regexp-quote footnotename))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1800 (while (setq i (string-match " " str i))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1801 (setq str (concat (substring str 0 i) "\\([ \t\n]+\\)"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1802 (substring str (1+ i))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1803 (setq i (+ i 10)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1804 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1805 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1806 (or (re-search-forward str nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1807 (error "No cross-reference named %s" footnotename))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1808 (goto-char (match-end 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1809 (setq target
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1810 (Info-extract-menu-node-name "Bad format cross reference" t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1811 (while (setq i (string-match "[ \t\n]+" target i))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1812 (setq target (concat (substring target 0 i) " "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1813 (substring target (match-end 0))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1814 (setq i (+ i 1)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1815 (Info-goto-node target)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1816 (setq Info-in-cross-reference t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1817
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1818 (defun Info-next-reference (n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1819 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1820 (let ((pat (format "\\*%s[ \n\t]*\\([^:]*\\):\\|^\\* .*:\\|<<.*>>"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1821 Info-footnote-tag))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1822 (old-pt (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1823 wrapped found-nomenu)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1824 (while (< n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1825 (unless (re-search-backward pat nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1826 ;; Don't wrap more than once in a buffer where only the
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1827 ;; menu references are found.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1828 (when (and wrapped (not found-nomenu))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1829 (goto-char old-pt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1830 (error "No cross references in this node"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1831 (setq wrapped t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1832 (goto-char (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1833 (unless (re-search-backward pat nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1834 (goto-char old-pt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1835 (error "No cross references in this node")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1836 (unless (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1837 (goto-char (match-beginning 0))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1838 (when (looking-at "\\* Menu:")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1839 (decf n)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1840 (setq found-nomenu t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1841 (incf n))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1842 (while (> n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1843 (or (eobp) (forward-char 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1844 (unless (re-search-forward pat nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1845 (when (and wrapped (not found-nomenu))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1846 (goto-char old-pt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1847 (error "No cross references in this node"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1848 (setq wrapped t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1849 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1850 (unless (re-search-forward pat nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1851 (goto-char old-pt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1852 (error "No cross references in this node")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1853 (unless (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1854 (goto-char (match-beginning 0))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1855 (when (looking-at "\\* Menu:")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1856 (incf n)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1857 (setq found-nomenu t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1858 (decf n))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1859 (when (looking-at "\\* Menu:")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1860 (error "No cross references in this node"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1861 (goto-char (match-beginning 0))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1862
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1863 (defun Info-prev-reference (n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1864 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1865 (Info-next-reference (- n)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1866
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1867 (defun Info-extract-menu-node-name (&optional errmessage multi-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1868 (skip-chars-forward " \t\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1869 (let ((beg (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1870 str i)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1871 (skip-chars-forward "^:")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1872 (forward-char 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1873 (setq str
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1874 (if (looking-at ":")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1875 (buffer-substring beg (1- (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1876 (skip-chars-forward " \t\n")
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1877 ;; Kludge.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1878 ;; Allow dots in node name not followed by whitespace.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1879 (re-search-forward
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1880 (concat "\\(([^)]+)[^."
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1881 (if multi-line "" "\n")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1882 "]*\\|\\([^.,\t"
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1883 (if multi-line "" "\n")
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1884 ;; We consider dots followed by newline as
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1885 ;; end of nodename even if multil-line.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1886 ;; Also stops at .). It is generated by @pxref.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1887 ;; Skips sequential dots.
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1888 "]\\|\\.+[^ \t\n)]\\)+\\)"))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1889 (match-string 1)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1890 (while (setq i (string-match "\n" str i))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1891 (aset str i ?\ ))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1892 str))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1893
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1894 (defun Info-menu (menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1895 "Go to node for menu item named (or abbreviated) NAME.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1896 Completion is allowed, and the menu item point is on is the default."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1897 (interactive
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1898 (let ((completions '())
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1899 ;; If point is within a menu item, use that item as the default
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1900 (default nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1901 (p (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1902 (last nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1903 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1904 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1905 (let ((case-fold-search t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1906 (if (not (search-forward "\n* menu:" nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1907 (error "No menu in this node")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1908 (while (re-search-forward
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1909 "\n\\* \\([^:\t\n]*\\):" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1910 (if (and (null default)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1911 (prog1 (if last (< last p) nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1912 (setq last (match-beginning 0)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1913 (<= p last))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1914 (setq default (car (car completions))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1915 (setq completions (cons (cons (buffer-substring
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1916 (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1917 (match-end 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1918 (match-beginning 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1919 completions)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1920 (if (and (null default) last
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1921 (< last p)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1922 (<= p (progn (end-of-line) (point))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1923 (setq default (car (car completions)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1924 (let ((item nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1925 (while (null item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1926 (setq item (let ((completion-ignore-case t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1927 (completing-read (if default
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1928 (format "Menu item (default %s): "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1929 default)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1930 "Menu item: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1931 completions nil t nil
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1932 'Info-minibuffer-history
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
1933 default)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1934 ;; we rely on the fact that completing-read accepts an input
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1935 ;; of "" even when the require-match argument is true and ""
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1936 ;; is not a valid possibility
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1937 (if (string= item "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1938 (if default
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1939 (setq item default)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1940 ;; ask again
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1941 (setq item nil))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1942 (list item))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1943 ;; there is a problem here in that if several menu items have the same
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1944 ;; name you can only go to the node of the first with this command.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1945 (Info-goto-node (Info-extract-menu-item menu-item) nil t))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
1946
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1947 (defun Info-extract-menu-item (menu-item &optional noerror)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1948 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1949 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1950 (if (let ((case-fold-search t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1951 (search-forward "\n* menu:" nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1952 (if (or (search-forward (concat "\n* " menu-item ":") nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1953 (search-forward (concat "\n* " menu-item) nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1954 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1955 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1956 (forward-char 2)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1957 (Info-extract-menu-node-name))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1958 (and (not noerror) (error "No such item in menu")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1959 (and (not noerror) (error "No menu in this node")))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1960
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1961 ;; If COUNT is nil, use the last item in the menu.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1962 (defun Info-extract-menu-counting (count &optional noerror noindex)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1963 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1964 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1965 (if (let ((case-fold-search t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1966 (and (search-forward "\n* menu:" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1967 (or (not noindex)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1968 (not (string-match "\\<Index\\>" Info-current-node)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1969 (if (search-forward "\n* " nil t count)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1970 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1971 (or count
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1972 (while (search-forward "\n* " nil t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1973 (Info-extract-menu-node-name))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1974 (and (not noerror) (error "Too few items in menu")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1975 (and (not noerror) (error "No menu in this node")))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1976
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1977 (defun Info-nth-menu-item (n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1978 "Go to the node of the Nth menu item."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1979 (interactive "P")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1980 (or n (setq n (- last-command-char ?0)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1981 (if (< n 1) (error "Index must be at least 1"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1982 (Info-goto-node (Info-extract-menu-counting n) nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1983
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1984 (defun Info-last-menu-item ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1985 "Go to the node of the tenth menu item."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1986 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1987 (Info-goto-node (Info-extract-menu-counting nil) nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1988
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1989 (defun Info-top ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1990 "Go to the Top node of this file."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1991 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1992 (Info-goto-node "Top"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1993
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1994 (defun Info-end ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1995 "Go to the final node in this file."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1996 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1997 (Info-top)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1998 (let ((Info-keeping-history nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
1999 node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2000 (Info-last-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2001 (while (setq node (or (Info-extract-pointer "next" t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2002 (Info-extract-menu-counting nil t t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2003 (Info-goto-node node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2004 (or (equal (Info-extract-pointer "up" t) "Top")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2005 (let ((executing-kbd-macro "")) ; suppress messages
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2006 (condition-case nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2007 (Info-global-next 10000)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2008 (error nil))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2009
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2010 (defun Info-global-next (&optional n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2011 "Go to the next node in this file, traversing node structure as necessary.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2012 This works only if the Info file is structured as a hierarchy of nodes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2013 A positive or negative prefix argument moves by multiple nodes."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2014 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2015 (or n (setq n 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2016 (if (< n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2017 (Info-global-prev (- n))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2018 (while (>= (setq n (1- n)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2019 (let (node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2020 (cond ((and (string-match "^Top$" Info-current-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2021 (setq node (Info-extract-pointer "next" t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2022 (Info-extract-menu-item node t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2023 (Info-goto-node node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2024 ((setq node (Info-extract-menu-counting 1 t t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2025 (message "Going down...")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2026 (Info-goto-node node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2027 (t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2028 (let ((Info-keeping-history Info-keeping-history)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2029 (orignode Info-current-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2030 (ups ""))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2031 (while (not (Info-extract-pointer "next" t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2032 (if (and (setq node (Info-extract-pointer "up" t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2033 (not (equal node "Top")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2034 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2035 (message "Going%s..." (setq ups (concat ups " up")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2036 (Info-goto-node node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2037 (setq Info-keeping-history nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2038 (if orignode
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2039 (let ((Info-keeping-history nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2040 (Info-goto-node orignode)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2041 (error "Last node in file")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2042 (Info-next))))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2043
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2044 (defun Info-page-next (&optional n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2045 "Scroll forward one screenful, or go to next global node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2046 A positive or negative prefix argument moves by multiple screenfuls."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2047 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2048 (or n (setq n 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2049 (if (< n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2050 (Info-page-prev (- n))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2051 (while (>= (setq n (1- n)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2052 (if (pos-visible-in-window-p (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2053 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2054 (Info-global-next)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2055 (message "Node: %s" Info-current-node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2056 (scroll-up)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2057
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2058 (defun Info-scroll-next (arg)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2059 (interactive "P")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2060 (if Info-auto-advance
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2061 (if (and (pos-visible-in-window-p (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2062 (not (eq Info-auto-advance t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2063 (not (eq last-command this-command)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2064 (message "Hit %s again to go to next node"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2065 (if (= last-command-char 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2066 "mouse button"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2067 (key-description (char-to-string last-command-char))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2068 (Info-page-next)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2069 (setq this-command 'Info))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2070 (scroll-up arg)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2071
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2072 (defun Info-global-prev (&optional n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2073 "Go to the previous node in this file, traversing structure as necessary.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2074 This works only if the Info file is structured as a hierarchy of nodes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2075 A positive or negative prefix argument moves by multiple nodes."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2076 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2077 (or n (setq n 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2078 (if (< n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2079 (Info-global-next (- n))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2080 (while (>= (setq n (1- n)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2081 (let ((upnode (Info-extract-pointer "up" t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2082 (prevnode (Info-extract-pointer "prev[ious]*" t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2083 (if (or (not prevnode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2084 (equal prevnode upnode))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2085 (if (string-match "^Top$" Info-current-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2086 (error "First node in file")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2087 (message "Going up...")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2088 (Info-up))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2089 (Info-goto-node prevnode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2090 (let ((downs "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2091 (Info-keeping-history nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2092 node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2093 (while (setq node (Info-extract-menu-counting nil t t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2094 (message "Going%s..." (setq downs (concat downs " down")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2095 (Info-goto-node node))))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2096
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2097 (defun Info-page-prev (&optional n)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2098 "Scroll backward one screenful, or go to previous global node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2099 A positive or negative prefix argument moves by multiple screenfuls."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2100 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2101 (or n (setq n 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2102 (if (< n 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2103 (Info-page-next (- n))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2104 (while (>= (setq n (1- n)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2105 (if (pos-visible-in-window-p (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2106 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2107 (Info-global-prev)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2108 (message "Node: %s" Info-current-node)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
2109 (goto-char (point-max))
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
2110 (recenter -1)
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
2111 (move-to-window-line 0))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2112 (scroll-down)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2113
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2114 (defun Info-scroll-prev (arg)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2115 (interactive "P")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2116 (if Info-auto-advance
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2117 (if (and (pos-visible-in-window-p (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2118 (not (eq Info-auto-advance t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2119 (not (eq last-command this-command)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2120 (message "Hit %s again to go to previous node"
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
2121 (if (mouse-event-p last-command-event)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2122 "mouse button"
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
2123 (key-description (event-key last-command-event))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2124 (Info-page-prev)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2125 (setq this-command 'Info))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2126 (scroll-down arg)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2127
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2128 (defun Info-index (topic)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2129 "Look up a string in the index for this file.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2130 The index is defined as the first node in the top-level menu whose
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2131 name contains the word \"Index\", plus any immediately following
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2132 nodes whose names also contain the word \"Index\".
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2133 If there are no exact matches to the specified topic, this chooses
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2134 the first match which is a case-insensitive substring of a topic.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2135 Use the `,' command to see the other matches.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2136 Give a blank topic name to go to the Index node itself."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2137 (interactive "sIndex topic: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2138 (let ((pattern (format "\n\\* \\([^\n:]*%s[^\n:]*\\):[ \t]*%s"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2139 (regexp-quote topic)
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 394
diff changeset
2140 "\\(.*\\)\\.[ t]*\\([0-9]*\\)$"))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2141 node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2142 (message "Searching index for `%s'..." topic)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2143 (Info-goto-node "Top")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2144 (let ((case-fold-search t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2145 (or (search-forward "\n* menu:" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2146 (error "No index"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2147 (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2148 (error "No index")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2149 (goto-char (match-beginning 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2150 (let ((Info-keeping-history nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2151 (Info-fontify (and Info-fontify (equal topic ""))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2152 (Info-goto-node (Info-extract-menu-node-name)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2153 (or (equal topic "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2154 (let ((matches nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2155 (exact nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2156 (Info-keeping-history nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2157 found)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2158 (while
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2159 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2160 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2161 (while (re-search-forward pattern nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2162 (setq matches
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2163 (cons (list (buffer-substring (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2164 (match-end 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2165 (buffer-substring (match-beginning 2)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2166 (match-end 2))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2167 Info-current-node
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2168 (string-to-int (concat "0"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2169 (buffer-substring
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2170 (match-beginning 3)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2171 (match-end 3)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2172 matches)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2173 (and (setq node (Info-extract-pointer "next" t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2174 (string-match "\\<Index\\>" node)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2175 (let ((Info-fontify nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2176 (Info-goto-node node)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2177 (or matches
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2178 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2179 (Info-last)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2180 (error "No \"%s\" in index" topic)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2181 ;; Here it is a feature that assoc is case-sensitive.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2182 (while (setq found (assoc topic matches))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2183 (setq exact (cons found exact)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2184 matches (delq found matches)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2185 (setq Info-index-alternatives (nconc exact (nreverse matches))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2186 Info-index-first-alternative (car Info-index-alternatives))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2187 (Info-index-next 0)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2188
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2189 (defun Info-index-next (num)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2190 "Go to the next matching index item from the last `i' command."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2191 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2192 (or Info-index-alternatives
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2193 (error "No previous `i' command in this file"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2194 (while (< num 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2195 (setq num (+ num (length Info-index-alternatives))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2196 (while (> num 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2197 (setq Info-index-alternatives
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2198 (nconc (cdr Info-index-alternatives)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2199 (list (car Info-index-alternatives)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2200 num (1- num)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2201 (Info-goto-node (nth 1 (car Info-index-alternatives)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2202 (if (> (nth 3 (car Info-index-alternatives)) 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2203 (forward-line (nth 3 (car Info-index-alternatives)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2204 (forward-line 3) ; don't search in headers
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2205 (let ((name (car (car Info-index-alternatives))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2206 (if (or (re-search-forward (format
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2207 "\\(Function\\|Command\\): %s\\( \\|$\\)"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2208 (regexp-quote name)) nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2209 (re-search-forward (format "^`%s[ ']" (regexp-quote name)) nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2210 (search-forward (format "`%s'" name) nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2211 (and (string-match "\\`.*\\( (.*)\\)\\'" name)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2212 (search-forward
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2213 (format "`%s'" (substring name 0 (match-beginning 1)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2214 nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2215 (search-forward name nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2216 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2217 (goto-char (point-min)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2218 (message "Found \"%s\" in %s. %s"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2219 (car (car Info-index-alternatives))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2220 (nth 2 (car Info-index-alternatives))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2221 (if (cdr Info-index-alternatives)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2222 (if (eq (car (cdr Info-index-alternatives))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2223 Info-index-first-alternative)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2224 "(Press `,' to repeat)"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2225 (format "(Press `,' for %d more)"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2226 (- (1- (length Info-index-alternatives))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2227 (length (memq Info-index-first-alternative
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2228 (cdr Info-index-alternatives))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2229 "(Only match)")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2230
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2231
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2232 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2233 (defun Info-emacs-command (command)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2234 "Look up an Emacs command in the Emacs manual in the Info system.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2235 This command is designed to be used whether you are already in Info or not."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2236 (interactive "CLook up command in Emacs manual: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2237 (save-window-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2238 (info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2239 (Info-find-node Info-emacs-info-file-name "Top")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2240 (Info-index (symbol-name command)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2241 (pop-to-buffer "*info*"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2242
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2243
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2244 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2245 (defun Info-goto-emacs-command-node (key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2246 "Look up an Emacs command in the Emacs manual in the Info system.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2247 This command is designed to be used whether you are already in Info or not."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2248 (interactive "CLook up command in Emacs manual: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2249 (Info-emacs-command key))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2250
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2251 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2252 (defun Info-goto-emacs-key-command-node (key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2253 "Look up an Emacs key sequence in the Emacs manual in the Info system.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2254 This command is designed to be used whether you are already in Info or not."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2255 (interactive "kLook up key in Emacs manual: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2256 (let ((command (key-binding key)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2257 (cond ((eq command 'keyboard-quit)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2258 (keyboard-quit))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2259 ((null command)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2260 (error "%s is undefined" (key-description key)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2261 ((and (interactive-p) (eq command 'execute-extended-command))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2262 (call-interactively 'Info-goto-emacs-command-node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2263 (t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2264 (Info-goto-emacs-command-node command)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2265
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2266 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2267 (defun Info-emacs-key (key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2268 "Look up an Emacs key sequence in the Emacs manual in the Info system.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2269 This command is designed to be used whether you are already in Info or not."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2270 (interactive "kLook up key in Emacs manual: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2271 (cond ((eq (key-binding key) 'keyboard-quit)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2272 (keyboard-quit))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2273 ((and (interactive-p) (eq (key-binding key) 'execute-extended-command))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2274 (call-interactively 'Info-goto-emacs-command-node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2275 (t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2276 (save-window-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2277 (info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2278 (Info-find-node Info-emacs-info-file-name "Top")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2279 (setq key (key-description key))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2280 (let (p)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2281 (if (setq p (string-match "[@{}]" key))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2282 (setq key (concat (substring key 0 p) "@" (substring key p))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2283 (if (string-match "^ESC " key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2284 (setq key (concat "M-" (substring key 4))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2285 (if (string-match "^M-C-" key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2286 (setq key (concat "C-M-" (substring key 4)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2287 (Info-index key))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2288 (pop-to-buffer "*info*"))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2289
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2290 ;;;###autoload
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2291 (defun Info-elisp-ref (func)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2292 "Look up an Emacs Lisp function in the Elisp manual in the Info system.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2293 This command is designed to be used whether you are already in Info or not."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2294 (interactive (let ((fn (function-at-point))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
2295 (enable-recursive-minibuffers t)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2296 val)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2297 (setq val (completing-read
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2298 (format "Look up Emacs Lisp function%s: "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2299 (if fn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2300 (format " (default %s)" fn)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2301 ""))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2302 obarray 'fboundp t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2303 (list (if (equal val "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2304 fn (intern val)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2305 (save-window-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2306 (info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2307 (condition-case nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2308 (Info-find-node "lispref" "Top")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2309 (error (Info-find-node "elisp" "Top")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2310 (Info-index (symbol-name func)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2311 (pop-to-buffer "*info*"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2312
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2313 (defun Info-reannotate-node ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2314 (let ((bufs (delq nil (mapcar 'get-file-buffer Info-annotations-path))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2315 (if bufs
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2316 (let ((ibuf (current-buffer))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2317 (file (concat "\\(" (regexp-quote
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2318 (file-name-nondirectory Info-current-file))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2319 "\\|" (regexp-quote Info-current-file) "\\)"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2320 (node (regexp-quote Info-current-node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2321 (savept (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2322 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2323 (if (search-forward "\n------ NOTE:\n" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2324 (let ((buffer-read-only nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2325 (bufmod (buffer-modified-p))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2326 top)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2327 (setq savept (copy-marker savept))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2328 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2329 (while (search-forward "\n------ NOTE:" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2330 (setq top (1+ (match-beginning 0)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2331 (if (search-forward "\n------\n" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2332 (delete-region top (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2333 (backward-char 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2334 (set-buffer-modified-p bufmod)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2335 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2336 (while bufs
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2337 (set-buffer (car bufs))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2338 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2339 (while (re-search-forward
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2340 (format
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2341 "------ *File: *%s *Node: *%s *Line: *\\([0-9]+\\) *\n"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2342 file node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2343 nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2344 (let ((line (string-to-int
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2345 (buffer-substring (match-beginning 2)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2346 (match-end 2))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2347 (top (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2348 bot)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2349 (search-forward "\n------\n" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2350 (setq bot (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2351 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2352 (set-buffer ibuf)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2353 (if (integerp savept) (setq savept (copy-marker savept)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2354 (if (= line 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2355 (goto-char (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2356 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2357 (forward-line line))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2358 (let ((buffer-read-only nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2359 (bufmod (buffer-modified-p)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2360 (insert "------ NOTE:\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2361 (insert-buffer-substring (car bufs) top bot)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2362 (set-buffer-modified-p bufmod)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2363 (setq bufs (cdr bufs))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2364 (goto-char savept)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2365
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2366 (defvar Info-annotate-map nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2367 "Local keymap used within `a' command of Info.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2368 (if Info-annotate-map
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2369 nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2370 ;; (setq Info-annotate-map (nconc (make-sparse-keymap) text-mode-map))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2371 (setq Info-annotate-map (copy-keymap text-mode-map))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2372 (define-key Info-annotate-map "\C-c\C-c" 'Info-cease-annotate))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2373
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2374 (defun Info-annotate-mode ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2375 "Major mode for adding an annotation to an Info node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2376 Like text mode with the addition of Info-cease-annotate
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2377 which returns to Info mode for browsing.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2378 \\{Info-annotate-map}")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2379
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2380 (defun Info-annotate (arg)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2381 "Add a personal annotation to the current Info node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2382 Only you will be able to see this annotation. Annotations are stored
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2383 in the file \"~/.xemacs/info.notes\" by default. If point is inside
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2384 an existing annotation, edit that annotation. A prefix argument
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2385 specifies which annotations file (from `Info-annotations-path') is to
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2386 be edited; default is 1."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2387 (interactive "p")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2388 (setq arg (1- arg))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2389 (if (or (< arg 0) (not (nth arg Info-annotations-path)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2390 (if (= arg 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2391 (setq Info-annotations-path
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2392 (list (read-file-name
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2393 "Annotations file: " "~/" "~/.infonotes")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2394 (error "File number must be in the range from 1 to %d"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2395 (length Info-annotations-path))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2396 (let ((which nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2397 (file (file-name-nondirectory Info-current-file))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2398 (d Info-directory-list)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2399 where pt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2400 (while (and d (not (equal (expand-file-name file (car d))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2401 Info-current-file)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2402 (setq d (cdr d)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2403 (or d (setq file Info-current-file))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2404 (if (and (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2405 (goto-char (min (point-max) (+ (point) 13)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2406 (and (search-backward "------ NOTE:\n" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2407 (setq pt (match-end 0))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2408 (search-forward "\n------\n" nil t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2409 (< (point) (match-end 0)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2410 (setq which (format "File: *%s *Node: *%s *Line:.*\n%s"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2411 (regexp-quote file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2412 (regexp-quote Info-current-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2413 (regexp-quote
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2414 (buffer-substring pt (match-beginning 0))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2415 where (max (- (point) pt) 0)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2416 (let ((node Info-current-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2417 (line (if (looking-at "[ \n]*\\'") 0
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2418 (count-lines (point-min) (point)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2419 (or which
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2420 (let ((buffer-read-only nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2421 (bufmod (buffer-modified-p)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2422 (beginning-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2423 (if (bobp) (goto-char (point-max)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2424 (insert "------ NOTE:\n------\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2425 (backward-char 20)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2426 (set-buffer-modified-p bufmod)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2427 ;; (setq Info-window-start (window-start))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2428 (setq Info-window-configuration (current-window-configuration))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2429 (pop-to-buffer (find-file-noselect (nth arg Info-annotations-path)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2430 (use-local-map Info-annotate-map)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2431 (setq major-mode 'Info-annotate-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2432 (setq mode-name "Info Annotate")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2433 (if which
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2434 (if (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2435 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2436 (re-search-forward which nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2437 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2438 (goto-char (match-beginning 0))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2439 (forward-line 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2440 (forward-char where)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2441 (let ((bufmod (buffer-modified-p)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2442 (goto-char (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2443 (insert (format "\n------ File: %s Node: %s Line: %d\n"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2444 file node line))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2445 (setq pt (point))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2446 (insert "\n------\n"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2447 "\nPress C-c C-c to save and return to Info.\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2448 (goto-char pt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2449 (set-buffer-modified-p bufmod))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2450
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2451 (defun Info-cease-annotate ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2452 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2453 (let ((bufmod (buffer-modified-p)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2454 (while (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2455 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2456 (re-search-forward "\n\n?Press .* to save and return to Info.\n"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2457 nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2458 (delete-region (1+ (match-beginning 0)) (match-end 0)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2459 (while (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2460 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2461 (re-search-forward "\n------ File:.*Node:.*Line:.*\n+------\n"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2462 nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2463 (delete-region (match-beginning 0) (match-end 0)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2464 (set-buffer-modified-p bufmod))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2465 (save-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2466 (fundamental-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2467 (bury-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2468 (or (one-window-p) (delete-window))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2469 (info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2470 (setq Info-current-annotation-completions nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2471 (set-window-configuration Info-window-configuration)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2472 (Info-reannotate-node))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2473
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2474 (defun Info-bookmark (arg tag)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2475 (interactive "p\nsBookmark name: ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2476 (Info-annotate arg)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2477 (if (or (string-match "^\"\\(.*\\)\"$" tag)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2478 (string-match "^<<\\(.*\\)>>$" tag))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2479 (setq tag (substring tag (match-beginning 1) (match-end 1))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2480 (let ((pt (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2481 (search-forward "\n------\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2482 (let ((end (- (point) 8)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2483 (goto-char pt)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2484 (if (re-search-forward "<<[^>\n]*>>" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2485 (delete-region (match-beginning 0) (match-end 0))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2486 (goto-char end))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2487 (or (equal tag "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2488 (insert "<<" tag ">>"))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2489 (Info-cease-annotate))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2490
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2491 (defun Info-exit ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2492 "Exit Info by selecting some other buffer."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2493 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2494 (if Info-standalone
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2495 (save-buffers-kill-emacs)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2496 (bury-buffer (current-buffer))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2497 (if (and (featurep 'toolbar)
278
90d73dddcdc4 Import from CVS: tag r21-0b37
cvs
parents: 274
diff changeset
2498 (boundp 'toolbar-info-frame)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2499 (eq toolbar-info-frame (selected-frame)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2500 (condition-case ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2501 (delete-frame toolbar-info-frame)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2502 (error (bury-buffer)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2503 (switch-to-buffer (other-buffer (current-buffer))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2504
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2505 (defun Info-undefined ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2506 "Make command be undefined in Info."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2507 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2508 (ding))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2509
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2510 (defun Info-help ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2511 "Enter the Info tutorial."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2512 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2513 (delete-other-windows)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2514 (Info-find-node "info"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2515 (if (< (window-height) 23)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2516 "Help-Small-Screen"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2517 "Help")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2518
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2519 (defun Info-summary ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2520 "Display a brief summary of all Info commands."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2521 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2522 (save-window-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2523 (switch-to-buffer "*Help*")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2524 (erase-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2525 (insert (documentation 'Info-mode))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2526 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2527 (let (flag)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2528 (while (progn (setq flag (not (pos-visible-in-window-p (point-max))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2529 (message (if flag "Type Space to see more"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2530 "Type Space to return to Info"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2531 (let ((e (next-command-event)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2532 (if (/= ?\ (event-to-character e))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2533 (progn (setq unread-command-event e) nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2534 flag)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2535 (scroll-up)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2536 (message "")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2537 (bury-buffer "*Help*")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2538
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2539 (defun Info-get-token (pos start all &optional errorstring)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2540 "Return the token around POS,
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2541 POS must be somewhere inside the token
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2542 START is a regular expression which will match the
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2543 beginning of the tokens delimited string
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2544 ALL is a regular expression with a single
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2545 parenthized subpattern which is the token to be
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2546 returned. E.g. '{\(.*\)}' would return any string
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2547 enclosed in braces around POS.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2548 SIG optional fourth argument, controls action on no match
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2549 nil: return nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2550 t: beep
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2551 a string: signal an error, using that string."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2552 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2553 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2554 (re-search-backward "\\`") ; Bug fix due to Nicholas J. Foskett.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2555 (goto-char pos)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2556 (re-search-backward start (max (point-min) (- pos 200)) 'yes)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2557 (let (found)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2558 (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2559 (not (setq found (and (<= (match-beginning 0) pos)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2560 (> (match-end 0) pos))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2561 (if (and found (<= (match-beginning 0) pos)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2562 (> (match-end 0) pos))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2563 (buffer-substring (match-beginning 1) (match-end 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2564 (cond ((null errorstring)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2565 nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2566 ((eq errorstring t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2567 (beep)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2568 nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2569 (t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2570 (error "No %s around position %d" errorstring pos)))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2571
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2572 (defun Info-follow-clicked-node (event)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2573 "Follow a node reference near clicked point. Like M, F, N, P or U command.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2574 At end of the node's text, moves to the next node."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2575 (interactive "@e")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2576 (or (and (event-point event)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2577 (Info-follow-nearest-node
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2578 (max (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2579 (select-window (event-window event))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2580 (event-point event))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2581 (1+ (point-min)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2582 (error "click on a cross-reference to follow")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2583
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2584 (defun Info-maybe-follow-clicked-node (event &optional click-count)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2585 "Follow a node reference (if any) near clicked point.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2586 Like M, F, N, P or U command. At end of the node's text, moves to the
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2587 next node. No error is given if there is no node to follow."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2588 (interactive "@e")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2589 (and Info-button1-follows-hyperlink
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2590 (event-point event)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2591 (Info-follow-nearest-node
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2592 (max (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2593 (select-window (event-window event))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2594 (event-point event))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2595 (1+ (point-min))))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2596
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2597 (defun Info-find-nearest-node (point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2598 (let (node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2599 (cond
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2600 ((= point (point-min)) nil) ; don't trigger on accidental RET.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2601 ((setq node (Info-get-token point
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2602 (format "\\*%s[ \n]" Info-footnote-tag)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2603 (format "\\*%s[ \n]\\([^:]*\\):"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2604 Info-footnote-tag)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2605 (list "Following cross-reference %s..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2606 (list 'Info-follow-reference node)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2607 ((setq node (Info-get-token point "\\* " "\\* \\([^:]*\\)::"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2608 (list "Selecting menu item %s..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2609 (list 'Info-goto-node node nil t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2610 ((setq node (Info-get-token point "\\* " "\\* \\([^:]*\\):"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2611 (list "Selecting menu item %s..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2612 (list 'Info-menu node)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2613 ((setq node (Info-get-token point "Up: " "Up: \\([^,\n\t]*\\)"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2614 (list "Going up..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2615 (list 'Info-goto-node node)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2616 ((setq node (Info-get-token point "Next: " "Next: \\([^,\n\t]*\\)"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2617 (list "Next node..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2618 (list 'Info-goto-node node)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2619 ((setq node (Info-get-token point "File: " "File: \\([^,\n\t]*\\)"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2620 (list "Top node..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2621 (list 'Info-goto-node "Top")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2622 ((setq node (Info-get-token point "Prev[ious]*: "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2623 "Prev[ious]*: \\([^,\n\t]*\\)"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2624 (list "Previous node..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2625 (list 'Info-goto-node node)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2626 ((setq node (Info-get-token point "Node: " "Node: \\([^,\n\t]*\\)"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2627 (list "Reselecting %s..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2628 (list 'Info-goto-node node)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2629 ((save-excursion (goto-char point) (looking-at "[ \n]*\\'"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2630 (if Info-in-cross-reference
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2631 (list "Back to last node..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2632 '(Info-last))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2633 (list "Next node..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2634 '(Info-global-next)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2635 ))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2636
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2637 (defun Info-follow-nearest-node (point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2638 "Follow a node reference near point. Like M, F, N, P or U command.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2639 At end of the node's text, moves to the next node."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2640 (interactive "d")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2641 (let ((data (Info-find-nearest-node point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2642 (if (null data)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2643 nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2644 (let ((msg (format (car data) (nth 1 (nth 1 data)))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2645 (message "%s" msg)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2646 (eval (nth 1 data))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2647 (message "%sdone" msg))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2648 t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2649
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2650 (defun Info-indicated-node (event)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2651 (condition-case ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2652 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2653 (cond ((eventp event)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2654 (set-buffer (event-buffer event))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2655 (setq event (event-point event))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2656 (let* ((data (Info-find-nearest-node event))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2657 (name (nth 1 (nth 1 data))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2658 (and name (nth 1 data))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2659 (error nil)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2660
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2661 (defun Info-mouse-track-double-click-hook (event click-count)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2662 "Handle double-clicks by turning pages, like the `gv' ghostscript viewer"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2663 (if (/= click-count 2)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2664 ;; Return nil so any other hooks are performed.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2665 nil
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2666 (let* ((fw (face-width 'default))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2667 (fh (face-height 'default))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2668 (x (/ (event-x-pixel event) fw))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2669 (y (/ (event-y-pixel event) fw))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2670 (w (/ (window-pixel-width (event-window event)) fw))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2671 (h (/ (window-pixel-height (event-window event)) fh))
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2672 (bx 3)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2673 (by 2))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2674 (cond
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2675 ((<= y by) (Info-up) t)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2676 ((>= y (- h by)) (Info-nth-menu-item 1) t)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2677 ((<= x bx) (Info-prev) t)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2678 ((>= x (- w bx)) (Info-next) t)
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2679 (t nil)))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2680
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2681 (defvar Info-mode-map nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2682 "Keymap containing Info commands.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2683 (if Info-mode-map
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2684 nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2685 (setq Info-mode-map (make-sparse-keymap))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2686 (suppress-keymap Info-mode-map)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2687 (define-key Info-mode-map "." 'beginning-of-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2688 (define-key Info-mode-map " " 'Info-scroll-next)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2689 (define-key Info-mode-map "1" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2690 (define-key Info-mode-map "2" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2691 (define-key Info-mode-map "3" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2692 (define-key Info-mode-map "4" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2693 (define-key Info-mode-map "5" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2694 (define-key Info-mode-map "6" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2695 (define-key Info-mode-map "7" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2696 (define-key Info-mode-map "8" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2697 (define-key Info-mode-map "9" 'Info-nth-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2698 (define-key Info-mode-map "0" 'Info-last-menu-item)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2699 (define-key Info-mode-map "?" 'Info-summary)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2700 (define-key Info-mode-map "a" 'Info-annotate)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2701 (define-key Info-mode-map "b" 'beginning-of-buffer)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2702 (define-key Info-mode-map "d" 'Info-directory)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2703 (define-key Info-mode-map "e" 'Info-edit)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2704 (define-key Info-mode-map "f" 'Info-follow-reference)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2705 (define-key Info-mode-map "g" 'Info-goto-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2706 (define-key Info-mode-map "h" 'Info-help)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2707 (define-key Info-mode-map "i" 'Info-index)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2708 (define-key Info-mode-map "j" 'Info-goto-bookmark)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2709 (define-key Info-mode-map "k" 'Info-emacs-key)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2710 (define-key Info-mode-map "l" 'Info-last)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2711 (define-key Info-mode-map "m" 'Info-menu)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2712 (define-key Info-mode-map "n" 'Info-next)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2713 (define-key Info-mode-map "p" 'Info-prev)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2714 (define-key Info-mode-map "q" 'Info-exit)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2715 (define-key Info-mode-map "r" 'Info-follow-reference)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2716 (define-key Info-mode-map "s" 'Info-search)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2717 (define-key Info-mode-map "t" 'Info-top)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2718 (define-key Info-mode-map "u" 'Info-up)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2719 (define-key Info-mode-map "v" 'Info-visit-file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2720 (define-key Info-mode-map "x" 'Info-bookmark)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2721 (define-key Info-mode-map "<" 'Info-top)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2722 (define-key Info-mode-map ">" 'Info-end)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2723 (define-key Info-mode-map "[" 'Info-global-prev)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2724 (define-key Info-mode-map "]" 'Info-global-next)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2725 (define-key Info-mode-map "{" 'Info-page-prev)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2726 (define-key Info-mode-map "}" 'Info-page-next)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2727 (define-key Info-mode-map "=" 'Info-restore-point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2728 (define-key Info-mode-map "!" 'Info-select-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2729 (define-key Info-mode-map "@" 'Info-follow-nearest-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2730 (define-key Info-mode-map "," 'Info-index-next)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2731 (define-key Info-mode-map "*" 'Info-elisp-ref)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2732 (define-key Info-mode-map [tab] 'Info-next-reference)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2733 (define-key Info-mode-map [(meta tab)] 'Info-prev-reference)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2734 (define-key Info-mode-map [(shift tab)] 'Info-prev-reference)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2735 (define-key Info-mode-map "\r" 'Info-follow-nearest-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2736 ;; XEmacs addition
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2737 (define-key Info-mode-map 'backspace 'Info-scroll-prev)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2738 (define-key Info-mode-map 'delete 'Info-scroll-prev)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2739 (define-key Info-mode-map 'button2 'Info-follow-clicked-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2740 (define-key Info-mode-map 'button3 'Info-select-node-menu))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2741
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2742
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2743 ;; Info mode is suitable only for specially formatted data.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2744 (put 'info-mode 'mode-class 'special)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2745
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2746 (defun Info-mode ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2747 "Info mode is for browsing through the Info documentation tree.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2748 Documentation in Info is divided into \"nodes\", each of which
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2749 discusses one topic and contains references to other nodes
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2750 which discuss related topics. Info has commands to follow
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2751 the references and show you other nodes.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2752
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2753 h Invoke the Info tutorial.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2754 q Quit Info: return to the previously selected file or buffer.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2755
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2756 Selecting other nodes:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2757 n Move to the \"next\" node of this node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2758 p Move to the \"previous\" node of this node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2759 m Pick menu item specified by name (or abbreviation).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2760 1-9, 0 Pick first..ninth, last item in node's menu.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2761 Menu items select nodes that are \"subsections\" of this node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2762 u Move \"up\" from this node (i.e., from a subsection to a section).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2763 f or r Follow a cross reference by name (or abbrev). Type `l' to get back.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2764 RET Follow cross reference or menu item indicated by cursor.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2765 i Look up a topic in this file's Index and move to that node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2766 , (comma) Move to the next match from a previous `i' command.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2767 l (letter L) Move back to the last node you were in.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2768
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2769 Moving within a node:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2770 Space Scroll forward a full screen. DEL Scroll backward.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2771 b Go to beginning of node. Meta-> Go to end of node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2772 TAB Go to next cross-reference. Meta-TAB Go to previous ref.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2773
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2774 Mouse commands:
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2775 Left Button Set point (usual text-mode functionality)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2776 Middle Button Click on a highlighted node reference to go to it.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2777 Right Button Pop up a menu of applicable Info commands.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2778
373
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2779 Left Button Double Click in window edges:
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2780 Top edge: Go up to the parent node, like `u'.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2781 Left edge: Go to the previous node, like `p'.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2782 Right edge: Go to the next node, like `n'.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2783 Bottom edge: Follow first menu item, like `1'.
6240c7796c7a Import from CVS: tag r21-2b2
cvs
parents: 371
diff changeset
2784
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2785 Advanced commands:
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2786 g Move to node, file, or annotation tag specified by name.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2787 Examples: `g Rectangles' `g (Emacs)Rectangles' `g Emacs'.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2788 v Move to file, with filename completion.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2789 k Look up a key sequence in Emacs manual (also C-h C-k at any time).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2790 * Look up a function name in Emacs Lisp manual (also C-h C-f).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2791 d Go to the main directory of Info files.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2792 < or t Go to Top (first) node of this file.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2793 > Go to last node in this file.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2794 \[ Go to previous node, treating file as one linear document.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2795 \] Go to next node, treating file as one linear document.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2796 { Scroll backward, or go to previous node if at top.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2797 } Scroll forward, or go to next node if at bottom.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2798 = Restore cursor position from last time in this node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2799 a Add a private note (annotation) to the current node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2800 x, j Add, jump to a bookmark (annotation tag).
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2801 s Search this Info file for a node containing the specified regexp.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2802 e Edit the contents of the current node."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2803 (kill-all-local-variables)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2804 (setq major-mode 'Info-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2805 (setq mode-name "Info")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2806 (use-local-map Info-mode-map)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2807 (set-syntax-table text-mode-syntax-table)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2808 (setq local-abbrev-table text-mode-abbrev-table)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2809 (setq case-fold-search t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2810 (setq buffer-read-only t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2811 ; (setq buffer-mouse-map Info-mode-mouse-map)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2812 (make-local-variable 'Info-current-file)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2813 (make-local-variable 'Info-current-subfile)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2814 (make-local-variable 'Info-current-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2815 (make-local-variable 'Info-tag-table-marker)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2816 (make-local-variable 'Info-current-file-completions)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2817 (make-local-variable 'Info-current-annotation-completions)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2818 (make-local-variable 'Info-index-alternatives)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2819 (make-local-variable 'Info-history)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2820 ;; Faces are now defined by `defface'...
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2821 (make-local-variable 'mouse-track-click-hook)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2822 (add-hook 'mouse-track-click-hook 'Info-maybe-follow-clicked-node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2823 (add-hook 'mouse-track-click-hook 'Info-mouse-track-double-click-hook)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2824 ;; #### The console-on-window-system-p check is to allow this to
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2825 ;; work on tty's. The real problem here is that featurep really
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2826 ;; needs to have some device/console domain knowledge added to it.
380
8626e4521993 Import from CVS: tag r21-2-5
cvs
parents: 375
diff changeset
2827 (defvar info::toolbar)
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2828 (if (and (featurep 'toolbar)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2829 (console-on-window-system-p)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2830 (not Info-inhibit-toolbar))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2831 (set-specifier default-toolbar (cons (current-buffer) info::toolbar)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2832 (if (featurep 'menubar)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2833 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2834 ;; make a local copy of the menubar, so our modes don't
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2835 ;; change the global menubar
284
558f606b08ae Import from CVS: tag r21-0b40
cvs
parents: 278
diff changeset
2836 (easy-menu-add '("Info" :filter Info-menu-filter))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2837 (run-hooks 'Info-mode-hook)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2838 (Info-set-mode-line))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2839
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2840 (defvar Info-edit-map nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2841 "Local keymap used within `e' command of Info.")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2842 (if Info-edit-map
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2843 nil
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2844 ;; XEmacs: remove FSF stuff
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2845 (setq Info-edit-map (make-sparse-keymap))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2846 (set-keymap-name Info-edit-map 'Info-edit-map)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2847 (set-keymap-parents Info-edit-map (list text-mode-map))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2848 (define-key Info-edit-map "\C-c\C-c" 'Info-cease-edit))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2849
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2850 ;; Info-edit mode is suitable only for specially formatted data.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2851 (put 'info-edit-mode 'mode-class 'special)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2852
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2853 (defun Info-edit-mode ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2854 "Major mode for editing the contents of an Info node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2855 Like text mode with the addition of `Info-cease-edit'
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2856 which returns to Info mode for browsing.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2857 \\{Info-edit-map}"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2858 )
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2859
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2860 (defun Info-edit ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2861 "Edit the contents of this Info node.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2862 Allowed only if variable `Info-enable-edit' is non-nil."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2863 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2864 (or Info-enable-edit
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2865 (error "Editing info nodes is not enabled"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2866 (use-local-map Info-edit-map)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2867 (setq major-mode 'Info-edit-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2868 (setq mode-name "Info Edit")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2869 (kill-local-variable 'modeline-buffer-identification)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2870 (setq buffer-read-only nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2871 ;; Make mode line update.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2872 (set-buffer-modified-p (buffer-modified-p))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2873 (message (substitute-command-keys
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2874 "Editing: Type \\[Info-cease-edit] to return to info")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2875
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2876 (defun Info-cease-edit ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2877 "Finish editing Info node; switch back to Info proper."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2878 (interactive)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2879 ;; Do this first, so nothing has changed if user C-g's at query.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2880 (and (buffer-modified-p)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2881 (y-or-n-p-maybe-dialog-box "Save the file? ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2882 (save-buffer))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2883 (use-local-map Info-mode-map)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2884 (setq major-mode 'Info-mode)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2885 (setq mode-name "Info")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2886 (Info-set-mode-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2887 (setq buffer-read-only t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2888 ;; Make mode line update.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2889 (set-buffer-modified-p (buffer-modified-p))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2890 (and (marker-position Info-tag-table-marker)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2891 (buffer-modified-p)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2892 (message "Tags may have changed. Use Info-tagify if necessary")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2893
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2894 (defun Info-find-emacs-command-nodes (command)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2895 "Return a list of locations documenting COMMAND in the XEmacs Info manual.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2896 The locations are of the format used in Info-history, i.e.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2897 \(FILENAME NODENAME BUFFERPOS\)."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2898 (let ((where '())
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2899 (cmd-desc (concat "^\\* " (regexp-quote (symbol-name command))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2900 ":\\s *\\(.*\\)\\.$")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2901 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2902 (Info-find-node "XEmacs" "Command Index")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2903 ;; Take the index node off the Info history.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2904 ;; ??? says this isn't safe someplace else... hmmm.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2905 (setq Info-history (cdr Info-history))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2906 (goto-char (point-max))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2907 (while (re-search-backward cmd-desc nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2908 (setq where (cons (list Info-current-file
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2909 (buffer-substring
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2910 (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2911 (match-end 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2912 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2913 where)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2914 where)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2915
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2916 ;;; fontification and mousability for info
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2917
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2918 (defun Info-highlight-region (start end face)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2919 (let ((extent nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2920 (splitp (string-match "\n[ \t]+" (buffer-substring start end))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2921 (if splitp
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2922 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2923 (setq extent (make-extent start (progn (goto-char start)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2924 (end-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2925 (point))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2926 (set-extent-face extent face)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2927 (set-extent-property extent 'info t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2928 (set-extent-property extent 'highlight t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2929 (skip-chars-forward "\n\t ")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2930 (setq extent (make-extent (point) end)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2931 (setq extent (make-extent start end)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2932 (set-extent-face extent face)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2933 (set-extent-property extent 'info t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2934 (set-extent-property extent 'highlight t)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2935
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2936 (defun Info-fontify-node ()
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2937 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2938 (let ((case-fold-search t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2939 (xref-regexp (concat "\\*"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2940 (regexp-quote Info-footnote-tag)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2941 "[ \n\t]*\\([^:]*\\):")))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2942 ;; Clear the old extents
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2943 (map-extents #'(lambda (x y) (delete-extent x))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2944 (current-buffer) (point-min) (point-max) nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2945 ;; Break the top line iff it is > 79 characters. Some info nodes
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2946 ;; have top lines that span 3 lines because of long node titles.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2947 ;; eg: (Info-find-node "lispref.info" "Window-Level Event Position Info")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2948 (toggle-read-only -1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2949 (let ((extent nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2950 (len 0)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2951 (done nil)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2952 (p (point-min)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2953 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2954 (re-search-forward "Node: *[^,]+, " nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2955 (setq len (- (point) (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2956 extent (make-extent (point-min) (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2957 (set-extent-property extent 'invisible t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2958 (while (not done)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2959 (goto-char p)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2960 (end-of-line)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2961 (if (< (current-column) (+ 78 len))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2962 (setq done t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2963 (goto-char p)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2964 (forward-char (+ 79 len))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2965 (re-search-backward "," nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2966 (forward-char 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2967 (insert "\n")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2968 (just-one-space)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2969 (backward-delete-char 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2970 (setq p (point)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2971 len 0))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2972 (toggle-read-only 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2973 ;; Highlight xrefs in the top few lines of the node
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2974 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2975 (if (looking-at "^File: [^,: \t]+,?[ \t]+")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2976 (progn
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2977 (goto-char (match-end 0))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2978 (while
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2979 (looking-at "[ \t]*[^:, \t\n]+:[ \t]+\\([^:,\t\n]+\\),?\n?")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2980 (goto-char (match-end 0))
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
2981 (Info-highlight-region (match-beginning 1) (match-end 1) 'info-xref))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2982 ;; Now get the xrefs in the body
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2983 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2984 (while (re-search-forward xref-regexp nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2985 (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2986 nil
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
2987 (Info-highlight-region (match-beginning 1) (match-end 1) 'info-xref)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2988 ;; then highlight the nodes in the menu.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2989 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2990 (if (and (search-forward "\n* menu:" nil t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2991 (while (re-search-forward
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2992 "^\\* \\([^:\t\n]*\\):?:[ \t\n]" nil t)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
2993 (Info-highlight-region (match-beginning 1) (match-end 1) 'info-node)))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2994 (set-buffer-modified-p nil))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2995
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2996 (defun Info-construct-menu (&optional event)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2997 "Construct a menu of Info commands.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2998 Adds an entry for the node at EVENT, or under point if EVENT is omitted.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
2999 Used to construct the menubar submenu and popup menu."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3000 (or event (setq event (point)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3001 (let ((case-fold-search t)
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 367
diff changeset
3002 (xref-regexp (concat "\\*"
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3003 (regexp-quote Info-footnote-tag)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3004 "[ \n\t]*\\([^:]*\\):"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3005 up-p prev-p next-p menu xrefs subnodes in)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3006 (save-excursion
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3007 ;; `one-space' fixes "Notes:" xrefs that are split across lines.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3008 (flet
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3009 ((one-space (text)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3010 (let (i)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3011 (while (setq i (string-match "[ \n\t]+" text i))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3012 (setq text (concat (substring text 0 i) " "
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3013 (substring text (match-end 0))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3014 (setq i (1+ i)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3015 text)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3016 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3017 (if (looking-at ".*\\bNext:") (setq next-p t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3018 (if (looking-at ".*\\bPrev:") (setq prev-p t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3019 (if (looking-at ".*Up:") (setq up-p t))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3020 (setq menu (nconc
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3021 (if (setq in (Info-indicated-node event))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3022 (list (vector (one-space (cadr in)) in t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3023 "--:shadowEtchedIn"))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3024 (list
263
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 243
diff changeset
3025 ["Goto Info Top-level" Info-directory]
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 243
diff changeset
3026 (vector "Next Node" 'Info-next :active next-p)
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 243
diff changeset
3027 (vector "Previous Node" 'Info-prev :active prev-p)
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 243
diff changeset
3028 (vector "Parent Node (Up)" 'Info-up :active up-p)
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 243
diff changeset
3029 ["Goto Node..." Info-goto-node]
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 243
diff changeset
3030 ["Goto Last Visited Node " Info-last])))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3031 ;; Find the xrefs and make a list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3032 (while (re-search-forward xref-regexp nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3033 (setq xrefs (cons (one-space (buffer-substring (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3034 (match-end 1)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3035 xrefs))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3036 (setq xrefs (nreverse xrefs))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3037 (if (> (length xrefs) 21) (setcdr (nthcdr 20 xrefs) '(more)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3038 ;; Find the subnodes and make a list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3039 (goto-char (point-min))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3040 (if (search-forward "\n* menu:" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3041 (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3042 (setq subnodes (cons (buffer-substring (match-beginning 1)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3043 (match-end 1))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3044 subnodes))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3045 (setq subnodes (nreverse subnodes))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3046 (if (> (length subnodes) 21) (setcdr (nthcdr 20 subnodes) '(more))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3047 (if xrefs
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3048 (nconc menu (list "--:shadowDoubleEtchedIn"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3049 " Cross-References"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3050 "--:singleLine")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3051 (mapcar #'(lambda (xref)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3052 (if (eq xref 'more)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3053 "...more..."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3054 (vector xref
263
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 243
diff changeset
3055 (list 'Info-follow-reference xref))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3056 xrefs)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3057 (if subnodes
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3058 (nconc menu (list "--:shadowDoubleEtchedIn"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3059 " Sub-Nodes"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3060 "--:singleLine")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3061 (mapcar #'(lambda (node)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3062 (if (eq node 'more)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3063 "...more..."
263
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 243
diff changeset
3064 (vector node (list 'Info-menu node))))
217
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3065 subnodes)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3066 menu))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3067
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3068 (defun Info-menu-filter (menu)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3069 "This is the menu filter for the \"Info\" submenu."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3070 (Info-construct-menu))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3071
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3072 (defun Info-select-node-menu (event)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3073 "Pops up a menu of applicable Info commands."
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3074 (interactive "e")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3075 (select-window (event-window event))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3076 (let ((menu (Info-construct-menu event)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3077 (setq menu (nconc (list "Info" ; title: not displayed
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3078 " Info Commands"
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3079 "--:shadowDoubleEtchedOut")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3080 menu))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3081 (let ((popup-menu-titles nil))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3082 (popup-menu menu))))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3083
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3084 ;;; Info toolbar support
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3085
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3086 ;; exit icon taken from GNUS
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3087 (defvar info::toolbar-exit-icon
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3088 (if (featurep 'toolbar)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3089 (toolbar-make-button-list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3090 (expand-file-name (if (featurep 'xpm) "info-exit.xpm" "info-exit.xbm")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3091 toolbar-icon-directory)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3092 "Exit Info icon")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3093
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3094 (defvar info::toolbar-up-icon
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3095 (if (featurep 'toolbar)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3096 (toolbar-make-button-list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3097 (expand-file-name (if (featurep 'xpm) "info-up.xpm" "info-up.xbm")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3098 toolbar-icon-directory)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3099 "Up icon")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3100
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3101 (defvar info::toolbar-next-icon
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3102 (if (featurep 'toolbar)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3103 (toolbar-make-button-list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3104 (expand-file-name (if (featurep 'xpm) "info-next.xpm" "info-next.xbm")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3105 toolbar-icon-directory)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3106 "Next icon")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3107
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3108 (defvar info::toolbar-prev-icon
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3109 (if (featurep 'toolbar)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3110 (toolbar-make-button-list
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3111 (expand-file-name (if (featurep 'xpm) "info-prev.xpm" "info-prev.xbm")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3112 toolbar-icon-directory)))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3113 "Prev icon")
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3114
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3115 (defvar info::toolbar
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3116 (if (featurep 'toolbar)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3117 ; disabled until we get the next/prev-win icons working again.
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3118 ; (cons (first initial-toolbar-spec)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3119 ; (cons (second initial-toolbar-spec)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3120 '([info::toolbar-exit-icon
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3121 Info-exit
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3122 t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3123 "Exit info"]
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3124 [info::toolbar-next-icon
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3125 Info-next
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3126 t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3127 "Next entry in same section"]
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3128 [info::toolbar-prev-icon
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3129 Info-prev
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3130 t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3131 "Prev entry in same section"]
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3132 [info::toolbar-up-icon
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3133 Info-up
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3134 t
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3135 "Up entry to enclosing section"]
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3136 )))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3137 ;))
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3138
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3139 (provide 'info)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3140
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3141 (run-hooks 'Info-load-hook)
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3142
d44af0c54775 Import from CVS: tag r20-4b7
cvs
parents:
diff changeset
3143 ;;; info.el ends here