Mercurial > emacs
annotate lisp/info.el @ 14279:085bc709c11d
(sys_select): Use time macros to prevent time values
from overflowing.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 24 Jan 1996 21:21:40 +0000 |
parents | 83f275dcd93a |
children | e39a2eb75dbe |
rev | line source |
---|---|
754
b096f4af925c
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
732
diff
changeset
|
1 ;;; info.el --- info package for Emacs. |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
2 |
7298 | 3 ;; Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc. |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
811
diff
changeset
|
4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
5 ;; Maintainer: FSF |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: help |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
7 |
325 | 8 ;; This file is part of GNU Emacs. |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
325 | 13 ;; any later version. |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
325 | 24 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
25 ;;; Commentary: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
26 |
14169 | 27 ;; Note that nowadays we expect info files to be made using makeinfo. |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
28 |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
29 ;;; Code: |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
754
diff
changeset
|
30 |
325 | 31 (defvar Info-history nil |
32 "List of info nodes user has visited. | |
33 Each element of list is a list (FILENAME NODENAME BUFFERPOS).") | |
34 | |
35 (defvar Info-enable-edit nil | |
3084
a4341d92948a
(Info-edit, Info-last-search, Info-enable-edit):
Richard M. Stallman <rms@gnu.org>
parents:
3047
diff
changeset
|
36 "*Non-nil means the \\<Info-mode-map>\\[Info-edit] command in Info can edit the current node. |
680
f99c8512cd41
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
37 This is convenient if you want to write info files by hand. |
f99c8512cd41
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
38 However, we recommend that you not do this. |
f99c8512cd41
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
39 It is better to write a Texinfo file and generate the Info file from that, |
f99c8512cd41
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
660
diff
changeset
|
40 because that gives you a printed manual as well.") |
325 | 41 |
42 (defvar Info-enable-active-nodes t | |
43 "Non-nil allows Info to execute Lisp code associated with nodes. | |
44 The Lisp code is executed when the node is selected.") | |
45 | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
46 (defvar Info-fontify t |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
47 "*Non-nil enables highlighting and fonts in Info nodes.") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
48 |
8193
0be48d0d16fd
(Info-fontify-maximum-menu-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8071
diff
changeset
|
49 (defvar Info-fontify-maximum-menu-size 30000 |
0be48d0d16fd
(Info-fontify-maximum-menu-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8071
diff
changeset
|
50 "*Maximum size of menu to fontify if `Info-fontify' is non-nil.") |
8480
7f28030d9529
(Info-additional-directory-list): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8461
diff
changeset
|
51 |
3330
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
52 (defvar Info-directory-list |
5482
27603dcb6260
(Info-directory-list): Change last elt to ../info (expanded).
Richard M. Stallman <rms@gnu.org>
parents:
5271
diff
changeset
|
53 (let ((path (getenv "INFOPATH")) |
12294
3631443c706e
(Info-directory-list): If path-separator isn't available, bind it here.
Richard M. Stallman <rms@gnu.org>
parents:
12156
diff
changeset
|
54 ;; This is for older Emacs versions |
3631443c706e
(Info-directory-list): If path-separator isn't available, bind it here.
Richard M. Stallman <rms@gnu.org>
parents:
12156
diff
changeset
|
55 ;; which might get this info.el from the Texinfo distribution. |
3631443c706e
(Info-directory-list): If path-separator isn't available, bind it here.
Richard M. Stallman <rms@gnu.org>
parents:
12156
diff
changeset
|
56 (path-separator (if (boundp 'path-separator) path-separator |
3631443c706e
(Info-directory-list): If path-separator isn't available, bind it here.
Richard M. Stallman <rms@gnu.org>
parents:
12156
diff
changeset
|
57 (if (eq system-type 'ms-dos) ";" ":"))) |
13620
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
58 (source (expand-file-name "info/" source-directory)) |
11781
fe6619d546fd
(Info-directory-list): Use installation-directory,
Richard M. Stallman <rms@gnu.org>
parents:
11759
diff
changeset
|
59 (sibling (if installation-directory |
13620
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
60 (expand-file-name "info/" installation-directory))) |
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
61 alternative) |
3330
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
62 (if path |
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
63 (let ((list nil) |
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
64 idx) |
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
65 (while (> (length path) 0) |
11959
0b8b8be6a3fd
(Info-directory-list): Use path-separator.
Karl Heuer <kwzh@gnu.org>
parents:
11781
diff
changeset
|
66 (setq idx (or (string-match path-separator path) (length path)) |
3330
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
67 list (cons (substring path 0 idx) list) |
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
68 path (substring path (min (1+ idx) |
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
69 (length path))))) |
4fd13e6109e3
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3313
diff
changeset
|
70 (nreverse list)) |
13620
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
71 (if (and sibling (file-exists-p sibling)) |
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
72 (setq alternative sibling) |
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
73 (setq alternative source)) |
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
74 (if (or (member alternative Info-default-directory-list) |
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
75 (not (file-exists-p alternative)) |
9782
7224fba93c27
(Info-directory-list): Treat windows-nt like ms-dos.
Richard M. Stallman <rms@gnu.org>
parents:
9588
diff
changeset
|
76 ;; On DOS/NT, we use movable executables always, |
7990
6be46752d57f
(Info-directory-list): For msdos, don't check for
Richard M. Stallman <rms@gnu.org>
parents:
7928
diff
changeset
|
77 ;; and we must always find the Info dir at run time. |
9782
7224fba93c27
(Info-directory-list): Treat windows-nt like ms-dos.
Richard M. Stallman <rms@gnu.org>
parents:
9588
diff
changeset
|
78 (if (or (eq system-type 'ms-dos) (eq system-type 'windows-nt)) |
7990
6be46752d57f
(Info-directory-list): For msdos, don't check for
Richard M. Stallman <rms@gnu.org>
parents:
7928
diff
changeset
|
79 nil |
6be46752d57f
(Info-directory-list): For msdos, don't check for
Richard M. Stallman <rms@gnu.org>
parents:
7928
diff
changeset
|
80 ;; Use invocation-directory for Info only if we used it for |
6be46752d57f
(Info-directory-list): For msdos, don't check for
Richard M. Stallman <rms@gnu.org>
parents:
7928
diff
changeset
|
81 ;; exec-directory also. |
6be46752d57f
(Info-directory-list): For msdos, don't check for
Richard M. Stallman <rms@gnu.org>
parents:
7928
diff
changeset
|
82 (not (string= exec-directory |
11781
fe6619d546fd
(Info-directory-list): Use installation-directory,
Richard M. Stallman <rms@gnu.org>
parents:
11759
diff
changeset
|
83 (expand-file-name "lib-src/" |
fe6619d546fd
(Info-directory-list): Use installation-directory,
Richard M. Stallman <rms@gnu.org>
parents:
11759
diff
changeset
|
84 installation-directory))))) |
5482
27603dcb6260
(Info-directory-list): Change last elt to ../info (expanded).
Richard M. Stallman <rms@gnu.org>
parents:
5271
diff
changeset
|
85 Info-default-directory-list |
13620
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
86 (reverse (cons alternative |
e5b36a1526dd
(Info-directory-list): Use source-directory.
Richard M. Stallman <rms@gnu.org>
parents:
13566
diff
changeset
|
87 (cdr (reverse Info-default-directory-list))))))) |
325 | 88 "List of directories to search for Info documentation files. |
540 | 89 nil means not yet initialized. In this case, Info uses the environment |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
90 variable INFOPATH to initialize it, or `Info-default-directory-list' |
7739
f2747ec591fd
(Info-directory-list): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7572
diff
changeset
|
91 if there is no INFOPATH variable in the environment. |
f2747ec591fd
(Info-directory-list): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7572
diff
changeset
|
92 The last element of `Info-default-directory-list' is the directory |
7753
198dd616a588
(Info-directory-list): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
7739
diff
changeset
|
93 where Emacs installs the Info files that come with it. |
8461
c88361c3b940
(Info-directory-list): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8369
diff
changeset
|
94 |
c88361c3b940
(Info-directory-list): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8369
diff
changeset
|
95 If you run the Emacs executable from the `src' directory in the Emacs |
c88361c3b940
(Info-directory-list): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8369
diff
changeset
|
96 source tree, the `info' directory in the source tree is used as the last |
c88361c3b940
(Info-directory-list): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8369
diff
changeset
|
97 element, in place of the installation Info directory. This is useful |
c88361c3b940
(Info-directory-list): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
8369
diff
changeset
|
98 when you run a version of Emacs without installing it.") |
325 | 99 |
8480
7f28030d9529
(Info-additional-directory-list): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8461
diff
changeset
|
100 (defvar Info-additional-directory-list nil |
7f28030d9529
(Info-additional-directory-list): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8461
diff
changeset
|
101 "List of additional directories to search for Info documentation files. |
7f28030d9529
(Info-additional-directory-list): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8461
diff
changeset
|
102 These directories are not searched for merging the `dir' file.") |
7f28030d9529
(Info-additional-directory-list): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8461
diff
changeset
|
103 |
325 | 104 (defvar Info-current-file nil |
12646
cd83cf47be08
(Info-current-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12433
diff
changeset
|
105 "Info file that Info is now looking at, or nil. |
cd83cf47be08
(Info-current-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12433
diff
changeset
|
106 This is the name that was specified in Info, not the actual file name. |
cd83cf47be08
(Info-current-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12433
diff
changeset
|
107 It doesn't contain directory names or file name extensions added by Info.") |
325 | 108 |
109 (defvar Info-current-subfile nil | |
110 "Info subfile that is actually in the *info* buffer now, | |
111 or nil if current info file is not split into subfiles.") | |
112 | |
113 (defvar Info-current-node nil | |
114 "Name of node that Info is now looking at, or nil.") | |
115 | |
116 (defvar Info-tag-table-marker (make-marker) | |
117 "Marker pointing at beginning of current Info file's tag table. | |
118 Marker points nowhere if file has no tag table.") | |
119 | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
120 (defvar Info-current-file-completions nil |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
121 "Cached completion list for current Info file.") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
122 |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
123 (defvar Info-index-alternatives nil |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
124 "List of possible matches for last Info-index command.") |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
125 |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
126 (defvar Info-standalone nil |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
127 "Non-nil if Emacs was started solely as an Info browser.") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
128 |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
129 (defvar Info-suffix-list |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
130 (if (eq system-type 'ms-dos) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
131 '( (".gz" . "gunzip") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
132 (".z" . "gunzip") |
13004
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
133 (".inf" . nil) |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
134 ("" . nil)) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
135 '( (".info.Z" . "uncompress") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
136 (".info.Y" . "unyabba") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
137 (".info.gz" . "gunzip") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
138 (".info.z" . "gunzip") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
139 (".info" . nil) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
140 (".Z" . "uncompress") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
141 (".Y" . "unyabba") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
142 (".gz" . "gunzip") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
143 (".z" . "gunzip") |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
144 ("" . nil))) |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
145 "List of file name suffixes and associated decoding commands. |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
146 Each entry should be (SUFFIX . STRING); the file is given to |
6566
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
147 the command as standard input. If STRING is nil, no decoding is done. |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
148 Because the SUFFIXes are tried in order, the empty string should |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
149 be last in the list.") |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
150 |
13562
80870ef96f18
(info-insert-file-contents-1): Various rewrites.
Richard M. Stallman <rms@gnu.org>
parents:
13287
diff
changeset
|
151 ;; Concatenate SUFFIX onto FILENAME. SUFFIX should start with a dot. |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
152 ;; First, on ms-dos, delete some of the extension in FILENAME |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
153 ;; to make room. |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
154 (defun info-insert-file-contents-1 (filename suffix) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
155 (if (not (eq system-type 'ms-dos)) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
156 (concat filename suffix) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
157 (let* ((sans-exts (file-name-sans-extension filename)) |
13562
80870ef96f18
(info-insert-file-contents-1): Various rewrites.
Richard M. Stallman <rms@gnu.org>
parents:
13287
diff
changeset
|
158 ;; How long is the extension in FILENAME (not counting the dot). |
80870ef96f18
(info-insert-file-contents-1): Various rewrites.
Richard M. Stallman <rms@gnu.org>
parents:
13287
diff
changeset
|
159 (ext-len (max 0 (- (length filename) (length sans-exts) 1))) |
80870ef96f18
(info-insert-file-contents-1): Various rewrites.
Richard M. Stallman <rms@gnu.org>
parents:
13287
diff
changeset
|
160 ext-left) |
13004
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
161 ;; SUFFIX starts with a dot. If FILENAME already has one, |
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
162 ;; get rid of the one in SUFFIX. |
13562
80870ef96f18
(info-insert-file-contents-1): Various rewrites.
Richard M. Stallman <rms@gnu.org>
parents:
13287
diff
changeset
|
163 (or (and (<= ext-len 0) |
13004
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
164 (not (eq (aref filename (1- (length filename))) ?.))) |
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
165 (setq suffix (substring suffix 1))) |
13562
80870ef96f18
(info-insert-file-contents-1): Various rewrites.
Richard M. Stallman <rms@gnu.org>
parents:
13287
diff
changeset
|
166 ;; How many chars of that extension should we keep? |
80870ef96f18
(info-insert-file-contents-1): Various rewrites.
Richard M. Stallman <rms@gnu.org>
parents:
13287
diff
changeset
|
167 (setq ext-left (min ext-len (max 0 (- 3 (length suffix))))) |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
168 ;; Get rid of the rest of the extension, and add SUFFIX. |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
169 (concat (substring filename 0 (- (length filename) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
170 (- ext-len ext-left))) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
171 suffix)))) |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
172 |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
173 (defun info-insert-file-contents (filename &optional visit) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
174 "Insert the contents of an info file in the current buffer. |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
175 Do the right thing if the file has been compressed or zipped." |
6566
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
176 (let ((tail Info-suffix-list) |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
177 fullname decoder) |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
178 (if (file-exists-p filename) |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
179 ;; FILENAME exists--see if that name contains a suffix. |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
180 ;; If so, set DECODE accordingly. |
6566
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
181 (progn |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
182 (while (and tail |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
183 (not (string-match |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
184 (concat (regexp-quote (car (car tail))) "$") |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
185 filename))) |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
186 (setq tail (cdr tail))) |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
187 (setq fullname filename |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
188 decoder (cdr (car tail)))) |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
189 ;; Try adding suffixes to FILENAME and see if we can find something. |
6566
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
190 (while (and tail |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
191 (not (file-exists-p (info-insert-file-contents-1 |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
192 filename (car (car tail)))))) |
6566
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
193 (setq tail (cdr tail))) |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
194 ;; If we found a file with a suffix, set DECODER according to the suffix |
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
195 ;; and set FULLNAME to the file's actual name. |
13004
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
196 (setq fullname (info-insert-file-contents-1 filename (car (car tail))) |
6566
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
197 decoder (cdr (car tail))) |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
198 (or tail |
12927
d3cda9e7c55f
(Info-suffix-list): For MS-DOS, use gunzip as the only uncompressor,
Richard M. Stallman <rms@gnu.org>
parents:
12892
diff
changeset
|
199 (error "Can't find %s or any compressed version of it" filename))) |
9588
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
200 ;; check for conflict with jka-compr |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
201 (if (and (featurep 'jka-compr) |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
202 (jka-compr-installed-p) |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
203 (jka-compr-get-compression-info fullname)) |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
204 (setq decoder nil)) |
6566
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
205 (insert-file-contents fullname visit) |
248eede22658
(Info-suffix-list): Put empty string last.
Karl Heuer <kwzh@gnu.org>
parents:
6537
diff
changeset
|
206 (if decoder |
11527
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
207 (let ((buffer-read-only nil) |
11759
51816af03215
(info-insert-file-contents): Don't use
Richard M. Stallman <rms@gnu.org>
parents:
11580
diff
changeset
|
208 (default-directory (or (file-name-directory fullname) |
51816af03215
(info-insert-file-contents): Don't use
Richard M. Stallman <rms@gnu.org>
parents:
11580
diff
changeset
|
209 default-directory))) |
13004
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
210 (call-process-region (point-min) (point-max) decoder t t))))) |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
211 |
10978
e3da01bbdc14
(same-window-buffer-names): Set this only in loaddefs.el,
Richard M. Stallman <rms@gnu.org>
parents:
10957
diff
changeset
|
212 ;;;###autoload (add-hook 'same-window-buffer-names "*info*") |
10957
6d3568e33019
(Info-menu): Bind beg with let.
Richard M. Stallman <rms@gnu.org>
parents:
10918
diff
changeset
|
213 |
6d3568e33019
(Info-menu): Bind beg with let.
Richard M. Stallman <rms@gnu.org>
parents:
10918
diff
changeset
|
214 ;;;###autoload |
325 | 215 (defun info (&optional file) |
216 "Enter Info, the documentation browser. | |
217 Optional argument FILE specifies the file to examine; | |
218 the default is the top-level directory of Info. | |
219 | |
220 In interactive use, a prefix argument directs this command | |
221 to read a file name from the minibuffer." | |
222 (interactive (if current-prefix-arg | |
223 (list (read-file-name "Info file name: " nil nil t)))) | |
224 (if file | |
225 (Info-goto-node (concat "(" file ")")) | |
226 (if (get-buffer "*info*") | |
10957
6d3568e33019
(Info-menu): Bind beg with let.
Richard M. Stallman <rms@gnu.org>
parents:
10918
diff
changeset
|
227 (pop-to-buffer "*info*") |
325 | 228 (Info-directory)))) |
229 | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
230 ;;;###autoload |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
231 (defun info-standalone () |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
232 "Run Emacs as a standalone Info reader. |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
233 Usage: emacs -f info-standalone [filename] |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
234 In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
235 (setq Info-standalone t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
236 (if (and command-line-args-left |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
237 (not (string-match "^-" (car command-line-args-left)))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
238 (condition-case err |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
239 (progn |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
240 (info (car command-line-args-left)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
241 (setq command-line-args-left (cdr command-line-args-left))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
242 (error (send-string-to-terminal |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
243 (format "%s\n" (if (eq (car-safe err) 'error) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
244 (nth 1 err) err))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
245 (save-buffers-kill-emacs))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
246 (info))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
247 |
325 | 248 ;; Go to an info node specified as separate filename and nodename. |
249 ;; no-going-back is non-nil if recovering from an error in this function; | |
250 ;; it says do not attempt further (recursive) error recovery. | |
251 (defun Info-find-node (filename nodename &optional no-going-back) | |
252 ;; Convert filename to lower case if not found as specified. | |
253 ;; Expand it. | |
254 (if filename | |
255 (let (temp temp-downcase found) | |
256 (setq filename (substitute-in-file-name filename)) | |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
257 (if (string= (downcase (file-name-nondirectory filename)) "dir") |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
258 (setq found t) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
259 (let ((dirs (if (string-match "^\\./" filename) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
260 ;; If specified name starts with `./' |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
261 ;; then just try current directory. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
262 '("./") |
9588
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
263 (if (file-name-absolute-p filename) |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
264 ;; No point in searching for an |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
265 ;; absolute file name |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
266 '(nil) |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
267 (if Info-additional-directory-list |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
268 (append Info-directory-list |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
269 Info-additional-directory-list) |
7d465ccfd45b
(info-insert-file-contents): Always check for conflict with jka-compr.
Richard M. Stallman <rms@gnu.org>
parents:
9572
diff
changeset
|
270 Info-directory-list))))) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
271 ;; Search the directory list for file FILENAME. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
272 (while (and dirs (not found)) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
273 (setq temp (expand-file-name filename (car dirs))) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
274 (setq temp-downcase |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
275 (expand-file-name (downcase filename) (car dirs))) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
276 ;; Try several variants of specified name. |
8369
c10b35194993
(Info-find-node): Use a loop instead of mapcar and catch.
Richard M. Stallman <rms@gnu.org>
parents:
8193
diff
changeset
|
277 (let ((suffix-list Info-suffix-list)) |
c10b35194993
(Info-find-node): Use a loop instead of mapcar and catch.
Richard M. Stallman <rms@gnu.org>
parents:
8193
diff
changeset
|
278 (while (and suffix-list (not found)) |
c10b35194993
(Info-find-node): Use a loop instead of mapcar and catch.
Richard M. Stallman <rms@gnu.org>
parents:
8193
diff
changeset
|
279 (cond ((file-exists-p |
13004
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
280 (info-insert-file-contents-1 |
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
281 temp (car (car suffix-list)))) |
8369
c10b35194993
(Info-find-node): Use a loop instead of mapcar and catch.
Richard M. Stallman <rms@gnu.org>
parents:
8193
diff
changeset
|
282 (setq found temp)) |
c10b35194993
(Info-find-node): Use a loop instead of mapcar and catch.
Richard M. Stallman <rms@gnu.org>
parents:
8193
diff
changeset
|
283 ((file-exists-p |
13004
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
284 (info-insert-file-contents-1 |
0ed37da6f0f3
(Info-suffix-list): Add .inf to MSDOS list.
Richard M. Stallman <rms@gnu.org>
parents:
12947
diff
changeset
|
285 temp-downcase (car (car suffix-list)))) |
8369
c10b35194993
(Info-find-node): Use a loop instead of mapcar and catch.
Richard M. Stallman <rms@gnu.org>
parents:
8193
diff
changeset
|
286 (setq found temp-downcase))) |
c10b35194993
(Info-find-node): Use a loop instead of mapcar and catch.
Richard M. Stallman <rms@gnu.org>
parents:
8193
diff
changeset
|
287 (setq suffix-list (cdr suffix-list)))) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
288 (setq dirs (cdr dirs))))) |
325 | 289 (if found |
290 (setq filename found) | |
291 (error "Info file %s does not exist" filename)))) | |
292 ;; Record the node we are leaving. | |
293 (if (and Info-current-file (not no-going-back)) | |
294 (setq Info-history | |
295 (cons (list Info-current-file Info-current-node (point)) | |
296 Info-history))) | |
297 ;; Go into info buffer. | |
298 (switch-to-buffer "*info*") | |
1484
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
299 (buffer-disable-undo (current-buffer)) |
325 | 300 (or (eq major-mode 'Info-mode) |
301 (Info-mode)) | |
302 (widen) | |
303 (setq Info-current-node nil) | |
304 (unwind-protect | |
305 (progn | |
306 ;; Switch files if necessary | |
307 (or (null filename) | |
308 (equal Info-current-file filename) | |
309 (let ((buffer-read-only nil)) | |
310 (setq Info-current-file nil | |
311 Info-current-subfile nil | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
312 Info-current-file-completions nil |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
313 Info-index-alternatives nil |
325 | 314 buffer-file-name nil) |
315 (erase-buffer) | |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
316 (if (eq filename t) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
317 (Info-insert-dir) |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
318 (info-insert-file-contents filename t) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
319 (setq default-directory (file-name-directory filename))) |
325 | 320 (set-buffer-modified-p nil) |
321 ;; See whether file has a tag table. Record the location if yes. | |
322 (set-marker Info-tag-table-marker nil) | |
323 (goto-char (point-max)) | |
324 (forward-line -8) | |
11527
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
325 ;; Use string-equal, not equal, to ignore text props. |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
326 (or (string-equal nodename "*") |
325 | 327 (not (search-forward "\^_\nEnd tag table\n" nil t)) |
328 (let (pos) | |
329 ;; We have a tag table. Find its beginning. | |
330 ;; Is this an indirect file? | |
331 (search-backward "\nTag table:\n") | |
332 (setq pos (point)) | |
333 (if (save-excursion | |
334 (forward-line 2) | |
335 (looking-at "(Indirect)\n")) | |
336 ;; It is indirect. Copy it to another buffer | |
337 ;; and record that the tag table is in that buffer. | |
338 (save-excursion | |
339 (let ((buf (current-buffer))) | |
340 (set-buffer (get-buffer-create " *info tag table*")) | |
1484
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
341 (buffer-disable-undo (current-buffer)) |
325 | 342 (setq case-fold-search t) |
343 (erase-buffer) | |
344 (insert-buffer-substring buf) | |
345 (set-marker Info-tag-table-marker | |
346 (match-end 0)))) | |
998 | 347 (set-marker Info-tag-table-marker pos)))) |
325 | 348 (setq Info-current-file |
12646
cd83cf47be08
(Info-current-file): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
12433
diff
changeset
|
349 (if (eq filename t) "dir" filename)))) |
11527
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
350 ;; Use string-equal, not equal, to ignore text props. |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
351 (if (string-equal nodename "*") |
325 | 352 (progn (setq Info-current-node nodename) |
353 (Info-set-mode-line)) | |
354 ;; Search file for a suitable node. | |
990
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
355 (let ((guesspos (point-min)) |
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
356 (regexp (concat "Node: *" (regexp-quote nodename) " *[,\t\n\177]"))) |
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
357 ;; First get advice from tag table if file has one. |
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
358 ;; Also, if this is an indirect info file, |
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
359 ;; read the proper subfile into this buffer. |
325 | 360 (if (marker-position Info-tag-table-marker) |
361 (save-excursion | |
362 (set-buffer (marker-buffer Info-tag-table-marker)) | |
363 (goto-char Info-tag-table-marker) | |
990
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
364 (if (re-search-forward regexp nil t) |
325 | 365 (progn |
366 (setq guesspos (read (current-buffer))) | |
367 ;; If this is an indirect file, | |
368 ;; determine which file really holds this node | |
369 ;; and read it in. | |
370 (if (not (eq (current-buffer) (get-buffer "*info*"))) | |
371 (setq guesspos | |
372 (Info-read-subfile guesspos)))) | |
373 (error "No such node: \"%s\"" nodename)))) | |
990
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
374 (goto-char (max (point-min) (- guesspos 1000))) |
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
375 ;; Now search from our advised position (or from beg of buffer) |
d76731ebdff0
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
930
diff
changeset
|
376 ;; to find the actual node. |
325 | 377 (catch 'foo |
378 (while (search-forward "\n\^_" nil t) | |
379 (forward-line 1) | |
380 (let ((beg (point))) | |
381 (forward-line 1) | |
382 (if (re-search-backward regexp beg t) | |
383 (throw 'foo t)))) | |
384 (error "No such node: %s" nodename))) | |
385 (Info-select-node))) | |
386 ;; If we did not finish finding the specified node, | |
387 ;; go back to the previous one. | |
6716
9ce2d1a2c155
(Info-find-node): Don't try to backstep if no history.
Karl Heuer <kwzh@gnu.org>
parents:
6624
diff
changeset
|
388 (or Info-current-node no-going-back (null Info-history) |
325 | 389 (let ((hist (car Info-history))) |
390 (setq Info-history (cdr Info-history)) | |
391 (Info-find-node (nth 0 hist) (nth 1 hist) t) | |
392 (goto-char (nth 2 hist))))) | |
393 (goto-char (point-min))) | |
394 | |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
395 ;; Cache the contents of the (virtual) dir file, once we have merged |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
396 ;; it for the first time, so we can save time subsequently. |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
397 (defvar Info-dir-contents nil) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
398 |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
399 ;; Cache for the directory we decided to use for the default-directory |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
400 ;; of the merged dir text. |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
401 (defvar Info-dir-contents-directory nil) |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
402 |
3836
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
403 ;; Record the file attributes of all the files from which we |
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
404 ;; constructed Info-dir-contents. |
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
405 (defvar Info-dir-file-attributes nil) |
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
406 |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
407 ;; Construct the Info directory node by merging the files named `dir' |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
408 ;; from various directories. Set the *info* buffer's |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
409 ;; default-directory to the first directory we actually get any text |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
410 ;; from. |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
411 (defun Info-insert-dir () |
3836
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
412 (if (and Info-dir-contents Info-dir-file-attributes |
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
413 ;; Verify that none of the files we used has changed |
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
414 ;; since we used it. |
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
415 (eval (cons 'and |
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
416 (mapcar '(lambda (elt) |
7911
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
417 (let ((curr (file-attributes (car elt)))) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
418 ;; Don't compare the access time. |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
419 (if curr (setcar (nthcdr 4 curr) 0)) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
420 (setcar (nthcdr 4 (cdr elt)) 0) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
421 (equal (cdr elt) curr))) |
3836
04f1cff889f4
(Info-insert-dir): Record file attributes of files used.
Richard M. Stallman <rms@gnu.org>
parents:
3565
diff
changeset
|
422 Info-dir-file-attributes)))) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
423 (insert Info-dir-contents) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
424 (let ((dirs Info-directory-list) |
3212
cd8f8468a190
(Info-insert-dir): Ignore duplicate directories.
Richard M. Stallman <rms@gnu.org>
parents:
3127
diff
changeset
|
425 buffers buffer others nodes dirs-done) |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
426 |
7911
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
427 (setq Info-dir-file-attributes nil) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
428 |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
429 ;; Search the directory list for the directory file. |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
430 (while dirs |
5271
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
431 (let ((truename (file-truename (expand-file-name (car dirs))))) |
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
432 (or (member truename dirs-done) |
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
433 (member (directory-file-name truename) dirs-done) |
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
434 ;; Try several variants of specified name. |
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
435 ;; Try upcasing, appending `.info', or both. |
7911
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
436 (let* (file |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
437 (attrs |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
438 (or |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
439 (progn (setq file (expand-file-name "dir" truename)) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
440 (file-attributes file)) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
441 (progn (setq file (expand-file-name "DIR" truename)) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
442 (file-attributes file)) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
443 (progn (setq file (expand-file-name "dir.info" truename)) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
444 (file-attributes file)) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
445 (progn (setq file (expand-file-name "DIR.INFO" truename)) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
446 (file-attributes file))))) |
5271
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
447 (setq dirs-done |
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
448 (cons truename |
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
449 (cons (directory-file-name truename) |
c415cc48a084
(Info-insert-dir): Compute truename just once for each dir.
Richard M. Stallman <rms@gnu.org>
parents:
5146
diff
changeset
|
450 dirs-done))) |
7911
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
451 (if attrs |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
452 (save-excursion |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
453 (or buffers |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
454 (message "Composing main Info directory...")) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
455 (set-buffer (generate-new-buffer "info dir")) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
456 (insert-file-contents file) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
457 (setq buffers (cons (current-buffer) buffers) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
458 Info-dir-file-attributes |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
459 (cons (cons file attrs) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
460 Info-dir-file-attributes)))))) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
461 (setq dirs (cdr dirs)))) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
462 |
6716
9ce2d1a2c155
(Info-find-node): Don't try to backstep if no history.
Karl Heuer <kwzh@gnu.org>
parents:
6624
diff
changeset
|
463 (or buffers |
9ce2d1a2c155
(Info-find-node): Don't try to backstep if no history.
Karl Heuer <kwzh@gnu.org>
parents:
6624
diff
changeset
|
464 (error "Can't find the info directory node")) |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
465 ;; Distinguish the dir file that comes with Emacs from all the |
3212
cd8f8468a190
(Info-insert-dir): Ignore duplicate directories.
Richard M. Stallman <rms@gnu.org>
parents:
3127
diff
changeset
|
466 ;; others. Yes, that is really what this is supposed to do. |
cd8f8468a190
(Info-insert-dir): Ignore duplicate directories.
Richard M. Stallman <rms@gnu.org>
parents:
3127
diff
changeset
|
467 ;; If it doesn't work, fix it. |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
468 (setq buffer (car buffers) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
469 others (cdr buffers)) |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
470 |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
471 ;; Insert the entire original dir file as a start; use its |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
472 ;; default directory as the default directory for the whole |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
473 ;; concatenation. |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
474 (insert-buffer buffer) |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
475 (setq Info-dir-contents-directory (save-excursion |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
476 (set-buffer buffer) |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
477 default-directory)) |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
478 |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
479 ;; Look at each of the other buffers one by one. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
480 (while others |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
481 (let ((other (car others))) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
482 ;; In each, find all the menus. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
483 (save-excursion |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
484 (set-buffer other) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
485 (goto-char (point-min)) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
486 ;; Find each menu, and add an elt to NODES for it. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
487 (while (re-search-forward "^\\* Menu:" nil t) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
488 (let (beg nodename end) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
489 (forward-line 1) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
490 (setq beg (point)) |
6339
f0f62abb621b
(Info-insert-dir): Use printable escapes instead of embedding literal control
Karl Heuer <kwzh@gnu.org>
parents:
6121
diff
changeset
|
491 (search-backward "\n\^_") |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
492 (search-forward "Node: ") |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
493 (setq nodename (Info-following-node-name)) |
6339
f0f62abb621b
(Info-insert-dir): Use printable escapes instead of embedding literal control
Karl Heuer <kwzh@gnu.org>
parents:
6121
diff
changeset
|
494 (search-forward "\n\^_" nil 'move) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
495 (beginning-of-line) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
496 (setq end (point)) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
497 (setq nodes (cons (list nodename other beg end) nodes)))))) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
498 (setq others (cdr others))) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
499 ;; Add to the main menu a menu item for each other node. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
500 (re-search-forward "^\\* Menu:") |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
501 (forward-line 1) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
502 (let ((menu-items '("top")) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
503 (nodes nodes) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
504 (case-fold-search t) |
6339
f0f62abb621b
(Info-insert-dir): Use printable escapes instead of embedding literal control
Karl Heuer <kwzh@gnu.org>
parents:
6121
diff
changeset
|
505 (end (save-excursion (search-forward "\^_" nil t) (point)))) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
506 (while nodes |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
507 (let ((nodename (car (car nodes)))) |
6537
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
508 (save-excursion |
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
509 (or (member (downcase nodename) menu-items) |
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
510 (re-search-forward (concat "^\\* " |
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
511 (regexp-quote nodename) |
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
512 "::") |
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
513 end t) |
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
514 (progn |
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
515 (insert "* " nodename "::" "\n") |
f5ab0b6b9640
(Info-insert-dir): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
6339
diff
changeset
|
516 (setq menu-items (cons nodename menu-items)))))) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
517 (setq nodes (cdr nodes)))) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
518 ;; Now take each node of each of the other buffers |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
519 ;; and merge it into the main buffer. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
520 (while nodes |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
521 (let ((nodename (car (car nodes)))) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
522 (goto-char (point-min)) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
523 ;; Find the like-named node in the main buffer. |
6339
f0f62abb621b
(Info-insert-dir): Use printable escapes instead of embedding literal control
Karl Heuer <kwzh@gnu.org>
parents:
6121
diff
changeset
|
524 (if (re-search-forward (concat "\n\^_.*\n.*Node: " |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
525 (regexp-quote nodename) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
526 "[,\n\t]") |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
527 nil t) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
528 (progn |
6339
f0f62abb621b
(Info-insert-dir): Use printable escapes instead of embedding literal control
Karl Heuer <kwzh@gnu.org>
parents:
6121
diff
changeset
|
529 (search-forward "\n\^_" nil 'move) |
8913
65a8b9c507dc
(Info-insert-dir): Insert newlines before rather than
Richard M. Stallman <rms@gnu.org>
parents:
8805
diff
changeset
|
530 (beginning-of-line) |
65a8b9c507dc
(Info-insert-dir): Insert newlines before rather than
Richard M. Stallman <rms@gnu.org>
parents:
8805
diff
changeset
|
531 (insert "\n")) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
532 ;; If none exists, add one. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
533 (goto-char (point-max)) |
8069
dfef58fcda75
(Info-insert-dir): Capitalize `node' when inserting it.
Richard M. Stallman <rms@gnu.org>
parents:
8018
diff
changeset
|
534 (insert "\^_\nFile: dir\tNode: " nodename "\n\n* Menu:\n\n")) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
535 ;; Merge the text from the other buffer's menu |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
536 ;; into the menu in the like-named node in the main buffer. |
8913
65a8b9c507dc
(Info-insert-dir): Insert newlines before rather than
Richard M. Stallman <rms@gnu.org>
parents:
8805
diff
changeset
|
537 (apply 'insert-buffer-substring (cdr (car nodes)))) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
538 (setq nodes (cdr nodes))) |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
539 ;; Kill all the buffers we just made. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
540 (while buffers |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
541 (kill-buffer (car buffers)) |
7911
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
542 (setq buffers (cdr buffers))) |
185c1f12db67
(Info-insert-dir): Ignore access times when comparing
Richard M. Stallman <rms@gnu.org>
parents:
7859
diff
changeset
|
543 (message "Composing main Info directory...done")) |
1979
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
544 (setq Info-dir-contents (buffer-string))) |
0582c70595f1
* info.el (Info-directory-list): Doc fix; it is set according to
Jim Blandy <jimb@redhat.com>
parents:
1971
diff
changeset
|
545 (setq default-directory Info-dir-contents-directory)) |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
546 |
325 | 547 (defun Info-read-subfile (nodepos) |
548 (set-buffer (marker-buffer Info-tag-table-marker)) | |
549 (goto-char (point-min)) | |
550 (search-forward "\n\^_") | |
551 (let (lastfilepos | |
552 lastfilename) | |
553 (forward-line 2) | |
554 (catch 'foo | |
555 (while (not (looking-at "\^_")) | |
556 (if (not (eolp)) | |
557 (let ((beg (point)) | |
558 thisfilepos thisfilename) | |
559 (search-forward ": ") | |
560 (setq thisfilename (buffer-substring beg (- (point) 2))) | |
561 (setq thisfilepos (read (current-buffer))) | |
562 ;; read in version 19 stops at the end of number. | |
563 ;; Advance to the next line. | |
564 (forward-line 1) | |
565 (if (> thisfilepos nodepos) | |
566 (throw 'foo t)) | |
567 (setq lastfilename thisfilename) | |
568 (setq lastfilepos thisfilepos)) | |
569 (forward-line 1)))) | |
570 (set-buffer (get-buffer "*info*")) | |
571 (or (equal Info-current-subfile lastfilename) | |
572 (let ((buffer-read-only nil)) | |
573 (setq buffer-file-name nil) | |
574 (widen) | |
575 (erase-buffer) | |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
576 (info-insert-file-contents lastfilename) |
325 | 577 (set-buffer-modified-p nil) |
578 (setq Info-current-subfile lastfilename))) | |
579 (goto-char (point-min)) | |
580 (search-forward "\n\^_") | |
581 (+ (- nodepos lastfilepos) (point)))) | |
582 | |
583 ;; Select the info node that point is in. | |
584 (defun Info-select-node () | |
585 (save-excursion | |
586 ;; Find beginning of node. | |
587 (search-backward "\n\^_") | |
588 (forward-line 2) | |
589 ;; Get nodename spelled as it is in the node. | |
590 (re-search-forward "Node:[ \t]*") | |
591 (setq Info-current-node | |
13287
f25084d29719
(Info-following-node-name, Info-extract-menu-node-name)
Richard M. Stallman <rms@gnu.org>
parents:
13085
diff
changeset
|
592 (buffer-substring-no-properties (point) |
f25084d29719
(Info-following-node-name, Info-extract-menu-node-name)
Richard M. Stallman <rms@gnu.org>
parents:
13085
diff
changeset
|
593 (progn |
f25084d29719
(Info-following-node-name, Info-extract-menu-node-name)
Richard M. Stallman <rms@gnu.org>
parents:
13085
diff
changeset
|
594 (skip-chars-forward "^,\t\n") |
f25084d29719
(Info-following-node-name, Info-extract-menu-node-name)
Richard M. Stallman <rms@gnu.org>
parents:
13085
diff
changeset
|
595 (point)))) |
325 | 596 (Info-set-mode-line) |
597 ;; Find the end of it, and narrow. | |
598 (beginning-of-line) | |
599 (let (active-expression) | |
600 (narrow-to-region (point) | |
601 (if (re-search-forward "\n[\^_\f]" nil t) | |
602 (prog1 | |
603 (1- (point)) | |
604 (if (looking-at "[\n\^_\f]*execute: ") | |
605 (progn | |
606 (goto-char (match-end 0)) | |
607 (setq active-expression | |
608 (read (current-buffer)))))) | |
609 (point-max))) | |
4261
f9599125f7f0
(Info-select-node): Run Info-selection-hook.
Richard M. Stallman <rms@gnu.org>
parents:
3844
diff
changeset
|
610 (if Info-enable-active-nodes (eval active-expression)) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
611 (if Info-fontify (Info-fontify-node)) |
4261
f9599125f7f0
(Info-select-node): Run Info-selection-hook.
Richard M. Stallman <rms@gnu.org>
parents:
3844
diff
changeset
|
612 (run-hooks 'Info-selection-hook)))) |
325 | 613 |
614 (defun Info-set-mode-line () | |
615 (setq mode-line-buffer-identification | |
616 (concat | |
617 "Info: (" | |
618 (if Info-current-file | |
619 (file-name-nondirectory Info-current-file) | |
620 "") | |
621 ")" | |
622 (or Info-current-node "")))) | |
623 | |
624 ;; Go to an info node specified with a filename-and-nodename string | |
625 ;; of the sort that is found in pointers in nodes. | |
626 | |
627 (defun Info-goto-node (nodename) | |
628 "Go to info node named NAME. Give just NODENAME or (FILENAME)NODENAME." | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
629 (interactive (list (Info-read-node-name "Goto node: "))) |
325 | 630 (let (filename) |
631 (string-match "\\s *\\((\\s *\\([^\t)]*\\)\\s *)\\s *\\|\\)\\(.*\\)" | |
632 nodename) | |
633 (setq filename (if (= (match-beginning 1) (match-end 1)) | |
634 "" | |
635 (substring nodename (match-beginning 2) (match-end 2))) | |
636 nodename (substring nodename (match-beginning 3) (match-end 3))) | |
637 (let ((trim (string-match "\\s *\\'" filename))) | |
638 (if trim (setq filename (substring filename 0 trim)))) | |
639 (let ((trim (string-match "\\s *\\'" nodename))) | |
640 (if trim (setq nodename (substring nodename 0 trim)))) | |
12433
17387b7fe5b8
(Info-goto-node, Info-search):
Richard M. Stallman <rms@gnu.org>
parents:
12294
diff
changeset
|
641 (if transient-mark-mode (deactivate-mark)) |
325 | 642 (Info-find-node (if (equal filename "") nil filename) |
643 (if (equal nodename "") "Top" nodename)))) | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
644 |
12779
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
645 ;; This function is used as the "completion table" while reading a node name. |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
646 ;; It does completion using the alist in completion-table |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
647 ;; unless STRING starts with an open-paren. |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
648 (defun Info-read-node-name-1 (string predicate code) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
649 (let ((no-completion (and (> (length string) 0) (eq (aref string 0) ?\()))) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
650 (cond ((eq code nil) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
651 (if no-completion |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
652 string |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
653 (try-completion string completion-table predicate))) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
654 ((eq code t) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
655 (if no-completion |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
656 nil |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
657 (all-completions string completion-table predicate))) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
658 ((eq code 'lambda) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
659 (if no-completion |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
660 t |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
661 (assoc string completion-table)))))) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
662 |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
663 (defun Info-read-node-name (prompt &optional default) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
664 (let* ((completion-ignore-case t) |
12779
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
665 (completion-table (Info-build-node-completions)) |
5b3d83e51b91
(Info-read-node-name-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
12646
diff
changeset
|
666 (nodename (completing-read prompt 'Info-read-node-name-1))) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
667 (if (equal nodename "") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
668 (or default |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
669 (Info-read-node-name prompt)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
670 nodename))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
671 |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
672 (defun Info-build-node-completions () |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
673 (or Info-current-file-completions |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
674 (let ((compl nil)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
675 (save-excursion |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
676 (save-restriction |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
677 (if (marker-buffer Info-tag-table-marker) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
678 (progn |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
679 (set-buffer (marker-buffer Info-tag-table-marker)) |
6049
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
680 (widen) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
681 (goto-char Info-tag-table-marker) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
682 (while (re-search-forward "\nNode: \\(.*\\)\177" nil t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
683 (setq compl |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
684 (cons (list (buffer-substring (match-beginning 1) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
685 (match-end 1))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
686 compl)))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
687 (widen) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
688 (goto-char (point-min)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
689 (while (search-forward "\n\^_" nil t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
690 (forward-line 1) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
691 (let ((beg (point))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
692 (forward-line 1) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
693 (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]" |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
694 beg t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
695 (setq compl |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
696 (cons (list (buffer-substring (match-beginning 1) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
697 (match-end 1))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
698 compl)))))))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
699 (setq Info-current-file-completions compl)))) |
325 | 700 |
540 | 701 (defun Info-restore-point (hl) |
702 "If this node has been visited, restore the point value when we left." | |
6049
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
703 (while hl |
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
704 (if (and (equal (nth 0 (car hl)) Info-current-file) |
11527
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
705 ;; Use string-equal, not equal, to ignore text props. |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
706 (string-equal (nth 1 (car hl)) Info-current-node)) |
6049
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
707 (progn |
6121
a9caf92da1d3
(Info-restore-point): Don't wipe out hl before using it.
Karl Heuer <kwzh@gnu.org>
parents:
6049
diff
changeset
|
708 (goto-char (nth 2 (car hl))) |
a9caf92da1d3
(Info-restore-point): Don't wipe out hl before using it.
Karl Heuer <kwzh@gnu.org>
parents:
6049
diff
changeset
|
709 (setq hl nil)) ;terminate the while at next iter |
6049
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
710 (setq hl (cdr hl))))) |
540 | 711 |
325 | 712 (defvar Info-last-search nil |
3084
a4341d92948a
(Info-edit, Info-last-search, Info-enable-edit):
Richard M. Stallman <rms@gnu.org>
parents:
3047
diff
changeset
|
713 "Default regexp for \\<Info-mode-map>\\[Info-search] command to search for.") |
325 | 714 |
715 (defun Info-search (regexp) | |
716 "Search for REGEXP, starting from point, and select node it's found in." | |
717 (interactive "sSearch (regexp): ") | |
12433
17387b7fe5b8
(Info-goto-node, Info-search):
Richard M. Stallman <rms@gnu.org>
parents:
12294
diff
changeset
|
718 (if transient-mark-mode (deactivate-mark)) |
325 | 719 (if (equal regexp "") |
720 (setq regexp Info-last-search) | |
721 (setq Info-last-search regexp)) | |
722 (let ((found ()) current | |
723 (onode Info-current-node) | |
724 (ofile Info-current-file) | |
725 (opoint (point)) | |
726 (osubfile Info-current-subfile)) | |
727 (save-excursion | |
728 (save-restriction | |
729 (widen) | |
730 (if (null Info-current-subfile) | |
731 (progn (re-search-forward regexp) (setq found (point))) | |
732 (condition-case err | |
733 (progn (re-search-forward regexp) (setq found (point))) | |
734 (search-failed nil))))) | |
735 (if (not found) ;can only happen in subfile case -- else would have erred | |
736 (unwind-protect | |
737 (let ((list ())) | |
738 (set-buffer (marker-buffer Info-tag-table-marker)) | |
739 (goto-char (point-min)) | |
740 (search-forward "\n\^_\nIndirect:") | |
741 (save-restriction | |
742 (narrow-to-region (point) | |
743 (progn (search-forward "\n\^_") | |
744 (1- (point)))) | |
745 (goto-char (point-min)) | |
746 (search-forward (concat "\n" osubfile ": ")) | |
747 (beginning-of-line) | |
748 (while (not (eobp)) | |
749 (re-search-forward "\\(^.*\\): [0-9]+$") | |
750 (goto-char (+ (match-end 1) 2)) | |
751 (setq list (cons (cons (read (current-buffer)) | |
752 (buffer-substring (match-beginning 1) | |
753 (match-end 1))) | |
754 list)) | |
755 (goto-char (1+ (match-end 0)))) | |
756 (setq list (nreverse list) | |
757 current (car (car list)) | |
758 list (cdr list))) | |
759 (while list | |
760 (message "Searching subfile %s..." (cdr (car list))) | |
761 (Info-read-subfile (car (car list))) | |
762 (setq list (cdr list)) | |
8069
dfef58fcda75
(Info-insert-dir): Capitalize `node' when inserting it.
Richard M. Stallman <rms@gnu.org>
parents:
8018
diff
changeset
|
763 ;; (goto-char (point-min)) |
325 | 764 (if (re-search-forward regexp nil t) |
765 (setq found (point) list ()))) | |
766 (if found | |
767 (message "") | |
768 (signal 'search-failed (list regexp)))) | |
769 (if (not found) | |
770 (progn (Info-read-subfile opoint) | |
771 (goto-char opoint) | |
772 (Info-select-node))))) | |
773 (widen) | |
774 (goto-char found) | |
775 (Info-select-node) | |
11527
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
776 ;; Use string-equal, not equal, to ignore text props. |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
777 (or (and (string-equal onode Info-current-node) |
325 | 778 (equal ofile Info-current-file)) |
779 (setq Info-history (cons (list ofile onode opoint) | |
780 Info-history))))) | |
781 | |
782 ;; Extract the value of the node-pointer named NAME. | |
783 ;; If there is none, use ERRORNAME in the error message; | |
784 ;; if ERRORNAME is nil, just return nil. | |
785 (defun Info-extract-pointer (name &optional errorname) | |
786 (save-excursion | |
787 (goto-char (point-min)) | |
788 (forward-line 1) | |
789 (if (re-search-backward (concat name ":") nil t) | |
790 (progn | |
791 (goto-char (match-end 0)) | |
792 (Info-following-node-name)) | |
793 (if (eq errorname t) | |
794 nil | |
795 (error (concat "Node has no " (capitalize (or errorname name)))))))) | |
796 | |
1971
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
797 ;; Return the node name in the buffer following point. |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
798 ;; ALLOWEDCHARS, if non-nil, goes within [...] to make a regexp |
b540866e8a79
(Info-insert-dir): Make menu items in Top node
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
799 ;; saying which chas may appear in the node name. |
325 | 800 (defun Info-following-node-name (&optional allowedchars) |
801 (skip-chars-forward " \t") | |
13287
f25084d29719
(Info-following-node-name, Info-extract-menu-node-name)
Richard M. Stallman <rms@gnu.org>
parents:
13085
diff
changeset
|
802 (buffer-substring-no-properties |
325 | 803 (point) |
804 (progn | |
805 (while (looking-at (concat "[" (or allowedchars "^,\t\n") "]")) | |
806 (skip-chars-forward (concat (or allowedchars "^,\t\n") "(")) | |
807 (if (looking-at "(") | |
808 (skip-chars-forward "^)"))) | |
809 (skip-chars-backward " ") | |
810 (point)))) | |
811 | |
812 (defun Info-next () | |
813 "Go to the next node of this node." | |
814 (interactive) | |
815 (Info-goto-node (Info-extract-pointer "next"))) | |
816 | |
817 (defun Info-prev () | |
818 "Go to the previous node of this node." | |
819 (interactive) | |
820 (Info-goto-node (Info-extract-pointer "prev[ious]*" "previous"))) | |
821 | |
822 (defun Info-up () | |
823 "Go to the superior node of this node." | |
824 (interactive) | |
540 | 825 (Info-goto-node (Info-extract-pointer "up")) |
826 (Info-restore-point Info-history)) | |
325 | 827 |
828 (defun Info-last () | |
829 "Go back to the last node visited." | |
830 (interactive) | |
831 (or Info-history | |
832 (error "This is the first Info node you looked at")) | |
833 (let (filename nodename opoint) | |
834 (setq filename (car (car Info-history))) | |
835 (setq nodename (car (cdr (car Info-history)))) | |
836 (setq opoint (car (cdr (cdr (car Info-history))))) | |
837 (setq Info-history (cdr Info-history)) | |
838 (Info-find-node filename nodename) | |
839 (setq Info-history (cdr Info-history)) | |
840 (goto-char opoint))) | |
841 | |
842 (defun Info-directory () | |
843 "Go to the Info directory node." | |
844 (interactive) | |
845 (Info-find-node "dir" "top")) | |
846 | |
847 (defun Info-follow-reference (footnotename) | |
848 "Follow cross reference named NAME to the node it refers to. | |
849 NAME may be an abbreviation of the reference name." | |
850 (interactive | |
851 (let ((completion-ignore-case t) | |
5555
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
852 completions default alt-default (start-point (point)) str i bol eol) |
325 | 853 (save-excursion |
5555
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
854 ;; Store end and beginning of line. |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
855 (end-of-line) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
856 (setq eol (point)) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
857 (beginning-of-line) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
858 (setq bol (point)) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
859 |
325 | 860 (goto-char (point-min)) |
861 (while (re-search-forward "\\*note[ \n\t]*\\([^:]*\\):" nil t) | |
862 (setq str (buffer-substring | |
863 (match-beginning 1) | |
864 (1- (point)))) | |
865 ;; See if this one should be the default. | |
866 (and (null default) | |
5146
aa2236a14893
(Info-follow-reference): Correct one-off error in comparing start-point.
Richard M. Stallman <rms@gnu.org>
parents:
5091
diff
changeset
|
867 (<= (match-beginning 0) start-point) |
325 | 868 (<= start-point (point)) |
869 (setq default t)) | |
5555
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
870 ;; See if this one should be the alternate default. |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
871 (and (null alt-default) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
872 (and (<= bol (match-beginning 0)) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
873 (<= (point) eol)) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
874 (setq alt-default t)) |
325 | 875 (setq i 0) |
876 (while (setq i (string-match "[ \n\t]+" str i)) | |
877 (setq str (concat (substring str 0 i) " " | |
878 (substring str (match-end 0)))) | |
879 (setq i (1+ i))) | |
880 ;; Record as a completion and perhaps as default. | |
881 (if (eq default t) (setq default str)) | |
5555
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
882 (if (eq alt-default t) (setq alt-default str)) |
325 | 883 (setq completions |
884 (cons (cons str nil) | |
885 completions)))) | |
5555
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
886 ;; If no good default was found, try an alternate. |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
887 (or default |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
888 (setq default alt-default)) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
889 ;; If only one cross-reference found, then make it default. |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
890 (if (eq (length completions) 1) |
38f8bfd91cca
(Info-follow-reference): If point is not in middle of a
Richard M. Stallman <rms@gnu.org>
parents:
5482
diff
changeset
|
891 (setq default (car (car completions)))) |
325 | 892 (if completions |
3565
bd87ecca04f6
(Info-follow-reference): Fix completion defaulting.
Richard M. Stallman <rms@gnu.org>
parents:
3451
diff
changeset
|
893 (let ((input (completing-read (if default |
bd87ecca04f6
(Info-follow-reference): Fix completion defaulting.
Richard M. Stallman <rms@gnu.org>
parents:
3451
diff
changeset
|
894 (concat "Follow reference named: (" |
bd87ecca04f6
(Info-follow-reference): Fix completion defaulting.
Richard M. Stallman <rms@gnu.org>
parents:
3451
diff
changeset
|
895 default ") ") |
bd87ecca04f6
(Info-follow-reference): Fix completion defaulting.
Richard M. Stallman <rms@gnu.org>
parents:
3451
diff
changeset
|
896 "Follow reference named: ") |
bd87ecca04f6
(Info-follow-reference): Fix completion defaulting.
Richard M. Stallman <rms@gnu.org>
parents:
3451
diff
changeset
|
897 completions nil t))) |
bd87ecca04f6
(Info-follow-reference): Fix completion defaulting.
Richard M. Stallman <rms@gnu.org>
parents:
3451
diff
changeset
|
898 (list (if (equal input "") |
bd87ecca04f6
(Info-follow-reference): Fix completion defaulting.
Richard M. Stallman <rms@gnu.org>
parents:
3451
diff
changeset
|
899 default input))) |
325 | 900 (error "No cross-references in this node")))) |
10061
41a9afd33e98
(Info-follow-reference): Use regexp-quote.
Richard M. Stallman <rms@gnu.org>
parents:
9852
diff
changeset
|
901 (let (target beg i (str (concat "\\*note " (regexp-quote footnotename)))) |
325 | 902 (while (setq i (string-match " " str i)) |
903 (setq str (concat (substring str 0 i) "[ \t\n]+" (substring str (1+ i)))) | |
904 (setq i (+ i 6))) | |
905 (save-excursion | |
906 (goto-char (point-min)) | |
907 (or (re-search-forward str nil t) | |
908 (error "No cross-reference named %s" footnotename)) | |
909 (goto-char (+ (match-beginning 0) 5)) | |
910 (setq target | |
911 (Info-extract-menu-node-name "Bad format cross reference" t))) | |
912 (while (setq i (string-match "[ \t\n]+" target i)) | |
913 (setq target (concat (substring target 0 i) " " | |
914 (substring target (match-end 0)))) | |
915 (setq i (+ i 1))) | |
916 (Info-goto-node target))) | |
917 | |
918 (defun Info-extract-menu-node-name (&optional errmessage multi-line) | |
919 (skip-chars-forward " \t\n") | |
920 (let ((beg (point)) | |
921 str i) | |
922 (skip-chars-forward "^:") | |
923 (forward-char 1) | |
924 (setq str | |
925 (if (looking-at ":") | |
13287
f25084d29719
(Info-following-node-name, Info-extract-menu-node-name)
Richard M. Stallman <rms@gnu.org>
parents:
13085
diff
changeset
|
926 (buffer-substring-no-properties beg (1- (point))) |
325 | 927 (skip-chars-forward " \t\n") |
928 (Info-following-node-name (if multi-line "^.,\t" "^.,\t\n")))) | |
929 (while (setq i (string-match "\n" str i)) | |
930 (aset str i ?\ )) | |
10918
a78b47b38c46
(Info-extract-menu-node-name): Collapse multiple spaces.
Richard M. Stallman <rms@gnu.org>
parents:
10758
diff
changeset
|
931 ;; Collapse multiple spaces. |
a78b47b38c46
(Info-extract-menu-node-name): Collapse multiple spaces.
Richard M. Stallman <rms@gnu.org>
parents:
10758
diff
changeset
|
932 (while (string-match " +" str) |
a78b47b38c46
(Info-extract-menu-node-name): Collapse multiple spaces.
Richard M. Stallman <rms@gnu.org>
parents:
10758
diff
changeset
|
933 (setq str (replace-match " " t t str))) |
325 | 934 str)) |
935 | |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
936 ;; No one calls this. |
1484
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
937 ;;(defun Info-menu-item-sequence (list) |
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
938 ;; (while list |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
939 ;; (Info-menu (car list)) |
1484
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
940 ;; (setq list (cdr list)))) |
325 | 941 |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
942 (defun Info-complete-menu-item (string predicate action) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
943 (let ((case-fold-search t)) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
944 (cond ((eq action nil) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
945 (let (completions |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
946 (pattern (concat "\n\\* \\(" |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
947 (regexp-quote string) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
948 "[^:\t\n]*\\):"))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
949 (save-excursion |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
950 (set-buffer Info-complete-menu-buffer) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
951 (goto-char (point-min)) |
13566
1121cd08e87f
(Info-complete-menu-item): Don't treat `* Menu:' as a menu item.
Richard M. Stallman <rms@gnu.org>
parents:
13562
diff
changeset
|
952 (search-forward "\n* Menu:") |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
953 (while (re-search-forward pattern nil t) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
954 (setq completions (cons (cons (format "%s" |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
955 (buffer-substring |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
956 (match-beginning 1) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
957 (match-end 1))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
958 (match-beginning 1)) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
959 completions)))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
960 (try-completion string completions predicate))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
961 ((eq action t) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
962 (let (completions |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
963 (pattern (concat "\n\\* \\(" |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
964 (regexp-quote string) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
965 "[^:\t\n]*\\):"))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
966 (save-excursion |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
967 (set-buffer Info-complete-menu-buffer) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
968 (goto-char (point-min)) |
13566
1121cd08e87f
(Info-complete-menu-item): Don't treat `* Menu:' as a menu item.
Richard M. Stallman <rms@gnu.org>
parents:
13562
diff
changeset
|
969 (search-forward "\n* Menu:") |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
970 (while (re-search-forward pattern nil t) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
971 (setq completions (cons (cons (format "%s" |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
972 (buffer-substring |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
973 (match-beginning 1) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
974 (match-end 1))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
975 (match-beginning 1)) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
976 completions)))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
977 (all-completions string completions predicate))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
978 (t |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
979 (save-excursion |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
980 (set-buffer Info-complete-menu-buffer) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
981 (goto-char (point-min)) |
13566
1121cd08e87f
(Info-complete-menu-item): Don't treat `* Menu:' as a menu item.
Richard M. Stallman <rms@gnu.org>
parents:
13562
diff
changeset
|
982 (search-forward "\n* Menu:") |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
983 (re-search-forward (concat "\n\\* " |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
984 (regexp-quote string) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
985 ":") |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
986 nil t)))))) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
987 |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
988 |
325 | 989 (defun Info-menu (menu-item) |
990 "Go to node for menu item named (or abbreviated) NAME. | |
991 Completion is allowed, and the menu item point is on is the default." | |
992 (interactive | |
993 (let ((completions '()) | |
994 ;; If point is within a menu item, use that item as the default | |
995 (default nil) | |
996 (p (point)) | |
10957
6d3568e33019
(Info-menu): Bind beg with let.
Richard M. Stallman <rms@gnu.org>
parents:
10918
diff
changeset
|
997 beg |
325 | 998 (last nil)) |
999 (save-excursion | |
1000 (goto-char (point-min)) | |
1001 (if (not (search-forward "\n* menu:" nil t)) | |
1002 (error "No menu in this node")) | |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1003 (setq beg (point)) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1004 (and (< (point) p) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1005 (save-excursion |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1006 (goto-char p) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1007 (end-of-line) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1008 (re-search-backward "\n\\* \\([^:\t\n]*\\):" beg t) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1009 (setq default (format "%s" (buffer-substring |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1010 (match-beginning 1) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1011 (match-end 1))))))) |
325 | 1012 (let ((item nil)) |
1013 (while (null item) | |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1014 (setq item (let ((completion-ignore-case t) |
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1015 (Info-complete-menu-buffer (current-buffer))) |
325 | 1016 (completing-read (if default |
1017 (format "Menu item (default %s): " | |
1018 default) | |
1019 "Menu item: ") | |
7837
bad6366d4f16
(Info-complete-menu-item): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7789
diff
changeset
|
1020 'Info-complete-menu-item nil t))) |
540 | 1021 ;; we rely on the fact that completing-read accepts an input |
1022 ;; of "" even when the require-match argument is true and "" | |
1023 ;; is not a valid possibility | |
325 | 1024 (if (string= item "") |
1025 (if default | |
1026 (setq item default) | |
1027 ;; ask again | |
1028 (setq item nil)))) | |
1029 (list item)))) | |
1030 ;; there is a problem here in that if several menu items have the same | |
1031 ;; name you can only go to the node of the first with this command. | |
1032 (Info-goto-node (Info-extract-menu-item menu-item))) | |
1033 | |
1034 (defun Info-extract-menu-item (menu-item) | |
1035 (setq menu-item (regexp-quote menu-item)) | |
1036 (save-excursion | |
1037 (goto-char (point-min)) | |
1038 (or (search-forward "\n* menu:" nil t) | |
1039 (error "No menu in this node")) | |
4967
67810bbdfc9d
(Info-extract-menu-item): Quote `*' in the menu-item
Richard M. Stallman <rms@gnu.org>
parents:
4468
diff
changeset
|
1040 (or (re-search-forward (concat "\n\\* " menu-item ":") nil t) |
67810bbdfc9d
(Info-extract-menu-item): Quote `*' in the menu-item
Richard M. Stallman <rms@gnu.org>
parents:
4468
diff
changeset
|
1041 (re-search-forward (concat "\n\\* " menu-item) nil t) |
325 | 1042 (error "No such item in menu")) |
1043 (beginning-of-line) | |
1044 (forward-char 2) | |
1045 (Info-extract-menu-node-name))) | |
1046 | |
1047 ;; If COUNT is nil, use the last item in the menu. | |
1048 (defun Info-extract-menu-counting (count) | |
1049 (save-excursion | |
1050 (goto-char (point-min)) | |
1051 (or (search-forward "\n* menu:" nil t) | |
1052 (error "No menu in this node")) | |
1053 (if count | |
1054 (or (search-forward "\n* " nil t count) | |
1055 (error "Too few items in menu")) | |
1056 (while (search-forward "\n* " nil t) | |
1057 nil)) | |
1058 (Info-extract-menu-node-name))) | |
1059 | |
1666
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1060 (defun Info-nth-menu-item () |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1061 "Go to the node of the Nth menu item. |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1062 N is the digit argument used to invoke this command." |
325 | 1063 (interactive) |
1666
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1064 (Info-goto-node |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1065 (Info-extract-menu-counting |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1066 (- (aref (this-command-keys) (1- (length (this-command-keys)))) ?0)))) |
325 | 1067 |
1068 (defun Info-top-node () | |
1069 "Go to the Top node of this file." | |
1070 (interactive) | |
1071 (Info-goto-node "Top")) | |
1072 | |
1073 (defun Info-final-node () | |
1074 "Go to the final node in this file." | |
1075 (interactive) | |
1076 (Info-goto-node "Top") | |
1077 (let (Info-history) | |
1078 ;; Go to the last node in the menu of Top. | |
1079 (Info-goto-node (Info-extract-menu-counting nil)) | |
1080 ;; If the last node in the menu is not last in pointer structure, | |
1081 ;; move forward until we can't go any farther. | |
1082 (while (Info-forward-node t t) nil) | |
1083 ;; Then keep moving down to last subnode, unless we reach an index. | |
1084 (while (and (not (string-match "\\<index\\>" Info-current-node)) | |
1085 (save-excursion (search-forward "\n* Menu:" nil t))) | |
1086 (Info-goto-node (Info-extract-menu-counting nil))))) | |
1087 | |
1088 (defun Info-forward-node (&optional not-down no-error) | |
1089 "Go forward one node, considering all nodes as forming one sequence." | |
1090 (interactive) | |
1091 (goto-char (point-min)) | |
1092 (forward-line 1) | |
1093 ;; three possibilities, in order of priority: | |
1094 ;; 1. next node is in a menu in this node (but not in an index) | |
1095 ;; 2. next node is next at same level | |
1096 ;; 3. next node is up and next | |
1097 (cond ((and (not not-down) | |
1098 (save-excursion (search-forward "\n* menu:" nil t)) | |
1099 (not (string-match "\\<index\\>" Info-current-node))) | |
2036
a71101e5abff
(Info-forward-node): Properly go to first menu item.
Richard M. Stallman <rms@gnu.org>
parents:
2032
diff
changeset
|
1100 (Info-goto-node (Info-extract-menu-counting 1)) |
325 | 1101 t) |
1102 ((save-excursion (search-backward "next:" nil t)) | |
1103 (Info-next) | |
1104 t) | |
1105 ((and (save-excursion (search-backward "up:" nil t)) | |
11527
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
1106 ;; Use string-equal, not equal, to ignore text props. |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
1107 (not (string-equal (downcase (Info-extract-pointer "up")) |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
1108 "top"))) |
325 | 1109 (let ((old-node Info-current-node)) |
1110 (Info-up) | |
1111 (let (Info-history success) | |
1112 (unwind-protect | |
1113 (setq success (Info-forward-node t no-error)) | |
1114 (or success (Info-goto-node old-node)))))) | |
1115 (no-error nil) | |
1116 (t (error "No pointer forward from this node")))) | |
1117 | |
1118 (defun Info-backward-node () | |
1119 "Go backward one node, considering all nodes as forming one sequence." | |
1120 (interactive) | |
1121 (let ((prevnode (Info-extract-pointer "prev[ious]*" t)) | |
1122 (upnode (Info-extract-pointer "up" t))) | |
1123 (cond ((and upnode (string-match "(" upnode)) | |
1124 (error "First node in file")) | |
1125 ((and upnode (or (null prevnode) | |
11527
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
1126 ;; Use string-equal, not equal, |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
1127 ;; to ignore text properties. |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
1128 (string-equal (downcase prevnode) |
7956811d4d9a
(info-insert-file-contents): Set default-directory
Richard M. Stallman <rms@gnu.org>
parents:
11064
diff
changeset
|
1129 (downcase upnode)))) |
325 | 1130 (Info-up)) |
1131 (prevnode | |
1132 ;; If we move back at the same level, | |
1133 ;; go down to find the last subnode*. | |
1134 (Info-prev) | |
1135 (let (Info-history) | |
1136 (while (and (not (string-match "\\<index\\>" Info-current-node)) | |
1137 (save-excursion (search-forward "\n* Menu:" nil t))) | |
1138 (Info-goto-node (Info-extract-menu-counting nil))))) | |
1139 (t | |
1140 (error "No pointer backward from this node"))))) | |
1141 | |
1142 (defun Info-exit () | |
1143 "Exit Info by selecting some other buffer." | |
1144 (interactive) | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1145 (if Info-standalone |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1146 (save-buffers-kill-emacs) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1147 (switch-to-buffer (prog1 (other-buffer (current-buffer)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1148 (bury-buffer (current-buffer)))))) |
325 | 1149 |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1150 (defun Info-next-menu-item () |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1151 (interactive) |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1152 (save-excursion |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1153 (forward-line -1) |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1154 (search-forward "\n* menu:" nil t) |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1155 (or (search-forward "\n* " nil t) |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1156 (error "No more items in menu")) |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1157 (Info-goto-node (Info-extract-menu-node-name)))) |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1158 |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1159 (defun Info-last-menu-item () |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1160 (interactive) |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1161 (save-excursion |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1162 (forward-line 1) |
8489
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1163 (let ((beg (save-excursion |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1164 (and (search-backward "\n* menu:" nil t) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1165 (point))))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1166 (or (and beg (search-backward "\n* " beg t)) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1167 (error "No previous items in menu"))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1168 (Info-goto-node (save-excursion |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1169 (goto-char (match-end 0)) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1170 (Info-extract-menu-node-name))))) |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1171 |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1172 (defmacro Info-no-error (&rest body) |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1173 (list 'condition-case nil (cons 'progn (append body '(t))) '(error nil))) |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1174 |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1175 (defun Info-next-preorder () |
8018
518971c497f5
(Info-next-preorder-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7990
diff
changeset
|
1176 "Go to the next subnode or the next node, or go up a level." |
518971c497f5
(Info-next-preorder-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7990
diff
changeset
|
1177 (interactive) |
518971c497f5
(Info-next-preorder-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7990
diff
changeset
|
1178 (cond ((Info-no-error (Info-next-menu-item))) |
518971c497f5
(Info-next-preorder-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7990
diff
changeset
|
1179 ((Info-no-error (Info-next))) |
518971c497f5
(Info-next-preorder-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7990
diff
changeset
|
1180 ((Info-no-error (Info-up)) |
12156 | 1181 ;; Since we have already gone thru all the items in this menu, |
1182 ;; go up to the end of this node. | |
1183 (goto-char (point-max))) | |
8018
518971c497f5
(Info-next-preorder-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7990
diff
changeset
|
1184 (t |
518971c497f5
(Info-next-preorder-1): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7990
diff
changeset
|
1185 (error "No more nodes")))) |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1186 |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1187 (defun Info-last-preorder () |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1188 "Go to the last node, popping up a level if there is none." |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1189 (interactive) |
8489
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1190 (cond ((Info-no-error |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1191 (Info-last-menu-item) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1192 ;; If we go down a menu item, go to the end of the node |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1193 ;; so we can scroll back through it. |
12156 | 1194 (goto-char (point-max))) |
1195 (recenter -1)) | |
1196 ((Info-no-error (Info-prev)) | |
1197 (goto-char (point-max)) | |
1198 (recenter -1)) | |
1199 ((Info-no-error (Info-up)) | |
1200 (goto-char (point-min)) | |
1201 (or (search-forward "\n* Menu:" nil t) | |
1202 (goto-char (point-max)))) | |
1203 (t (error "No previous nodes")))) | |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1204 |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1205 (defun Info-scroll-up () |
9222
b18f51df31b3
(Info-scroll-down, Info-scroll-up): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
8913
diff
changeset
|
1206 "Scroll one screenful forward in Info, considering all nodes as one sequence. |
b18f51df31b3
(Info-scroll-down, Info-scroll-up): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
8913
diff
changeset
|
1207 Once you scroll far enough in a node that its menu appears on the screen, |
b18f51df31b3
(Info-scroll-down, Info-scroll-up): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
8913
diff
changeset
|
1208 the next scroll moves into its first subnode. When you scroll past |
12156 | 1209 the end of a node, that goes to the next node or back up to the parent node." |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1210 (interactive) |
8489
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1211 (if (or (< (window-start) (point-min)) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1212 (> (window-start) (point-max))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1213 (set-window-start (selected-window) (point))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1214 (let ((virtual-end (save-excursion |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1215 (goto-char (point-min)) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1216 (if (search-forward "\n* Menu:" nil t) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1217 (point) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1218 (point-max))))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1219 (if (or (< virtual-end (window-start)) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1220 (pos-visible-in-window-p virtual-end)) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1221 (Info-next-preorder) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1222 (scroll-up)))) |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1223 |
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1224 (defun Info-scroll-down () |
9222
b18f51df31b3
(Info-scroll-down, Info-scroll-up): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
8913
diff
changeset
|
1225 "Scroll one screenful back in Info, considering all nodes as one sequence. |
12156 | 1226 Within the menu of a node, this goes to its last subnode. |
1227 When you scroll past the beginning of a node, that goes to the | |
1228 previous node or back up to the parent node." | |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1229 (interactive) |
8489
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1230 (if (or (< (window-start) (point-min)) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1231 (> (window-start) (point-max))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1232 (set-window-start (selected-window) (point))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1233 (let ((virtual-end (save-excursion |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1234 (goto-char (point-min)) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1235 (search-forward "\n* Menu:" nil t)))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1236 (if (or virtual-end (pos-visible-in-window-p (point-min))) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1237 (Info-last-preorder) |
c6088e3005cf
(Info-last-menu-item): Fix gross logic errors.
Richard M. Stallman <rms@gnu.org>
parents:
8480
diff
changeset
|
1238 (scroll-down)))) |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1239 |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1240 (defun Info-next-reference () |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1241 "Move cursor to the next cross-reference or menu item in the node." |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1242 (interactive) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1243 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1244 (old-pt (point))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1245 (or (eobp) (forward-char 1)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1246 (or (re-search-forward pat nil t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1247 (progn |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1248 (goto-char (point-min)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1249 (or (re-search-forward pat nil t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1250 (progn |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1251 (goto-char old-pt) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1252 (error "No cross references in this node"))))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1253 (goto-char (match-beginning 0)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1254 (if (looking-at "\\* Menu:") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1255 (Info-next-reference)))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1256 |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1257 (defun Info-prev-reference () |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1258 "Move cursor to the previous cross-reference or menu item in the node." |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1259 (interactive) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1260 (let ((pat "\\*note[ \n\t]*\\([^:]*\\):\\|^\\* .*:") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1261 (old-pt (point))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1262 (or (re-search-backward pat nil t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1263 (progn |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1264 (goto-char (point-max)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1265 (or (re-search-backward pat nil t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1266 (progn |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1267 (goto-char old-pt) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1268 (error "No cross references in this node"))))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1269 (goto-char (match-beginning 0)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1270 (if (looking-at "\\* Menu:") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1271 (Info-prev-reference)))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1272 |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1273 (defun Info-index (topic) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1274 "Look up a string in the index for this file. |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1275 The index is defined as the first node in the top-level menu whose |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1276 name contains the word \"Index\", plus any immediately following |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1277 nodes whose names also contain the word \"Index\". |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1278 If there are no exact matches to the specified topic, this chooses |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1279 the first match which is a case-insensitive substring of a topic. |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1280 Use the `,' command to see the other matches. |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1281 Give a blank topic name to go to the Index node itself." |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1282 (interactive "sIndex topic: ") |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1283 (let ((orignode Info-current-node) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1284 (rnode nil) |
8071
184f2c23ff45
(Info-index): Fix typo: t => \t.
Richard M. Stallman <rms@gnu.org>
parents:
8069
diff
changeset
|
1285 (pattern (format "\n\\* \\([^\n:]*%s[^\n:]*\\):[ \t]*\\([^.\n]*\\)\\.[ \t]*\\([0-9]*\\)" |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1286 (regexp-quote topic))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1287 node) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1288 (Info-goto-node "Top") |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1289 (or (search-forward "\n* menu:" nil t) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1290 (error "No index")) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1291 (or (re-search-forward "\n\\* \\(.*\\<Index\\>\\)" nil t) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1292 (error "No index")) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1293 (goto-char (match-beginning 1)) |
10758
a66a29e6efc9
(Info-index): Bind Info-history, not Info-keep-history.
Richard M. Stallman <rms@gnu.org>
parents:
10061
diff
changeset
|
1294 ;; Here, and subsequently in this function, |
a66a29e6efc9
(Info-index): Bind Info-history, not Info-keep-history.
Richard M. Stallman <rms@gnu.org>
parents:
10061
diff
changeset
|
1295 ;; we bind Info-history to nil for internal node-switches |
a66a29e6efc9
(Info-index): Bind Info-history, not Info-keep-history.
Richard M. Stallman <rms@gnu.org>
parents:
10061
diff
changeset
|
1296 ;; so that we don't put junk in the history. |
a66a29e6efc9
(Info-index): Bind Info-history, not Info-keep-history.
Richard M. Stallman <rms@gnu.org>
parents:
10061
diff
changeset
|
1297 ;; In the first Info-goto-node call, above, we do update the history |
a66a29e6efc9
(Info-index): Bind Info-history, not Info-keep-history.
Richard M. Stallman <rms@gnu.org>
parents:
10061
diff
changeset
|
1298 ;; because that is what the user's previous node choice into it. |
a66a29e6efc9
(Info-index): Bind Info-history, not Info-keep-history.
Richard M. Stallman <rms@gnu.org>
parents:
10061
diff
changeset
|
1299 (let ((Info-history nil)) |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1300 (Info-goto-node (Info-extract-menu-node-name))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1301 (or (equal topic "") |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1302 (let ((matches nil) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1303 (exact nil) |
10758
a66a29e6efc9
(Info-index): Bind Info-history, not Info-keep-history.
Richard M. Stallman <rms@gnu.org>
parents:
10061
diff
changeset
|
1304 (Info-history nil) |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1305 found) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1306 (while |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1307 (progn |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1308 (goto-char (point-min)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1309 (while (re-search-forward pattern nil t) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1310 (setq matches |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1311 (cons (list (buffer-substring (match-beginning 1) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1312 (match-end 1)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1313 (buffer-substring (match-beginning 2) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1314 (match-end 2)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1315 Info-current-node |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1316 (string-to-int (concat "0" |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1317 (buffer-substring |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1318 (match-beginning 3) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1319 (match-end 3))))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1320 matches))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1321 (and (setq node (Info-extract-pointer "next" t)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1322 (string-match "\\<Index\\>" node))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1323 (Info-goto-node node)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1324 (or matches |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1325 (progn |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1326 (Info-last) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1327 (error "No \"%s\" in index" topic))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1328 ;; Here it is a feature that assoc is case-sensitive. |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1329 (while (setq found (assoc topic matches)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1330 (setq exact (cons found exact) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1331 matches (delq found matches))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1332 (setq Info-index-alternatives (nconc exact (nreverse matches))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1333 (Info-index-next 0))))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1334 |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1335 (defun Info-index-next (num) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1336 "Go to the next matching index item from the last `i' command." |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1337 (interactive "p") |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1338 (or Info-index-alternatives |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1339 (error "No previous `i' command in this file")) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1340 (while (< num 0) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1341 (setq num (+ num (length Info-index-alternatives)))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1342 (while (> num 0) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1343 (setq Info-index-alternatives |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1344 (nconc (cdr Info-index-alternatives) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1345 (list (car Info-index-alternatives))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1346 num (1- num))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1347 (Info-goto-node (nth 1 (car Info-index-alternatives))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1348 (if (> (nth 3 (car Info-index-alternatives)) 0) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1349 (forward-line (nth 3 (car Info-index-alternatives))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1350 (forward-line 3) ; don't search in headers |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1351 (let ((name (car (car Info-index-alternatives)))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1352 (if (or (re-search-forward (format |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1353 "\\(Function\\|Command\\): %s\\( \\|$\\)" |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1354 (regexp-quote name)) nil t) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1355 (search-forward (format "`%s'" name) nil t) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1356 (and (string-match "\\`.*\\( (.*)\\)\\'" name) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1357 (search-forward |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1358 (format "`%s'" (substring name 0 (match-beginning 1))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1359 nil t)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1360 (search-forward name nil t)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1361 (beginning-of-line) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1362 (goto-char (point-min))))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1363 (message "Found \"%s\" in %s. %s" |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1364 (car (car Info-index-alternatives)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1365 (nth 2 (car Info-index-alternatives)) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1366 (if (cdr Info-index-alternatives) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1367 "(Press `,' for more)" |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1368 "(Only match)"))) |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1369 |
325 | 1370 (defun Info-undefined () |
1371 "Make command be undefined in Info." | |
1372 (interactive) | |
1373 (ding)) | |
1374 | |
1375 (defun Info-help () | |
1376 "Enter the Info tutorial." | |
1377 (interactive) | |
1378 (delete-other-windows) | |
1379 (Info-find-node "info" | |
1380 (if (< (window-height) 23) | |
1381 "Help-Small-Screen" | |
1382 "Help"))) | |
1383 | |
1384 (defun Info-summary () | |
1385 "Display a brief summary of all Info commands." | |
1386 (interactive) | |
1387 (save-window-excursion | |
1388 (switch-to-buffer "*Help*") | |
1389 (erase-buffer) | |
1390 (insert (documentation 'Info-mode)) | |
9852
b3a6fdcd63df
(Info-summary): Set help-mode in *Help* buffer.
Karl Heuer <kwzh@gnu.org>
parents:
9782
diff
changeset
|
1391 (help-mode) |
325 | 1392 (goto-char (point-min)) |
1393 (let (ch flag) | |
1394 (while (progn (setq flag (not (pos-visible-in-window-p (point-max)))) | |
1395 (message (if flag "Type Space to see more" | |
1396 "Type Space to return to Info")) | |
2032
20cc6c34421c
(Info-summary): Handle any event when flushing the display.
Richard M. Stallman <rms@gnu.org>
parents:
1979
diff
changeset
|
1397 (if (not (eq ?\ (setq ch (read-event)))) |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1667
diff
changeset
|
1398 (progn (setq unread-command-events (list ch)) nil) |
325 | 1399 flag)) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1400 (scroll-up))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1401 (bury-buffer "*Help*"))) |
325 | 1402 |
1403 (defun Info-get-token (pos start all &optional errorstring) | |
1404 "Return the token around POS, | |
1405 POS must be somewhere inside the token | |
1406 START is a regular expression which will match the | |
1407 beginning of the tokens delimited string | |
1408 ALL is a regular expression with a single | |
13990 | 1409 parenthesized subpattern which is the token to be |
325 | 1410 returned. E.g. '{\(.*\)}' would return any string |
1411 enclosed in braces around POS. | |
1412 SIG optional fourth argument, controls action on no match | |
1413 nil: return nil | |
1414 t: beep | |
1415 a string: signal an error, using that string." | |
1416 (save-excursion | |
1417 (goto-char pos) | |
1418 (re-search-backward start (max (point-min) (- pos 200)) 'yes) | |
3351
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1419 (let (found) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1420 (while (and (re-search-forward all (min (point-max) (+ pos 200)) 'yes) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1421 (not (setq found (and (<= (match-beginning 0) pos) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1422 (> (match-end 0) pos)))))) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1423 (if (and found (<= (match-beginning 0) pos) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1424 (> (match-end 0) pos)) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1425 (buffer-substring (match-beginning 1) (match-end 1)) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1426 (cond ((null errorstring) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1427 nil) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1428 ((eq errorstring t) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1429 (beep) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1430 nil) |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1431 (t |
1795290d0fc8
(Info-get-token): Check that thesecond search succeeded.
Richard M. Stallman <rms@gnu.org>
parents:
3330
diff
changeset
|
1432 (error "No %s around position %d" errorstring pos))))))) |
325 | 1433 |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1434 (defun Info-mouse-follow-nearest-node (click) |
1309
aa286e6e7bec
(Info-follow-nearest-node): Handle line breaks after *note.
Richard M. Stallman <rms@gnu.org>
parents:
998
diff
changeset
|
1435 "\\<Info-mode-map>Follow a node reference near point. |
aa286e6e7bec
(Info-follow-nearest-node): Handle line breaks after *note.
Richard M. Stallman <rms@gnu.org>
parents:
998
diff
changeset
|
1436 Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where you click. |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1437 At end of the node's text, moves to the next node, or up if none." |
1309
aa286e6e7bec
(Info-follow-nearest-node): Handle line breaks after *note.
Richard M. Stallman <rms@gnu.org>
parents:
998
diff
changeset
|
1438 (interactive "e") |
1484
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
1439 (let* ((start (event-start click)) |
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
1440 (window (car start)) |
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
1441 (pos (car (cdr start)))) |
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
1442 (select-window window) |
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
1443 (goto-char pos)) |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1444 (and (not (Info-try-follow-nearest-node)) |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1445 (save-excursion (forward-line 1) (eobp)) |
12156 | 1446 (Info-next-preorder))) |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1447 |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1448 (defun Info-follow-nearest-node () |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1449 "\\<Info-mode-map>Follow a node reference near point. |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1450 Like \\[Info-menu], \\[Info-follow-reference], \\[Info-next], \\[Info-prev] or \\[Info-up] command, depending on where point is. |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1451 If no reference to follow, moves to the next node, or up if none." |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1452 (interactive) |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1453 (or (Info-try-follow-nearest-node) |
12156 | 1454 (Info-next-preorder))) |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1455 |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1456 ;; Common subroutine. |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1457 (defun Info-try-follow-nearest-node () |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1458 "Follow a node reference near point. Return non-nil if successful." |
325 | 1459 (let (node) |
1460 (cond | |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1461 ((setq node (Info-get-token (point) "\\*note[ \n]" |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1462 "\\*note[ \n]\\([^:]*\\):")) |
325 | 1463 (Info-follow-reference node)) |
3127
dfbada800489
(Info-follow-nearest-node): Omit 4th arg to Info-get-token.
Richard M. Stallman <rms@gnu.org>
parents:
3084
diff
changeset
|
1464 ((setq node (Info-get-token (point) "\\* " "\\* \\([^:]*\\)::")) |
325 | 1465 (Info-goto-node node)) |
3127
dfbada800489
(Info-follow-nearest-node): Omit 4th arg to Info-get-token.
Richard M. Stallman <rms@gnu.org>
parents:
3084
diff
changeset
|
1466 ((setq node (Info-get-token (point) "\\* " "\\* \\([^:]*\\):")) |
325 | 1467 (Info-menu node)) |
3127
dfbada800489
(Info-follow-nearest-node): Omit 4th arg to Info-get-token.
Richard M. Stallman <rms@gnu.org>
parents:
3084
diff
changeset
|
1468 ((setq node (Info-get-token (point) "Up: " "Up: \\([^,\n\t]*\\)")) |
325 | 1469 (Info-goto-node node)) |
3127
dfbada800489
(Info-follow-nearest-node): Omit 4th arg to Info-get-token.
Richard M. Stallman <rms@gnu.org>
parents:
3084
diff
changeset
|
1470 ((setq node (Info-get-token (point) "Next: " "Next: \\([^,\n\t]*\\)")) |
325 | 1471 (Info-goto-node node)) |
3127
dfbada800489
(Info-follow-nearest-node): Omit 4th arg to Info-get-token.
Richard M. Stallman <rms@gnu.org>
parents:
3084
diff
changeset
|
1472 ((setq node (Info-get-token (point) "File: " "File: \\([^,\n\t]*\\)")) |
325 | 1473 (Info-goto-node "Top")) |
3127
dfbada800489
(Info-follow-nearest-node): Omit 4th arg to Info-get-token.
Richard M. Stallman <rms@gnu.org>
parents:
3084
diff
changeset
|
1474 ((setq node (Info-get-token (point) "Prev: " "Prev: \\([^,\n\t]*\\)")) |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1475 (Info-goto-node node))) |
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1476 node)) |
325 | 1477 |
1478 (defvar Info-mode-map nil | |
1479 "Keymap containing Info commands.") | |
1480 (if Info-mode-map | |
1481 nil | |
1482 (setq Info-mode-map (make-keymap)) | |
1483 (suppress-keymap Info-mode-map) | |
1484 (define-key Info-mode-map "." 'beginning-of-buffer) | |
929
27262a6c632a
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
846
diff
changeset
|
1485 (define-key Info-mode-map " " 'Info-scroll-up) |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1486 (define-key Info-mode-map "\C-m" 'Info-follow-nearest-node) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1487 (define-key Info-mode-map "\t" 'Info-next-reference) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1488 (define-key Info-mode-map "\e\t" 'Info-prev-reference) |
1666
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1489 (define-key Info-mode-map "1" 'Info-nth-menu-item) |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1490 (define-key Info-mode-map "2" 'Info-nth-menu-item) |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1491 (define-key Info-mode-map "3" 'Info-nth-menu-item) |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1492 (define-key Info-mode-map "4" 'Info-nth-menu-item) |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1493 (define-key Info-mode-map "5" 'Info-nth-menu-item) |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1494 (define-key Info-mode-map "6" 'Info-nth-menu-item) |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1495 (define-key Info-mode-map "7" 'Info-nth-menu-item) |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1496 (define-key Info-mode-map "8" 'Info-nth-menu-item) |
c12fbca81b63
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1613
diff
changeset
|
1497 (define-key Info-mode-map "9" 'Info-nth-menu-item) |
1667
9c0e14881b8f
(Info-{first,second,third,fourth,fifth}-menu-item): Removed.
Roland McGrath <roland@gnu.org>
parents:
1666
diff
changeset
|
1498 (define-key Info-mode-map "0" 'undefined) |
325 | 1499 (define-key Info-mode-map "?" 'Info-summary) |
1500 (define-key Info-mode-map "]" 'Info-forward-node) | |
1501 (define-key Info-mode-map "[" 'Info-backward-node) | |
1502 (define-key Info-mode-map "<" 'Info-top-node) | |
1503 (define-key Info-mode-map ">" 'Info-final-node) | |
1504 (define-key Info-mode-map "b" 'beginning-of-buffer) | |
1505 (define-key Info-mode-map "d" 'Info-directory) | |
1506 (define-key Info-mode-map "e" 'Info-edit) | |
1507 (define-key Info-mode-map "f" 'Info-follow-reference) | |
1508 (define-key Info-mode-map "g" 'Info-goto-node) | |
1509 (define-key Info-mode-map "h" 'Info-help) | |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1510 (define-key Info-mode-map "i" 'Info-index) |
325 | 1511 (define-key Info-mode-map "l" 'Info-last) |
1512 (define-key Info-mode-map "m" 'Info-menu) | |
1513 (define-key Info-mode-map "n" 'Info-next) | |
1514 (define-key Info-mode-map "p" 'Info-prev) | |
1515 (define-key Info-mode-map "q" 'Info-exit) | |
1516 (define-key Info-mode-map "s" 'Info-search) | |
8739
f89682e90658
(Info-mode-map): Bind M-s like s.
Richard M. Stallman <rms@gnu.org>
parents:
8692
diff
changeset
|
1517 ;; For consistency with Rmail. |
f89682e90658
(Info-mode-map): Bind M-s like s.
Richard M. Stallman <rms@gnu.org>
parents:
8692
diff
changeset
|
1518 (define-key Info-mode-map "\M-s" 'Info-search) |
3313
34f2db3916fe
(Info-mode-map): Correct Info-top to Info-top-node.
Richard M. Stallman <rms@gnu.org>
parents:
3225
diff
changeset
|
1519 (define-key Info-mode-map "t" 'Info-top-node) |
325 | 1520 (define-key Info-mode-map "u" 'Info-up) |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1521 (define-key Info-mode-map "," 'Info-index-next) |
930
1dac458b5117
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
929
diff
changeset
|
1522 (define-key Info-mode-map "\177" 'Info-scroll-down) |
7007
52b0ebfd3191
(Info-next-preorder): Don't follow footnotes here.
Karl Heuer <kwzh@gnu.org>
parents:
6716
diff
changeset
|
1523 (define-key Info-mode-map [mouse-2] 'Info-mouse-follow-nearest-node) |
540 | 1524 ) |
325 | 1525 |
1526 ;; Info mode is suitable only for specially formatted data. | |
1527 (put 'info-mode 'mode-class 'special) | |
1528 | |
1529 (defun Info-mode () | |
1530 "\\<Info-mode-map> | |
1531 Info mode provides commands for browsing through the Info documentation tree. | |
1532 Documentation in Info is divided into \"nodes\", each of which discusses | |
1533 one topic and contains references to other nodes which discuss related | |
1534 topics. Info has commands to follow the references and show you other nodes. | |
1535 | |
1536 \\[Info-help] Invoke the Info tutorial. | |
1537 | |
1538 Selecting other nodes: | |
8564 | 1539 \\[Info-mouse-follow-nearest-node] |
1540 Follow a node reference you click on. | |
1541 This works with menu items, cross references, and | |
1542 the \"next\", \"previous\" and \"up\", depending on where you click. | |
325 | 1543 \\[Info-next] Move to the \"next\" node of this node. |
3127
dfbada800489
(Info-follow-nearest-node): Omit 4th arg to Info-get-token.
Richard M. Stallman <rms@gnu.org>
parents:
3084
diff
changeset
|
1544 \\[Info-prev] Move to the \"previous\" node of this node. |
325 | 1545 \\[Info-up] Move \"up\" from this node. |
1546 \\[Info-menu] Pick menu item specified by name (or abbreviation). | |
1547 Picking a menu item causes another node to be selected. | |
540 | 1548 \\[Info-directory] Go to the Info directory node. |
325 | 1549 \\[Info-follow-reference] Follow a cross reference. Reads name of reference. |
1550 \\[Info-last] Move to the last node you were at. | |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1551 \\[Info-index] Look up a topic in this file's Index and move to that node. |
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1552 \\[Info-index-next] (comma) Move to the next match from a previous `i' command. |
325 | 1553 |
1554 Moving within a node: | |
5041 | 1555 \\[Info-scroll-up] Normally, scroll forward a full screen. If the end of the buffer is |
930
1dac458b5117
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
929
diff
changeset
|
1556 already visible, try to go to the next menu entry, or up if there is none. |
5041 | 1557 \\[Info-scroll-down] Normally, scroll backward. If the beginning of the buffer is |
930
1dac458b5117
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
929
diff
changeset
|
1558 already visible, try to go to the previous menu entry, or up if there is none. |
1dac458b5117
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
929
diff
changeset
|
1559 \\[beginning-of-buffer] Go to beginning of node. |
325 | 1560 |
1561 Advanced commands: | |
1562 \\[Info-exit] Quit Info: reselect previously selected buffer. | |
1563 \\[Info-edit] Edit contents of selected node. | |
1564 1 Pick first item in node's menu. | |
1565 2, 3, 4, 5 Pick second ... fifth item in node's menu. | |
1566 \\[Info-goto-node] Move to node specified by name. | |
1567 You may include a filename as well, as (FILENAME)NODENAME. | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1568 \\[universal-argument] \\[info] Move to new Info file with completion. |
325 | 1569 \\[Info-search] Search through this Info file for specified regexp, |
930
1dac458b5117
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
929
diff
changeset
|
1570 and select the node in which the next occurrence is found. |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1571 \\[Info-next-reference] Move cursor to next cross-reference or menu item. |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1572 \\[Info-prev-reference] Move cursor to previous cross-reference or menu item." |
325 | 1573 (kill-all-local-variables) |
1574 (setq major-mode 'Info-mode) | |
1575 (setq mode-name "Info") | |
1576 (use-local-map Info-mode-map) | |
1577 (set-syntax-table text-mode-syntax-table) | |
1578 (setq local-abbrev-table text-mode-abbrev-table) | |
1579 (setq case-fold-search t) | |
1580 (setq buffer-read-only t) | |
1581 (make-local-variable 'Info-current-file) | |
1582 (make-local-variable 'Info-current-subfile) | |
1583 (make-local-variable 'Info-current-node) | |
1584 (make-local-variable 'Info-tag-table-marker) | |
1585 (make-local-variable 'Info-history) | |
2561
1bd4cf98df68
(Info-find-node, Info-insert-subfile): Do the right thing if info files have
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2038
diff
changeset
|
1586 (make-local-variable 'Info-index-alternatives) |
9572 | 1587 (if (memq (framep (selected-frame)) '(x pc)) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1588 (progn |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1589 (make-face 'info-node) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1590 (make-face 'info-menu-5) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1591 (make-face 'info-xref) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1592 (or (face-differs-from-default-p 'info-node) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1593 (if (face-differs-from-default-p 'bold-italic) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1594 (copy-face 'bold-italic 'info-node) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1595 (copy-face 'bold 'info-node))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1596 (or (face-differs-from-default-p 'info-menu-5) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1597 (set-face-underline-p 'info-menu-5 t)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1598 (or (face-differs-from-default-p 'info-xref) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1599 (copy-face 'bold 'info-xref))) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1600 (setq Info-fontify nil)) |
325 | 1601 (Info-set-mode-line) |
1602 (run-hooks 'Info-mode-hook)) | |
1603 | |
1604 (defvar Info-edit-map nil | |
1605 "Local keymap used within `e' command of Info.") | |
1606 (if Info-edit-map | |
1607 nil | |
1608 (setq Info-edit-map (nconc (make-sparse-keymap) text-mode-map)) | |
1609 (define-key Info-edit-map "\C-c\C-c" 'Info-cease-edit)) | |
1610 | |
1611 ;; Info-edit mode is suitable only for specially formatted data. | |
1612 (put 'info-edit-mode 'mode-class 'special) | |
1613 | |
1614 (defun Info-edit-mode () | |
1615 "Major mode for editing the contents of an Info node. | |
1477 | 1616 Like text mode with the addition of `Info-cease-edit' |
325 | 1617 which returns to Info mode for browsing. |
1618 \\{Info-edit-map}" | |
8805
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1619 (use-local-map Info-edit-map) |
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1620 (setq major-mode 'Info-edit-mode) |
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1621 (setq mode-name "Info Edit") |
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1622 (kill-local-variable 'mode-line-buffer-identification) |
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1623 (setq buffer-read-only nil) |
11580
7f357fe2cda5
(Info-edit-mode, Info-cease-edit): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents:
11527
diff
changeset
|
1624 (force-mode-line-update) |
8805
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1625 (buffer-enable-undo (current-buffer)) |
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1626 (run-hooks 'Info-edit-mode-hook)) |
325 | 1627 |
1628 (defun Info-edit () | |
1629 "Edit the contents of this Info node. | |
1630 Allowed only if variable `Info-enable-edit' is non-nil." | |
1631 (interactive) | |
1632 (or Info-enable-edit | |
1633 (error "Editing info nodes is not enabled")) | |
8805
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1634 (Info-edit-mode) |
325 | 1635 (message (substitute-command-keys |
8805
6d8297d65d78
(Info-edit): Move the customary mode-initialization calls out of here.
Karl Heuer <kwzh@gnu.org>
parents:
8739
diff
changeset
|
1636 "Editing: Type \\<Info-edit-map>\\[Info-cease-edit] to return to info"))) |
325 | 1637 |
1638 (defun Info-cease-edit () | |
1639 "Finish editing Info node; switch back to Info proper." | |
1640 (interactive) | |
1641 ;; Do this first, so nothing has changed if user C-g's at query. | |
1642 (and (buffer-modified-p) | |
1643 (y-or-n-p "Save the file? ") | |
1644 (save-buffer)) | |
1645 (use-local-map Info-mode-map) | |
1646 (setq major-mode 'Info-mode) | |
1647 (setq mode-name "Info") | |
1648 (Info-set-mode-line) | |
1649 (setq buffer-read-only t) | |
11580
7f357fe2cda5
(Info-edit-mode, Info-cease-edit): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents:
11527
diff
changeset
|
1650 (force-mode-line-update) |
325 | 1651 (and (marker-position Info-tag-table-marker) |
1652 (buffer-modified-p) | |
1653 (message "Tags may have changed. Use Info-tagify if necessary"))) | |
359 | 1654 |
12889
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1655 (defvar Info-file-list-for-emacs |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1656 '("ediff" "forms" "gnus" "info" ("mh" . "mh-e") "sc") |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1657 "List of Info files that describe Emacs commands. |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1658 An element can be a file name, or a list of the form (PREFIX . FILE) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1659 where PREFIX is a name prefix and FILE is the file to look in. |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1660 If the element is just a file name, the file name also serves as the prefix.") |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1661 |
359 | 1662 (defun Info-find-emacs-command-nodes (command) |
12889
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1663 "Return a list of locations documenting COMMAND. |
12892
8b902b24d749
(Info-find-emacs-command-nodes): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12889
diff
changeset
|
1664 The `info-file' property of COMMAND says which Info manual to search. |
8b902b24d749
(Info-find-emacs-command-nodes): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12889
diff
changeset
|
1665 If COMMAND has no property, the variable `Info-file-list-for-emacs' |
8b902b24d749
(Info-find-emacs-command-nodes): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12889
diff
changeset
|
1666 defines heuristics for which Info manual to try. |
359 | 1667 The locations are of the format used in Info-history, i.e. |
1668 \(FILENAME NODENAME BUFFERPOS\)." | |
1669 (let ((where '()) | |
1670 (cmd-desc (concat "^\\* " (regexp-quote (symbol-name command)) | |
12889
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1671 ":\\s *\\(.*\\)\\.$")) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1672 (info-file "emacs")) ;default |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1673 ;; Determine which info file this command is documented in. |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1674 (if (get command 'info-file) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1675 (setq info-file (get command 'info-file)) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1676 ;; If it doesn't say explicitly, test its name against |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1677 ;; various prefixes that we know. |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1678 (let ((file-list Info-file-list-for-emacs)) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1679 (while file-list |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1680 (let* ((elt (car file-list)) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1681 (name (if (consp elt) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1682 (car elt) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1683 elt)) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1684 (file (if (consp elt) (cdr elt) elt)) |
12892
8b902b24d749
(Info-find-emacs-command-nodes): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12889
diff
changeset
|
1685 (regexp (concat "\\`" (regexp-quote name) |
12889
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1686 "\\(\\'\\|-\\)"))) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1687 (if (string-match regexp (symbol-name command)) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1688 (setq info-file file file-list nil)) |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1689 (setq file-list (cdr file-list)))))) |
359 | 1690 (save-excursion |
12889
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1691 (condition-case nil |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1692 (Info-find-node info-file "Command Index") |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1693 ;; Some manuals may not have a separate Command Index node, |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1694 ;; so try just Index instead. |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1695 (error |
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1696 (Info-find-node info-file "Index"))) |
359 | 1697 ;; Take the index node off the Info history. |
1698 (setq Info-history (cdr Info-history)) | |
1699 (goto-char (point-max)) | |
1700 (while (re-search-backward cmd-desc nil t) | |
1701 (setq where (cons (list Info-current-file | |
1702 (buffer-substring | |
1703 (match-beginning 1) | |
1704 (match-end 1)) | |
1705 0) | |
1706 where))) | |
1707 where))) | |
1708 | |
1709 ;;;###autoload | |
1710 (defun Info-goto-emacs-command-node (command) | |
4468
5e9224dac452
(Info-goto-emacs-command-node, Info-goto-emacs-key-command-node): Doc fix.
Roland McGrath <roland@gnu.org>
parents:
4410
diff
changeset
|
1711 "Go to the Info node in the Emacs manual for command COMMAND. |
12889
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1712 The command is found by looking up in Emacs manual's Command Index |
12892
8b902b24d749
(Info-find-emacs-command-nodes): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12889
diff
changeset
|
1713 or in another manual found via COMMAND's `info-file' property or |
8b902b24d749
(Info-find-emacs-command-nodes): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12889
diff
changeset
|
1714 the variable `Info-file-list-for-emacs'." |
359 | 1715 (interactive "CFind documentation for command: ") |
1716 (or (commandp command) | |
1717 (signal 'wrong-type-argument (list 'commandp command))) | |
1718 (let ((where (Info-find-emacs-command-nodes command))) | |
1719 (if where | |
1720 (let ((num-matches (length where))) | |
1721 ;; Get Info running, and pop to it in another window. | |
1722 (save-window-excursion | |
1723 (info)) | |
1724 (pop-to-buffer "*info*") | |
1725 (Info-find-node (car (car where)) | |
1726 (car (cdr (car where)))) | |
1727 (if (> num-matches 1) | |
1728 (progn | |
1729 ;; Info-find-node already pushed (car where) onto | |
1730 ;; Info-history. Put the other nodes that were found on | |
1731 ;; the history. | |
1732 (setq Info-history (nconc (cdr where) Info-history)) | |
1733 (message (substitute-command-keys | |
6049
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
1734 "Found %d other entr%s. Use \\[Info-last] to see %s.") |
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
1735 (1- num-matches) |
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
1736 (if (> num-matches 2) "ies" "y") |
32df2b4d67cf
(Info-build-node-completions): Add a call to widen.
Richard M. Stallman <rms@gnu.org>
parents:
5555
diff
changeset
|
1737 (if (> num-matches 2) "them" "it"))))) |
359 | 1738 (error "Couldn't find documentation for %s." command)))) |
1739 | |
1740 ;;;###autoload | |
1741 (defun Info-goto-emacs-key-command-node (key) | |
1742 "Go to the Info node in the Emacs manual the command bound to KEY, a string. | |
4468
5e9224dac452
(Info-goto-emacs-command-node, Info-goto-emacs-key-command-node): Doc fix.
Roland McGrath <roland@gnu.org>
parents:
4410
diff
changeset
|
1743 Interactively, if the binding is execute-extended-command, a command is read. |
12889
d912ac1e1f00
(Info-file-list-for-emacs): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12779
diff
changeset
|
1744 The command is found by looking up in Emacs manual's Command Index |
12892
8b902b24d749
(Info-find-emacs-command-nodes): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12889
diff
changeset
|
1745 or in another manual found via COMMAND's `info-file' property or |
8b902b24d749
(Info-find-emacs-command-nodes): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
12889
diff
changeset
|
1746 the variable `Info-file-list-for-emacs'." |
359 | 1747 (interactive "kFind documentation for key:") |
1748 (let ((command (key-binding key))) | |
1749 (cond ((null command) | |
1484
6c2a714566d3
Rename buffer-flush-undo to buffer-disable-undo.
Richard M. Stallman <rms@gnu.org>
parents:
1477
diff
changeset
|
1750 (message "%s is undefined" (key-description key))) |
359 | 1751 ((and (interactive-p) |
1752 (eq command 'execute-extended-command)) | |
1753 (Info-goto-emacs-command-node | |
1754 (read-command "Find documentation for command: "))) | |
1755 (t | |
1756 (Info-goto-emacs-command-node command))))) | |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1757 |
13084
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1758 (defvar Info-title-face-alist |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1759 '((?* bold underline) |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1760 (?= bold-italic underline) |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1761 (?- italic underline)) |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1762 "*Alist of face or list of faces to use for pseudo-underlined titles. |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1763 The alist key is the character the title is underlined with (?*, ?= or ?-).") |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1764 |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1765 (defun Info-fontify-node () |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1766 (save-excursion |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1767 (let ((buffer-read-only nil)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1768 (goto-char (point-min)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1769 (if (looking-at "^File: [^,: \t]+,?[ \t]+") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1770 (progn |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1771 (goto-char (match-end 0)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1772 (while |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1773 (looking-at "[ \t]*[^:, \t\n]+:[ \t]+\\([^:,\t\n]+\\),?") |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1774 (goto-char (match-end 0)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1775 (put-text-property (match-beginning 1) (match-end 1) |
6624
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1776 'face 'info-xref) |
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1777 (put-text-property (match-beginning 1) (match-end 1) |
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1778 'mouse-face 'highlight)))) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1779 (goto-char (point-min)) |
13084
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1780 (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\)$" |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1781 nil t) |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1782 (put-text-property (match-beginning 1) (match-end 1) |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1783 'face |
13085
5be0696ddc1e
(Info-fontify-node): Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents:
13084
diff
changeset
|
1784 (cdr (assq (preceding-char) Info-title-face-alist))) |
13084
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1785 (put-text-property (match-end 1) (match-end 2) |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1786 'invisible t)) |
805486dfbc82
(Info-title-face-alist): New var.
Karl Heuer <kwzh@gnu.org>
parents:
13004
diff
changeset
|
1787 (goto-char (point-min)) |
7859
1d1693211560
(Info-fontify-node): Require some whitespace after *Note.
Richard M. Stallman <rms@gnu.org>
parents:
7837
diff
changeset
|
1788 (while (re-search-forward "\\*Note[ \n\t]+\\([^:]*\\):" nil t) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1789 (if (= (char-after (1- (match-beginning 0))) ?\") ; hack |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1790 nil |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1791 (put-text-property (match-beginning 1) (match-end 1) |
6624
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1792 'face 'info-xref) |
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1793 (put-text-property (match-beginning 1) (match-end 1) |
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1794 'mouse-face 'highlight))) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1795 (goto-char (point-min)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1796 (if (and (search-forward "\n* Menu:" nil t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1797 (not (string-match "\\<Index\\>" Info-current-node)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1798 ;; Don't take time to annotate huge menus |
8193
0be48d0d16fd
(Info-fontify-maximum-menu-size): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
8071
diff
changeset
|
1799 (< (- (point-max) (point)) Info-fontify-maximum-menu-size)) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1800 (let ((n 0)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1801 (while (re-search-forward "^\\* \\([^:\t\n]*\\):" nil t) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1802 (setq n (1+ n)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1803 (if (memq n '(5 9)) ; visual aids to help with 1-9 keys |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1804 (put-text-property (match-beginning 0) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1805 (1+ (match-beginning 0)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1806 'face 'info-menu-5)) |
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1807 (put-text-property (match-beginning 1) (match-end 1) |
6624
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1808 'face 'info-node) |
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1809 (put-text-property (match-beginning 1) (match-end 1) |
ca39bae3744d
(Info-fontify-node): Add mouse-face properties.
Richard M. Stallman <rms@gnu.org>
parents:
6566
diff
changeset
|
1810 'mouse-face 'highlight)))) |
4410
25fb71fc2643
(Info-fontify-node): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4261
diff
changeset
|
1811 (set-buffer-modified-p nil)))) |
584 | 1812 |
1813 (provide 'info) | |
1814 | |
660
08eb386dd0f3
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
584
diff
changeset
|
1815 ;;; info.el ends here |