annotate lisp/packages/info.el @ 185:3d6bfa290dbd r20-3b19

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