annotate lisp/packages/info.el @ 193:f53b5ca2e663 r20-3b23

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