comparison lisp/packages/page-ext.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 34a5b81f86ba
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
1 ;;; page-ext.el --- extended page handling commands 1 ;;; page-ext.el --- extended page handling commands
2
3 ;; Copyright (C) 1990, 1991, 1993, 1994 Free Software Foundation
4
5 ;; Maintainer: Robert J. Chassell <bob@gnu.ai.mit.edu>
6
7 ;; This file is part of XEmacs.
8
9 ;; XEmacs is free software; you can redistribute it and/or modify it
10 ;; under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; XEmacs is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 ;; 02111-1307, USA.
23
24 ;;; Synched up with: FSF 19.34.
25
26 ;;; Commentary:
2 27
3 ;; You may use these commands to handle an address list or other 28 ;; You may use these commands to handle an address list or other
4 ;; small data base. 29 ;; small data base.
5 30
6 ;; Copyright (C) 1990, 1991, 1993, 1994 Free Software Foundation
7
8 ;; Maintainer: Robert J. Chassell <bob@gnu.ai.mit.edu>
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to
24 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
25
26 ;;; Synched up with: FSF 19.30.
27
28 31
29 ;;; Summary 32 ;;; Summary
30 33
31 ; The current page commands are: 34 ;; The current page commands are:
32 35
33 ; forward-page C-x ] 36 ;; forward-page C-x ]
34 ; backward-page C-x [ 37 ;; backward-page C-x [
35 ; narrow-to-page C-x p 38 ;; narrow-to-page C-x p
36 ; count-lines-page C-x l 39 ;; count-lines-page C-x l
37 ; mark-page C-x C-p (change this to C-x C-p C-m) 40 ;; mark-page C-x C-p (change this to C-x C-p C-m)
38 ; sort-pages not bound 41 ;; sort-pages not bound
39 ; what-page not bound 42 ;; what-page not bound
40 43
41 ; The new page handling commands all use `C-x C-p' as a prefix. This 44 ;; The new page handling commands all use `C-x C-p' as a prefix. This
42 ; means that the key binding for `mark-page' must be changed. 45 ;; means that the key binding for `mark-page' must be changed.
43 ; Otherwise, no other changes are made to the current commands or 46 ;; Otherwise, no other changes are made to the current commands or
44 ; their bindings. 47 ;; their bindings.
45 48
46 ; New page handling commands: 49 ;; New page handling commands:
47 50
48 ; next-page C-x C-p C-n 51 ;; next-page C-x C-p C-n
49 ; previous-page C-x C-p C-p 52 ;; previous-page C-x C-p C-p
50 ; search-pages C-x C-p C-s 53 ;; search-pages C-x C-p C-s
51 ; add-new-page C-x C-p C-a 54 ;; add-new-page C-x C-p C-a
52 ; sort-pages-buffer C-x C-p s 55 ;; sort-pages-buffer C-x C-p s
53 ; set-page-delimiter C-x C-p C-l 56 ;; set-page-delimiter C-x C-p C-l
54 ; pages-directory C-x C-p C-d 57 ;; pages-directory C-x C-p C-d
55 ; pages-directory-for-addresses C-x C-p d 58 ;; pages-directory-for-addresses C-x C-p d
56 ; pages-directory-goto C-c C-c 59 ;; pages-directory-goto C-c C-c
57 60
58 61
59 ;;; Using the page commands 62 ;;; Using the page commands
60 63
61 ; The page commands are helpful in several different contexts. For 64 ;; The page commands are helpful in several different contexts. For
62 ; example, programmers often divide source files into sections using the 65 ;; example, programmers often divide source files into sections using the
63 ; `page-delimiter'; you can use the `pages-directory' command to list 66 ;; `page-delimiter'; you can use the `pages-directory' command to list
64 ; the sections. 67 ;; the sections.
65 68
66 ; You may change the buffer local value of the `page-delimiter' with 69 ;; You may change the buffer local value of the `page-delimiter' with
67 ; the `set-page-delimiter' command. This command is bound to `C-x C-p 70 ;; the `set-page-delimiter' command. This command is bound to `C-x C-p
68 ; C-l' The command prompts you for a new value for the page-delimiter. 71 ;; C-l' The command prompts you for a new value for the page-delimiter.
69 ; Called with a prefix-arg, the command resets the value of the 72 ;; Called with a prefix-arg, the command resets the value of the
70 ; page-delimiter to its original value. 73 ;; page-delimiter to its original value.
71 74
72 ; You may set several user options: 75 ;; You may set several user options:
73 ; 76 ;;
74 ; The `pages-directory-buffer-narrowing-p' variable causes the 77 ;; The `pages-directory-buffer-narrowing-p' variable causes the
75 ; `pages-directory-goto' command to narrow to the destination page. 78 ;; `pages-directory-goto' command to narrow to the destination page.
76 ; 79 ;;
77 ; The `pages-directory-for-adding-page-narrowing-p' variable, causes the 80 ;; The `pages-directory-for-adding-page-narrowing-p' variable, causes the
78 ; `add-new-page' command to narrow to the new entry. 81 ;; `add-new-page' command to narrow to the new entry.
79 ; 82 ;;
80 ; The `pages-directory-for-adding-new-page-before-current-page-p' variable 83 ;; The `pages-directory-for-adding-new-page-before-current-page-p' variable
81 ; causes the `add-new-page' command to insert a new page before current 84 ;; causes the `add-new-page' command to insert a new page before current
82 ; page. 85 ;; page.
83 ; 86 ;;
84 ; These variables are true by default. 87 ;; These variables are true by default.
85 ; 88 ;;
86 ; Additional, addresses-related user options are described in the next page 89 ;; Additional, addresses-related user options are described in the next page
87 ; of this file. 90 ;; of this file.
88 91
89 92
90 ;;; Handling an address list or small data base 93 ;;; Handling an address list or small data base
91 94
92 ; You may use the page commands to handle an address list or other 95 ;; You may use the page commands to handle an address list or other
93 ; small data base. Put each address or entry on its own page. The 96 ;; small data base. Put each address or entry on its own page. The
94 ; first line of text in each page is a `header line' and is listed by 97 ;; first line of text in each page is a `header line' and is listed by
95 ; the `pages-directory' or `pages-directory-for-addresses' command. 98 ;; the `pages-directory' or `pages-directory-for-addresses' command.
96 99
97 ; Specifically: 100 ;; Specifically:
98 ; 101 ;;
99 ; 1. Begin each entry with a `page-delimiter' (which is, by default, 102 ;; 1. Begin each entry with a `page-delimiter' (which is, by default,
100 ; `^L' at the beginning of the line). 103 ;; `^L' at the beginning of the line).
101 ; 104 ;;
102 ; 2. The first line of text in each entry is the `heading line'; it 105 ;; 2. The first line of text in each entry is the `heading line'; it
103 ; will appear in the pages-directory-buffer which is constructed 106 ;; will appear in the pages-directory-buffer which is constructed
104 ; using the `C-x C-p C-d' (pages-directory) command or the `C-x 107 ;; using the `C-x C-p C-d' (pages-directory) command or the `C-x
105 ; C-p d' (pages-directory-for-addresses) command. 108 ;; C-p d' (pages-directory-for-addresses) command.
106 ; 109 ;;
107 ; The heading line may be on the same line as the page-delimiter 110 ;; The heading line may be on the same line as the page-delimiter
108 ; or it may follow after. It is the first non-blank line on the 111 ;; or it may follow after. It is the first non-blank line on the
109 ; page. Conventionally, the heading line is placed on the line 112 ;; page. Conventionally, the heading line is placed on the line
110 ; immediately following the line containing page-delimiter. 113 ;; immediately following the line containing page-delimiter.
111 ; 114 ;;
112 ; 3. Follow the heading line with the body of the entry. The body 115 ;; 3. Follow the heading line with the body of the entry. The body
113 ; extends up to the next `page-delimiter'. The body may be of any 116 ;; extends up to the next `page-delimiter'. The body may be of any
114 ; length. It is conventional to place a blank line after the last 117 ;; length. It is conventional to place a blank line after the last
115 ; line of the body. 118 ;; line of the body.
116 119
117 ; For example, a file might look like this: 120 ;; For example, a file might look like this:
118 ; 121 ;;
119 ; FSF 122 ;; FSF
120 ; Free Software Foundation 123 ;; Free Software Foundation
121 ; 675 Massachusetts Avenue 124 ;; 59 Temple Place - Suite 330
122 ; Cambridge, MA 02139 USA 125 ;; Boston, MA 02111-1307 USA.
123 ; (617) 876-3296 126 ;; (617) 542-5942
124 ; gnu@prep.ai.mit.edu 127 ;; gnu@prep.ai.mit.edu
125 ; 128 ;;
126 ; 129 ;;
127 ; House Subcommittee on Intellectual Property, 130 ;; House Subcommittee on Intellectual Property,
128 ; U.S. House of Representatives, 131 ;; U.S. House of Representatives,
129 ; Washington, DC 20515 132 ;; Washington, DC 20515
130 ; 133 ;;
131 ; Congressional committee concerned with permitting or preventing 134 ;; Congressional committee concerned with permitting or preventing
132 ; monopolistic restrictions on the use of software technology. 135 ;; monopolistic restrictions on the use of software technology.
133 ; 136 ;;
134 ; 137 ;;
135 ; George Lakoff 138 ;; George Lakoff
136 ; ``Women, Fire, and Dangerous Things: 139 ;; ``Women, Fire, and Dangerous Things:
137 ; What Categories Reveal about the Mind'' 140 ;; What Categories Reveal about the Mind''
138 ; 1987, Univ. of Chicago Press 141 ;; 1987, Univ. of Chicago Press
139 ; 142 ;;
140 ; About philosophy, Whorfian effects, and linguistics. 143 ;; About philosophy, Whorfian effects, and linguistics.
141 ; 144 ;;
142 ; 145 ;;
143 ; OBI (On line text collection.) 146 ;; OBI (On line text collection.)
144 ; Open Book Initiative 147 ;; Open Book Initiative
145 ; c/o Software Tool & Die 148 ;; c/o Software Tool & Die
146 ; 1330 Beacon St, Brookline, MA 02146 USA 149 ;; 1330 Beacon St, Brookline, MA 02146 USA
147 ; (617) 739-0202 150 ;; (617) 739-0202
148 ; obi@world.std.com 151 ;; obi@world.std.com
149 152
150 ; In this example, the heading lines are: 153 ;; In this example, the heading lines are:
151 ; 154 ;;
152 ; FSF 155 ;; FSF
153 ; House Subcommittee on Intellectual Property 156 ;; House Subcommittee on Intellectual Property
154 ; George Lakoff 157 ;; George Lakoff
155 ; OBI (On line text collection.) 158 ;; OBI (On line text collection.)
156 159
157 ; The `C-x C-p s' (sort-pages-buffer) command sorts the entries in the 160 ;; The `C-x C-p s' (sort-pages-buffer) command sorts the entries in the
158 ; buffer alphabetically. 161 ;; buffer alphabetically.
159 162
160 ; You may use any of the page commands, including the `next-page', 163 ;; You may use any of the page commands, including the `next-page',
161 ; `previous-page', `add-new-page', `mark-page', and `search-pages' 164 ;; `previous-page', `add-new-page', `mark-page', and `search-pages'
162 ; commands. 165 ;; commands.
163 166
164 ; You may use either the `C-x C-p d' (pages-directory-for-addresses) 167 ;; You may use either the `C-x C-p d' (pages-directory-for-addresses)
165 ; or the `C-x C-p C-d' (pages-directory) command to construct and 168 ;; or the `C-x C-p C-d' (pages-directory) command to construct and
166 ; dislay a directory of all the heading lines. 169 ;; display a directory of all the heading lines.
167 170
168 ; In the directory, you may position the cursor over a heading line 171 ;; In the directory, you may position the cursor over a heading line
169 ; and type `C-c C-c' (pages-directory-goto) to go to the entry to 172 ;; and type `C-c C-c' (pages-directory-goto) to go to the entry to
170 ; which it refers in the pages buffer. 173 ;; which it refers in the pages buffer.
171 174
172 ; You can type `C-c C-p C-a' (add-new-page) to add a new entry in the 175 ;; You can type `C-c C-p C-a' (add-new-page) to add a new entry in the
173 ; pages buffer or address file. This is the same command you use to 176 ;; pages buffer or address file. This is the same command you use to
174 ; add a new entry when you are in the pages buffer or address file. 177 ;; add a new entry when you are in the pages buffer or address file.
175 178
176 ; If you wish, you may create several different directories, 179 ;; If you wish, you may create several different directories,
177 ; one for each different buffer. 180 ;; one for each different buffer.
178 181
179 ;; `pages-directory-for-addresses' in detail 182 ;; `pages-directory-for-addresses' in detail
180 183
181 ; The `pages-directory-for-addresses' assumes a default addresses 184 ;; The `pages-directory-for-addresses' assumes a default addresses
182 ; file. You do not need to specify the addresses file but merely type 185 ;; file. You do not need to specify the addresses file but merely type
183 ; `C-x C-p d' from any buffer. The command finds the file, constructs 186 ;; `C-x C-p d' from any buffer. The command finds the file, constructs
184 ; a directory for it, and switches you to the directory. If you call 187 ;; a directory for it, and switches you to the directory. If you call
185 ; the command with a prefix arg, `C-u C-x C-p d', it prompts you for a 188 ;; the command with a prefix arg, `C-u C-x C-p d', it prompts you for a
186 ; file name. 189 ;; file name.
187 190
188 ; You may customize the addresses commands: 191 ;; You may customize the addresses commands:
189 192
190 ; The `pages-addresses-file-name' variable determines the name of 193 ;; The `pages-addresses-file-name' variable determines the name of
191 ; the addresses file; by default it is "~/addresses". 194 ;; the addresses file; by default it is "~/addresses".
192 195
193 ; The `pages-directory-for-addresses-goto-narrowing-p' variable 196 ;; The `pages-directory-for-addresses-goto-narrowing-p' variable
194 ; determines whether `pages-directory-goto' narrows the addresses 197 ;; determines whether `pages-directory-goto' narrows the addresses
195 ; buffer to the entry, which it does by default. 198 ;; buffer to the entry, which it does by default.
196 199
197 ; The `pages-directory-for-addresses-buffer-keep-windows-p' variable 200 ;; The `pages-directory-for-addresses-buffer-keep-windows-p' variable
198 ; determines whether `pages-directory-for-addresses' deletes other 201 ;; determines whether `pages-directory-for-addresses' deletes other
199 ; windows to show as many lines as possible on the screen or works 202 ;; windows to show as many lines as possible on the screen or works
200 ; in the usual Emacs manner and keeps other windows. Default is to 203 ;; in the usual Emacs manner and keeps other windows. Default is to
201 ; keep other windows. 204 ;; keep other windows.
202 205
203 ; The `pages-directory-for-adding-addresses-narrowing-p' variable 206 ;; The `pages-directory-for-adding-addresses-narrowing-p' variable
204 ; determines whether `pages-directory-for-addresses' narrows the 207 ;; determines whether `pages-directory-for-addresses' narrows the
205 ; addresses buffer to a new entry when you are adding that entry. 208 ;; addresses buffer to a new entry when you are adding that entry.
206 ; Default is to narrow to new entry, which means you see a blank 209 ;; Default is to narrow to new entry, which means you see a blank
207 ; screen before you write the new entry. 210 ;; screen before you write the new entry.
208 211
209 ;; `pages-directory' in detail 212 ;; `pages-directory' in detail
210 213
211 ; Call the `pages-directory' command from the buffer for which you 214 ;; Call the `pages-directory' command from the buffer for which you
212 ; want a directory created; it creates a directory for the buffer and 215 ;; want a directory created; it creates a directory for the buffer and
213 ; pops you to the directory. 216 ;; pops you to the directory.
214 217
215 ; The `pages-directory' command has several options: 218 ;; The `pages-directory' command has several options:
216 219
217 ; Called with a prefix arg, `C-u C-x C-p C-d', the `pages-directory' 220 ;; Called with a prefix arg, `C-u C-x C-p C-d', the `pages-directory'
218 ; prompts you for a regular expression and only lists only those 221 ;; prompts you for a regular expression and only lists only those
219 ; header lines that are part of pages that contain matches to the 222 ;; header lines that are part of pages that contain matches to the
220 ; regexp. In the example above, `C-u C-x C-p C-d 617 RET' would 223 ;; regexp. In the example above, `C-u C-x C-p C-d 617 RET' would
221 ; match the telephone area code of the first and fourth entries, so 224 ;; match the telephone area code of the first and fourth entries, so
222 ; only the header lines of those two entries would appear in the 225 ;; only the header lines of those two entries would appear in the
223 ; pages-directory-buffer. 226 ;; pages-directory-buffer.
224 ; 227 ;;
225 ; Called with a numeric argument, the `pages-directory' command 228 ;; Called with a numeric argument, the `pages-directory' command
226 ; lists the number of lines in each page. This is helpful when you 229 ;; lists the number of lines in each page. This is helpful when you
227 ; are printing hardcopy. 230 ;; are printing hardcopy.
228 231
229 ; Called with a negative numeric argument, the `pages-directory' 232 ;; Called with a negative numeric argument, the `pages-directory'
230 ; command lists the lengths of pages whose contents match a regexp. 233 ;; command lists the lengths of pages whose contents match a regexp.
231 234
232 ;;; Code: 235 ;;; Code:
233 236
234 237
235 ;;; Customarily customizable variable definitions 238 ;;; Customarily customizable variable definitions
412 (function (lambda () 415 (function (lambda ()
413 (re-search-forward page-delimiter nil t) 416 (re-search-forward page-delimiter nil t)
414 (skip-chars-forward " \t\n") 417 (skip-chars-forward " \t\n")
415 )) 418 ))
416 419
417 ;; ENDRECFUN is is called with point within the record. 420 ;; ENDRECFUN is called with point within the record.
418 ;; It should move point to the end of the record. 421 ;; It should move point to the end of the record.
419 (function (lambda () 422 (function (lambda ()
420 (if (re-search-forward 423 (if (re-search-forward
421 page-delimiter 424 page-delimiter
422 nil 425 nil