annotate lisp/packages/info.el @ 203:850242ba4a81 r20-3b28

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