annotate lisp/packages/info.el @ 82:6a378aca36af r20-0b91

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