annotate lisp/packages/info.el @ 173:8eaf7971accc r20-3b13

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