Mercurial > emacs
annotate lisp/mail/rmail.el @ 1444:559d2f2119aa
* window.c: Try to deal coherently with deleted windows:
* (Flive_window_p): New function.
(Qlive_window_p): New variable, to name it in type errors.
(syms_of_window): Defsubr Slive_window_p, init and staticpro
Qlive_window_p.
(decode_window): Use CHECK_LIVE_WINDOW instead of
CHECK_WINDOW; the only thing a user should be able to do to a dead
window is check its type.
(Fcoordinates_in_window_p, Fnext_window, Fprevious_window,
Fdelete_other_windows, Fselect_window, Fsplit_window,
Fscroll_other_window): Use CHECK_LIVE_WINDOW instead of
CHECK_WINDOW.
(Fdelete_window): If WINDOW is a deleted window, do nothing;
there's no harm in allowing people to delete deleted windows.
Delete all of WINDOW's subwindows, too.
(delete_all_subwindows): Set the buffer, vchild, and hchild of the
windows we delete all to nil.
* window.c (Fwindow_minibuffer_p): Make the WINDOW argument
optional, like all the other window-querying functions.
* window.c (Fpos_visible_in_window_p): Use decode_window to handle
the WINDOW argument, instead of writing out that function's code.
* window.c (check_frame_size): Don't define this extern; that
doesn't mean anything.
* window.c (Fdelete_window): Choose an alternative when we delete
any frame's selected window, not just when we delete the selected
frame's selected window.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Mon, 19 Oct 1992 18:46:29 +0000 |
parents | 9b210c7d6c23 |
children | 7f25b15a6809 |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
1 ;;; rmail.el --- main code of "RMAIL" mail reader for Emacs. |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
2 |
846
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
830
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1987, 1988, 1991, 1992 Free Software Foundation, Inc. |
20674ae6bf52
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
830
diff
changeset
|
4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
5 ;; Maintainer: FSF |
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
813
diff
changeset
|
6 ;; Keywords: mail |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
7 |
270 | 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:
658
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
270 | 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 | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
24 ;;; Code: |
270 | 25 |
26 ;; Souped up by shane@mit-ajax based on ideas of rlk@athena.mit.edu | |
27 ;; New features include attribute and keyword support, message | |
28 ;; selection by dispatch table, summary by attributes and keywords, | |
29 ;; expunging by dispatch table, sticky options for file commands. | |
30 | |
31 (require 'mail-utils) | |
32 ; These variables now declared paths.el | |
33 ;(defvar rmail-spool-directory "/usr/spool/mail/" | |
34 ; "This is the name of the directory used by the system mailer for\n\ | |
35 ;delivering new mail. It's name should end with a slash.") | |
36 ;(defvar rmail-file-name | |
37 ; (expand-file-name "~/RMAIL") | |
38 ; "") | |
39 | |
40 ;;;###autoload | |
41 (defvar rmail-dont-reply-to-names nil "\ | |
42 *A regexp specifying names to prune of reply to messages. | |
43 nil means dont reply to yourself.") | |
44 | |
45 ;;;###autoload | |
46 (defvar rmail-default-dont-reply-to-names "info-" "\ | |
47 A regular expression specifying part of the value of the default value of | |
48 the variable `rmail-dont-reply-to-names', for when the user does not set | |
49 `rmail-dont-reply-to-names' explicitly. (The other part of the default | |
50 value is the user's name.) | |
51 It is useful to set this variable in the site customisation file.") | |
52 | |
53 ;;;###autoload | |
54 (defvar rmail-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^received:\\|^message-id:\\|^summary-line:" "\ | |
55 *Gubbish headers one would rather not see.") | |
56 | |
57 ;;;###autoload | |
58 (defvar rmail-delete-after-output nil "\ | |
59 *Non-nil means automatically delete a message that is copied to a file.") | |
60 | |
61 ;;;###autoload | |
62 (defconst rmail-primary-inbox-list nil "\ | |
63 *List of files which are inboxes for user's primary mail file ~/RMAIL. | |
64 `nil' means the default, which is (\"/usr/spool/mail/$USER\" \"~/mbox\") | |
65 \(the first name varies depending on the operating system, | |
66 and the value of the environment variable MAIL overrides it).") | |
67 | |
68 ;; these may be altered by site-init.el to match the format of mmdf files | |
69 ;; delimitation used on a given host (delim1 and delim2 from the config | |
70 ;; files) | |
71 | |
72 (defvar mmdf-delim1 "^\001\001\001\001\n" | |
73 "Regexp marking the start of an mmdf message") | |
74 (defvar mmdf-delim2 "^\001\001\001\001\n" | |
75 "Regexp marking the end of an mmdf message") | |
76 | |
77 (defvar rmail-message-filter nil | |
78 "If non nil, is a filter function for new headers in RMAIL. | |
79 Called with region narrowed to unformatted header.") | |
80 | |
81 (defvar rmail-mode-map nil) | |
82 | |
83 (defvar rmail-inbox-list nil) | |
84 (defvar rmail-keywords nil) | |
85 | |
86 ;; Message counters and markers. Deleted flags. | |
87 | |
88 (defvar rmail-current-message nil) | |
89 (defvar rmail-total-messages nil) | |
90 (defvar rmail-message-vector nil) | |
91 (defvar rmail-deleted-vector nil) | |
92 | |
93 ;; These are used by autoloaded rmail-summary. | |
94 | |
95 (defvar rmail-summary-buffer nil) | |
96 (defvar rmail-summary-vector nil) | |
97 | |
98 ;; `Sticky' default variables. | |
99 | |
100 ;; Last individual label specified to a or k. | |
101 (defvar rmail-last-label nil) | |
102 ;; Last set of labels specified to C-M-n or C-M-p or C-M-l. | |
103 (defvar rmail-last-multi-labels nil) | |
104 (defvar rmail-last-file nil) | |
105 (defvar rmail-last-rmail-file nil) | |
617 | 106 |
621 | 107 ;;; Regexp matching the delimiter of messages in UNIX mail format |
108 ;;; (UNIX From lines), minus the initial ^. Note that if you change | |
109 ;;; this expression, you must change the code in rmail-nuke-pinhead-header | |
110 ;;; that knows the exact ordering of the \\( \\) subexpressions. | |
617 | 111 (defvar rmail-unix-mail-delimiter |
1112 | 112 (let ((time-zone-regexp |
113 (concat "\\([A-Z]?[A-Z][A-Z]T\\( DST\\)?" | |
114 "\\|[-+]?[0-9][0-9][0-9][0-9]" | |
115 "\\|" | |
116 "\\) *"))) | |
117 (concat | |
118 "From " | |
119 | |
120 ;; Username, perhaps with a quoted section that can contain spaces. | |
121 "\\(" | |
122 "[^ \n]*" | |
123 "\\(\\|\".*\"[^ \n]*\\)" | |
124 "\\) ?" | |
125 | |
126 ;; The time the message was sent. | |
127 "\\([^ \n]*\\) *" ; day of the week | |
128 "\\([^ ]*\\) *" ; month | |
129 "\\([0-9]*\\) *" ; day of month | |
130 "\\([0-9:]*\\) *" ; time of day | |
131 | |
132 ;; Perhaps a time zone, specified by an abbreviation, or by a | |
133 ;; numeric offset. | |
134 time-zone-regexp | |
135 | |
136 ;; The year. | |
137 " [0-9][0-9]\\([0-9]*\\) *" | |
138 | |
139 ;; On some systems the time zone can appear after the year, too. | |
140 time-zone-regexp | |
141 | |
142 ;; I'm not sure what this is. | |
143 "\\(remote from [^\n]*\\)?" | |
144 | |
145 "\n")) | |
146 nil) | |
147 | |
148 | |
270 | 149 |
150 ;;;; *** Rmail Mode *** | |
151 | |
152 ;;;###autoload | |
153 (defun rmail (&optional file-name-arg) | |
154 "Read and edit incoming mail. | |
155 Moves messages into file named by rmail-file-name (a babyl format file) | |
156 and edits that file in RMAIL Mode. | |
157 Type \\[describe-mode] once editing that file, for a list of RMAIL commands. | |
158 | |
159 May be called with filename as argument; then performs rmail editing on | |
160 that file, but does not copy any new mail into the file." | |
161 (interactive (if current-prefix-arg | |
162 (list (read-file-name "Run rmail on RMAIL file: " | |
163 nil nil t)))) | |
164 (or rmail-last-file | |
165 (setq rmail-last-file (expand-file-name "~/xmail"))) | |
166 (or rmail-last-rmail-file | |
167 (setq rmail-last-rmail-file (expand-file-name "~/XMAIL"))) | |
168 (let* ((file-name (expand-file-name (or file-name-arg rmail-file-name))) | |
169 (existed (get-file-buffer file-name))) | |
170 ;; Like find-file, but in the case where a buffer existed | |
171 ;; and the file was reverted, recompute the message-data. | |
172 (if (and existed (not (verify-visited-file-modtime existed))) | |
173 (progn | |
174 ;; Don't be confused by apparent local-variables spec | |
175 ;; in the last message in the RMAIL file. | |
1024
ceb4469d3cd7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
997
diff
changeset
|
176 (let ((enable-local-variables nil)) |
270 | 177 (find-file file-name)) |
178 (if (verify-visited-file-modtime existed) | |
179 (progn (rmail-forget-messages) | |
180 (rmail-set-message-counters)))) | |
1024
ceb4469d3cd7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
997
diff
changeset
|
181 (let ((enable-local-variables nil)) |
270 | 182 (find-file file-name))) |
183 (if (and existed (> (buffer-size) 0)) | |
184 ;; Buffer not new and not empty; ensure in proper mode, but that's all. | |
185 (or (eq major-mode 'rmail-mode) | |
186 (rmail-mode-2)) | |
187 (rmail-mode-2) | |
188 ;; Provide default set of inboxes for primary mail file ~/RMAIL. | |
189 (and (null rmail-inbox-list) | |
190 (null file-name-arg) | |
191 (setq rmail-inbox-list | |
192 (or rmail-primary-inbox-list | |
193 (list "~/mbox" | |
194 (or (getenv "MAIL") | |
195 (concat rmail-spool-directory | |
196 (user-original-login-name))))))) | |
197 ;; Convert all or part to Babyl file if possible. | |
198 (rmail-convert-file) | |
199 (goto-char (point-max)) | |
200 (if (null rmail-inbox-list) | |
201 (progn | |
202 (rmail-set-message-counters) | |
203 (rmail-show-message)))) | |
1342
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
204 (let ((existing-unseen (rmail-first-unseen-message))) |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
205 (rmail-get-new-mail) |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
206 ;; Show the first unseen message, which might be from a previous session |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
207 ;; or might have been just read in by rmail-get-new-mail. Must |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
208 ;; determine already unseen messages first, as rmail-get-new-mail |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
209 ;; positions on the first new messsage, thus marking it as seen. |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
210 (rmail-show-message existing-unseen)))) |
270 | 211 |
212 ;; Given the value of MAILPATH, return a list of inbox file names. | |
213 ;; This is turned off because it is not clear that the user wants | |
214 ;; all these inboxes to feed into the primary rmail file. | |
215 ; (defun rmail-convert-mailpath (string) | |
216 ; (let (idx list) | |
217 ; (while (setq idx (string-match "[%:]" string)) | |
218 ; (let ((this (substring string 0 idx))) | |
219 ; (setq string (substring string (1+ idx))) | |
220 ; (setq list (cons (if (string-match "%" this) | |
221 ; (substring this 0 (string-match "%" this)) | |
222 ; this) | |
223 ; list)))) | |
224 ; list)) | |
225 | |
226 ; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line | |
227 ; will not cause emacs 18.55 problems. | |
228 | |
229 (defun rmail-convert-file () | |
230 (let (convert) | |
231 (widen) | |
232 (goto-char (point-min)) | |
233 ;; If file doesn't start like a Babyl file, | |
234 ;; convert it to one, by adding a header and converting each message. | |
235 (cond ((looking-at "BABYL OPTIONS:")) | |
236 ((looking-at "Version: 5\n") | |
237 ;; Losing babyl file made by old version of Rmail. | |
238 ;; Just fix the babyl file header; don't make a new one, | |
239 ;; so we don't lose the Labels: file attribute, etc. | |
240 (let ((buffer-read-only nil)) | |
241 (insert "BABYL OPTIONS: -*- rmail -*-\n"))) | |
242 (t | |
243 (setq convert t) | |
244 (rmail-insert-rmail-file-header))) | |
245 ;; If file was not a Babyl file or if there are | |
246 ;; Unix format messages added at the end, | |
247 ;; convert file as necessary. | |
248 (if (or convert | |
249 (progn (goto-char (point-max)) | |
250 (search-backward "\^_") | |
251 (forward-char 1) | |
252 (looking-at "\n*From "))) | |
253 (let ((buffer-read-only nil)) | |
254 (message "Converting to Babyl format...") | |
255 (narrow-to-region (point) (point-max)) | |
256 (rmail-convert-to-babyl-format) | |
257 (message "Converting to Babyl format...done"))))) | |
258 | |
259 ; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line | |
260 ; will not cause emacs 18.55 problems. | |
261 | |
262 (defun rmail-insert-rmail-file-header () | |
263 (let ((buffer-read-only nil)) | |
264 (insert "BABYL OPTIONS: -*- rmail -*- | |
265 Version: 5 | |
266 Labels: | |
267 Note: This is the header of an rmail file. | |
268 Note: If you are seeing it in rmail, | |
269 Note: it means the file has no messages in it.\n\^_"))) | |
270 | |
271 (if rmail-mode-map | |
272 nil | |
273 (setq rmail-mode-map (make-keymap)) | |
274 (suppress-keymap rmail-mode-map) | |
275 (define-key rmail-mode-map "." 'rmail-beginning-of-message) | |
276 (define-key rmail-mode-map " " 'scroll-up) | |
277 (define-key rmail-mode-map "\177" 'scroll-down) | |
278 (define-key rmail-mode-map "n" 'rmail-next-undeleted-message) | |
279 (define-key rmail-mode-map "p" 'rmail-previous-undeleted-message) | |
280 (define-key rmail-mode-map "\en" 'rmail-next-message) | |
281 (define-key rmail-mode-map "\ep" 'rmail-previous-message) | |
282 (define-key rmail-mode-map "\e\C-n" 'rmail-next-labeled-message) | |
283 (define-key rmail-mode-map "\e\C-p" 'rmail-previous-labeled-message) | |
284 (define-key rmail-mode-map "a" 'rmail-add-label) | |
285 (define-key rmail-mode-map "k" 'rmail-kill-label) | |
286 (define-key rmail-mode-map "d" 'rmail-delete-forward) | |
287 (define-key rmail-mode-map "u" 'rmail-undelete-previous-message) | |
288 (define-key rmail-mode-map "x" 'rmail-expunge) | |
289 (define-key rmail-mode-map "s" 'rmail-expunge-and-save) | |
290 (define-key rmail-mode-map "g" 'rmail-get-new-mail) | |
291 (define-key rmail-mode-map "h" 'rmail-summary) | |
292 (define-key rmail-mode-map "\e\C-h" 'rmail-summary) | |
293 (define-key rmail-mode-map "l" 'rmail-summary-by-labels) | |
294 (define-key rmail-mode-map "\e\C-l" 'rmail-summary-by-labels) | |
295 (define-key rmail-mode-map "\e\C-r" 'rmail-summary-by-recipients) | |
296 (define-key rmail-mode-map "\e\C-s" 'rmail-summary-by-regexp) | |
297 (define-key rmail-mode-map "t" 'rmail-toggle-header) | |
298 (define-key rmail-mode-map "m" 'rmail-mail) | |
299 (define-key rmail-mode-map "r" 'rmail-reply) | |
300 (define-key rmail-mode-map "\e\C-m" 'rmail-retry-failure) | |
301 (define-key rmail-mode-map "c" 'rmail-continue) | |
302 (define-key rmail-mode-map "f" 'rmail-forward) | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
303 (define-key rmail-mode-map "\er" 'rmail-search-backwards) |
270 | 304 (define-key rmail-mode-map "\es" 'rmail-search) |
305 (define-key rmail-mode-map "<" 'rmail-first-message) | |
306 (define-key rmail-mode-map ">" 'rmail-last-message) | |
307 (define-key rmail-mode-map "j" 'rmail-show-message) | |
308 (define-key rmail-mode-map "o" 'rmail-output-to-rmail-file) | |
309 (define-key rmail-mode-map "\C-o" 'rmail-output) | |
310 (define-key rmail-mode-map "i" 'rmail-input) | |
311 (define-key rmail-mode-map "q" 'rmail-quit) | |
312 (define-key rmail-mode-map "?" 'describe-mode) | |
313 (define-key rmail-mode-map "w" 'rmail-edit-current-message) | |
314 (define-key rmail-mode-map "e" 'rmail-edit-current-message) | |
315 (define-key rmail-mode-map "\C-d" 'rmail-delete-backward)) | |
316 | |
317 ;; Rmail mode is suitable only for specially formatted data. | |
318 (put 'rmail-mode 'mode-class 'special) | |
319 | |
1382
9b210c7d6c23
* rmail.el (rmail-mode): Make this autoload; we might find a file
Jim Blandy <jimb@redhat.com>
parents:
1372
diff
changeset
|
320 ;;;###autoload |
270 | 321 (defun rmail-mode () |
322 "Rmail Mode is used by \\<rmail-mode-map>\\[rmail] for editing Rmail files. | |
323 All normal editing commands are turned off. | |
324 Instead, these commands are available: | |
325 | |
326 \\[rmail-beginning-of-message] Move point to front of this message (same as \\[beginning-of-buffer]). | |
327 \\[scroll-up] Scroll to next screen of this message. | |
328 \\[scroll-down] Scroll to previous screen of this message. | |
329 \\[rmail-next-undeleted-message] Move to Next non-deleted message. | |
330 \\[rmail-previous-undeleted-message] Move to Previous non-deleted message. | |
331 \\[rmail-next-message] Move to Next message whether deleted or not. | |
332 \\[rmail-previous-message] Move to Previous message whether deleted or not. | |
333 \\[rmail-first-message] Move to the first message in Rmail file. | |
334 \\[rmail-last-message] Move to the last message in Rmail file. | |
335 \\[rmail-show-message] Jump to message specified by numeric position in file. | |
336 \\[rmail-search] Search for string and show message it is found in. | |
337 \\[rmail-delete-forward] Delete this message, move to next nondeleted. | |
338 \\[rmail-delete-backward] Delete this message, move to previous nondeleted. | |
339 \\[rmail-undelete-previous-message] Undelete message. Tries current message, then earlier messages | |
340 till a deleted message is found. | |
341 \\[rmail-expunge] Expunge deleted messages. | |
342 \\[rmail-expunge-and-save] Expunge and save the file. | |
343 \\[rmail-quit] Quit Rmail: expunge, save, then switch to another buffer. | |
344 \\[save-buffer] Save without expunging. | |
345 \\[rmail-get-new-mail] Move new mail from system spool directory or mbox into this file. | |
346 \\[rmail-mail] Mail a message (same as \\[mail-other-window]). | |
347 \\[rmail-continue] Continue composing outgoing message started before. | |
348 \\[rmail-reply] Reply to this message. Like m but initializes some fields. | |
349 \\[rmail-retry-failure] Send this message again. Used on a mailer failure message. | |
350 \\[rmail-forward] Forward this message to another user. | |
351 \\[rmail-output-to-rmail-file] Output this message to an Rmail file (append it). | |
352 \\[rmail-output] Output this message to a Unix-format mail file (append it). | |
353 \\[rmail-input] Input Rmail file. Run Rmail on that file. | |
354 \\[rmail-add-label] Add label to message. It will be displayed in the mode line. | |
355 \\[rmail-kill-label] Kill label. Remove a label from current message. | |
356 \\[rmail-next-labeled-message] Move to Next message with specified label | |
357 (label defaults to last one specified). | |
358 Standard labels: filed, unseen, answered, forwarded, deleted. | |
359 Any other label is present only if you add it with `a'. | |
360 \\[rmail-previous-labeled-message] Move to Previous message with specified label | |
361 \\[rmail-summary] Show headers buffer, with a one line summary of each message. | |
1078
15b4ed20e524
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1024
diff
changeset
|
362 \\[rmail-summary-by-labels] Like \\[rmail-summary] only just messages with particular label(s) are summarized. |
15b4ed20e524
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1024
diff
changeset
|
363 \\[rmail-summary-by-recipients] Like \\[rmail-summary] only just messages with particular recipient(s) are summarized. |
270 | 364 \\[rmail-toggle-header] Toggle header, show Rmail header if unformatted or vice versa. |
365 \\[rmail-edit-current-message] Edit the current message. \\[rmail-cease-edit] to return to Rmail." | |
366 (interactive) | |
367 (rmail-mode-2) | |
368 (rmail-set-message-counters) | |
369 (rmail-show-message)) | |
370 | |
371 (defun rmail-mode-2 () | |
372 (kill-all-local-variables) | |
373 (rmail-mode-1) | |
374 (rmail-variables) | |
375 (run-hooks 'rmail-mode-hook)) | |
376 | |
377 (defun rmail-mode-1 () | |
378 (setq major-mode 'rmail-mode) | |
379 (setq mode-name "RMAIL") | |
380 (setq buffer-read-only t) | |
381 ;; No need to auto save RMAIL files. | |
382 (setq buffer-auto-save-file-name nil) | |
383 (if (boundp 'mode-line-modified) | |
384 (setq mode-line-modified "--- ") | |
385 (setq mode-line-format | |
386 (cons "--- " (cdr (default-value 'mode-line-format))))) | |
387 (use-local-map rmail-mode-map) | |
388 (set-syntax-table text-mode-syntax-table) | |
389 (setq local-abbrev-table text-mode-abbrev-table)) | |
390 | |
391 (defun rmail-variables () | |
392 (make-local-variable 'revert-buffer-function) | |
393 (setq revert-buffer-function 'rmail-revert) | |
394 (make-local-variable 'rmail-last-label) | |
395 (make-local-variable 'rmail-deleted-vector) | |
396 (make-local-variable 'rmail-summary-buffer) | |
397 (make-local-variable 'rmail-summary-vector) | |
398 (make-local-variable 'rmail-current-message) | |
399 (make-local-variable 'rmail-total-messages) | |
400 (make-local-variable 'require-final-newline) | |
401 (setq require-final-newline nil) | |
402 (make-local-variable 'version-control) | |
403 (setq version-control 'never) | |
404 (make-local-variable 'file-precious-flag) | |
405 (setq file-precious-flag t) | |
406 (make-local-variable 'rmail-message-vector) | |
407 (make-local-variable 'rmail-last-file) | |
408 (make-local-variable 'rmail-inbox-list) | |
409 (setq rmail-inbox-list (rmail-parse-file-inboxes)) | |
410 (make-local-variable 'rmail-keywords) | |
411 ;; this gets generated as needed | |
280
e6f9ccb230ad
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
270
diff
changeset
|
412 (setq rmail-keywords nil)) |
270 | 413 |
414 ;; Handle M-x revert-buffer done in an rmail-mode buffer. | |
415 (defun rmail-revert (arg noconfirm) | |
416 (let (revert-buffer-function) | |
417 ;; Call our caller again, but this time it does the default thing. | |
418 (if (revert-buffer arg noconfirm) | |
419 ;; If the user said "yes", and we changed something, | |
420 ;; reparse the messages. | |
421 (progn | |
422 (rmail-convert-file) | |
423 (goto-char (point-max)) | |
424 (rmail-set-message-counters) | |
425 (rmail-show-message))))) | |
426 | |
427 ;; Return a list of files from this buffer's Mail: option. | |
428 ;; Does not assume that messages have been parsed. | |
429 ;; Just returns nil if buffer does not look like Babyl format. | |
430 (defun rmail-parse-file-inboxes () | |
431 (save-excursion | |
432 (save-restriction | |
433 (widen) | |
434 (goto-char 1) | |
435 (cond ((looking-at "BABYL OPTIONS:") | |
436 (search-forward "\n\^_" nil 'move) | |
437 (narrow-to-region 1 (point)) | |
438 (goto-char 1) | |
439 (if (search-forward "\nMail:" nil t) | |
440 (progn | |
441 (narrow-to-region (point) (progn (end-of-line) (point))) | |
442 (goto-char (point-min)) | |
443 (mail-parse-comma-list)))))))) | |
444 | |
445 (defun rmail-expunge-and-save () | |
446 "Expunge and save RMAIL file." | |
447 (interactive) | |
448 (rmail-expunge) | |
449 (save-buffer)) | |
450 | |
451 (defun rmail-quit () | |
452 "Quit out of RMAIL." | |
453 (interactive) | |
454 (rmail-expunge-and-save) | |
455 ;; Don't switch to the summary buffer even if it was recently visible. | |
456 (if rmail-summary-buffer | |
457 (bury-buffer rmail-summary-buffer)) | |
458 (let ((obuf (current-buffer))) | |
459 (switch-to-buffer (other-buffer)) | |
460 (bury-buffer obuf))) | |
461 | |
462 ;;;###autoload | |
463 (defun rmail-input (filename) | |
464 "Run RMAIL on file FILENAME." | |
465 (interactive "FRun rmail on RMAIL file: ") | |
466 (rmail filename)) | |
467 | |
468 | |
469 ;;;; *** Rmail input *** | |
470 | |
471 ;; RLK feature not added in this version: | |
472 ;; argument specifies inbox file or files in various ways. | |
473 | |
474 (defun rmail-get-new-mail (&optional file-name) | |
475 "Move any new mail from this RMAIL file's inbox files. | |
476 The inbox files can be specified with the file's Mail: option. The | |
477 variable `rmail-primary-inbox-list' specifies the inboxes for your | |
478 primary RMAIL file if it has no Mail: option. These are normally your | |
479 ~/mbox and your /usr/spool/mail/$USER. | |
480 | |
481 You can also specify the file to get new mail from. In this case, the | |
482 file of new mail is not changed or deleted. Noninteractively, you can | |
483 pass the inbox file name as an argument. Interactively, a prefix | |
484 argument causes us to read a file name and use that file as the inbox." | |
485 (interactive | |
486 (list (if current-prefix-arg | |
487 (read-file-name "Get new mail from file: ")))) | |
488 (or (verify-visited-file-modtime (current-buffer)) | |
489 (progn | |
490 (find-file (buffer-file-name)) | |
491 (if (verify-visited-file-modtime (current-buffer)) | |
492 (rmail-forget-messages)))) | |
493 (rmail-maybe-set-message-counters) | |
494 (widen) | |
495 ;; Get rid of all undo records for this buffer. | |
496 (or (eq buffer-undo-list t) | |
497 (setq buffer-undo-list nil)) | |
498 (unwind-protect | |
499 (let ((opoint (point)) | |
500 (new-messages 0) | |
501 (delete-files ()) | |
502 ;; If buffer has not changed yet, and has not been saved yet, | |
503 ;; don't replace the old backup file now. | |
504 (make-backup-files (and make-backup-files (buffer-modified-p))) | |
505 (buffer-read-only nil) | |
506 ;; Don't make undo records for what we do in getting mail. | |
507 (buffer-undo-list t)) | |
508 (goto-char (point-max)) | |
509 (skip-chars-backward " \t\n") ; just in case of brain damage | |
510 (delete-region (point) (point-max)) ; caused by require-final-newline | |
511 (save-excursion | |
512 (save-restriction | |
513 (narrow-to-region (point) (point)) | |
514 ;; Read in the contents of the inbox files, | |
515 ;; renaming them as necessary, | |
516 ;; and adding to the list of files to delete eventually. | |
517 (if file-name | |
518 (rmail-insert-inbox-text (list file-name) nil) | |
519 (setq delete-files (rmail-insert-inbox-text rmail-inbox-list t))) | |
520 ;; Scan the new text and convert each message to babyl format. | |
521 (goto-char (point-min)) | |
522 (save-excursion | |
523 (setq new-messages (rmail-convert-to-babyl-format))) | |
524 (or (zerop new-messages) | |
525 (let (success) | |
526 (widen) | |
527 (search-backward "\n\^_") | |
528 (narrow-to-region (point) (point-max)) | |
529 (goto-char (1+ (point-min))) | |
530 (rmail-count-new-messages) | |
531 (save-buffer))) | |
532 ;; Delete the old files, now that babyl file is saved. | |
533 (while delete-files | |
534 (condition-case () | |
1165 | 535 ;; First, try deleting. |
536 (condition-case () | |
537 (delete-file (car delete-files)) | |
538 (file-error | |
539 ;; If we can't delete it, truncate it. | |
540 (write-region (point) (point) (car delete-files)))) | |
270 | 541 (file-error nil)) |
542 (setq delete-files (cdr delete-files))))) | |
543 (if (= new-messages 0) | |
544 (progn (goto-char opoint) | |
545 (if (or file-name rmail-inbox-list) | |
546 (message "(No new mail has arrived)"))) | |
547 (message "%d new message%s read" | |
548 new-messages (if (= 1 new-messages) "" "s")) | |
549 (and (boundp 'display-time-string) | |
550 (string-match " Mail" display-time-string) | |
551 (setq display-time-string | |
552 (concat | |
553 (substring display-time-string 0 (match-beginning 0)) | |
554 (substring display-time-string (match-end 0)))) | |
555 (force-mode-line-update 'all)))) | |
556 ;; Don't leave the buffer screwed up if we get a disk-full error. | |
557 (rmail-show-message))) | |
558 | |
559 (defun rmail-insert-inbox-text (files renamep) | |
560 (let (file tofile delete-files movemail) | |
561 (while files | |
562 (setq file (expand-file-name (substitute-in-file-name (car files))) | |
563 ;;>> un*x specific << | |
813 | 564 ;; The "+" used to be "~", which is an extremely poor choice; |
565 ;; it might accidentally be deleted when space is low | |
566 ;; (as happened to me!). | |
567 tofile (concat file "+")) | |
270 | 568 ;; If getting from mail spool directory, |
569 ;; use movemail to move rather than just renaming, | |
570 ;; so as to interlock with the mailer. | |
571 (setq movemail (equal (file-name-directory file) rmail-spool-directory)) | |
572 (if movemail | |
573 (progn | |
574 (setq tofile (expand-file-name | |
575 ;; Generate name to move to from inbox name, | |
576 ;; in case of multiple inboxes that need moving. | |
577 (concat ".newmail-" (file-name-nondirectory file)) | |
578 (file-name-directory | |
579 (expand-file-name rmail-file-name)))) | |
580 ;; On some systems, /usr/spool/mail/foo is a directory | |
581 ;; and the actual inbox is /usr/spool/mail/foo/foo. | |
582 (if (file-directory-p file) | |
583 (setq file (expand-file-name (user-original-login-name) | |
584 file))))) | |
1161 | 585 (if (or (and (file-exists-p tofile) |
586 (/= 0 (nth 7 (file-attributes tofile)))) | |
587 (and (file-exists-p file) | |
588 (/= 0 (nth 7 (file-attributes file))))) | |
270 | 589 (message "Getting mail from %s..." file)) |
590 ;; Set TOFILE if have not already done so, and | |
591 ;; rename or copy the file FILE to TOFILE if and as appropriate. | |
592 (cond ((not renamep) | |
593 (setq tofile file)) | |
594 ((or (file-exists-p tofile) (not (file-exists-p file))) | |
595 nil) | |
596 ((not movemail) | |
1165 | 597 (rename-file file tofile nil) |
598 ;; Make the real inbox file empty. | |
599 ;; Leaving it deleted could cause lossage | |
600 ;; because mailers often won't create the file. | |
601 (condition-case () | |
602 (write-region (point) (point) file) | |
603 (file-error nil))) | |
270 | 604 (t |
605 (let ((errors nil)) | |
606 (unwind-protect | |
607 (save-excursion | |
608 (setq errors (generate-new-buffer " *rmail loss*")) | |
609 (buffer-disable-undo errors) | |
610 (call-process | |
611 (expand-file-name "movemail" exec-directory) | |
612 nil errors nil file tofile) | |
613 (if (not (buffer-modified-p errors)) | |
614 ;; No output => movemail won | |
615 nil | |
616 (set-buffer errors) | |
617 (subst-char-in-region (point-min) (point-max) | |
618 ?\n ?\ ) | |
619 (goto-char (point-max)) | |
620 (skip-chars-backward " \t") | |
621 (delete-region (point) (point-max)) | |
622 (goto-char (point-min)) | |
623 (if (looking-at "movemail: ") | |
624 (delete-region (point-min) (match-end 0))) | |
625 (beep t) | |
626 (message (concat "movemail: " | |
627 (buffer-substring (point-min) | |
628 (point-max)))) | |
629 (sit-for 3) | |
630 nil)) | |
631 (if errors (kill-buffer errors)))))) | |
632 ;; At this point, TOFILE contains the name to read: | |
633 ;; Either the alternate name (if we renamed) | |
634 ;; or the actual inbox (if not renaming). | |
635 (if (file-exists-p tofile) | |
636 (let (size) | |
637 (goto-char (point-max)) | |
638 (setq size (nth 1 (insert-file-contents tofile))) | |
639 (goto-char (point-max)) | |
640 (or (= (preceding-char) ?\n) | |
641 (zerop size) | |
642 (insert ?\n)) | |
643 (setq delete-files (cons tofile delete-files)))) | |
644 (message "") | |
645 (setq files (cdr files))) | |
646 delete-files)) | |
647 | |
648 ;; the rmail-break-forwarded-messages feature is not implemented | |
649 (defun rmail-convert-to-babyl-format () | |
650 (let ((count 0) start | |
402
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
651 (case-fold-search nil) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
652 (invalid-input-resync |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
653 (function (lambda () |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
654 (message "Invalid Babyl format in inbox!") |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
655 (sit-for 1) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
656 ;; Try to get back in sync with a real message. |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
657 (if (re-search-forward |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
658 (concat mmdf-delim1 "\\|^From") nil t) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
659 (beginning-of-line) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
660 (goto-char (point-max))))))) |
270 | 661 (goto-char (point-min)) |
662 (save-restriction | |
663 (while (not (eobp)) | |
664 (cond ((looking-at "BABYL OPTIONS:");Babyl header | |
402
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
665 (if (search-forward "\n\^_" nil t) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
666 ;; If we find the proper terminator, delete through there. |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
667 (delete-region (point-min) (point)) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
668 (funcall invalid-input-resync) |
405
698d5d6e8f8b
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
403
diff
changeset
|
669 (delete-region (point-min) (point)))) |
270 | 670 ;; Babyl format message |
671 ((looking-at "\^L") | |
672 (or (search-forward "\n\^_" nil t) | |
402
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
673 (funcall invalid-input-resync)) |
270 | 674 (setq count (1+ count)) |
675 ;; Make sure there is no extra white space after the ^_ | |
676 ;; at the end of the message. | |
677 ;; Narrowing will make sure that whatever follows the junk | |
678 ;; will be treated properly. | |
679 (delete-region (point) | |
680 (save-excursion | |
681 (skip-chars-forward " \t\n") | |
682 (point))) | |
683 (narrow-to-region (point) (point-max))) | |
684 ;;*** MMDF format | |
685 ((let ((case-fold-search t)) | |
686 (looking-at mmdf-delim1)) | |
687 (let ((case-fold-search t)) | |
688 (replace-match "\^L\n0, unseen,,\n*** EOOH ***\n") | |
689 (setq start (point)) | |
690 (re-search-forward mmdf-delim2 nil t) | |
691 (replace-match "\^_")) | |
692 (save-excursion | |
693 (save-restriction | |
694 (narrow-to-region start (1- (point))) | |
695 (goto-char (point-min)) | |
696 (while (search-forward "\n\^_" nil t); single char "\^_" | |
697 (replace-match "\n^_")))); 2 chars: "^" and "_" | |
698 (narrow-to-region (point) (point-max)) | |
699 (setq count (1+ count))) | |
700 ;;*** Mail format | |
701 ((looking-at "^From ") | |
702 (setq start (point)) | |
703 (insert "\^L\n0, unseen,,\n*** EOOH ***\n") | |
704 (rmail-nuke-pinhead-header) | |
705 (if (re-search-forward | |
706 (concat "^[\^_]?\\(" | |
617 | 707 rmail-unix-mail-delimiter |
708 "\\|" | |
270 | 709 mmdf-delim1 "\\|" |
710 "^BABYL OPTIONS:\\|" | |
711 "\^L\n[01],\\)") nil t) | |
712 (goto-char (match-beginning 1)) | |
713 (goto-char (point-max))) | |
714 (setq count (1+ count)) | |
715 (save-excursion | |
716 (save-restriction | |
717 (narrow-to-region start (point)) | |
718 (goto-char (point-min)) | |
719 (while (search-forward "\n\^_" nil t); single char | |
720 (replace-match "\n^_")))); 2 chars: "^" and "_" | |
721 (insert ?\^_) | |
722 (narrow-to-region (point) (point-max))) | |
723 ;; | |
724 ;;This is a kludge, in case we're wrong about mmdf not | |
725 ;;allowing anything in between. If it loses, we'll have | |
726 ;;to look for something else | |
405
698d5d6e8f8b
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
403
diff
changeset
|
727 (t (error "Cannot convert to babyl format"))))) |
270 | 728 count)) |
729 | |
730 ;; Delete the "From ..." line, creating various other headers with | |
731 ;; information from it if they don't already exist. Now puts the | |
732 ;; original line into a mail-from: header line for debugging. | |
733 (defun rmail-nuke-pinhead-header () | |
734 (save-excursion | |
735 (save-restriction | |
736 (let ((start (point)) | |
737 (end (progn | |
738 (condition-case () | |
739 (search-forward "\n\n") | |
740 (error | |
741 (goto-char (point-max)) | |
742 (insert "\n\n"))) | |
743 (point))) | |
744 has-from has-date) | |
745 (narrow-to-region start end) | |
746 (let ((case-fold-search t)) | |
747 (goto-char start) | |
748 (setq has-from (search-forward "\nFrom:" nil t)) | |
749 (goto-char start) | |
750 (setq has-date (and (search-forward "\nDate:" nil t) (point))) | |
751 (goto-char start)) | |
752 (let ((case-fold-search nil)) | |
617 | 753 (if (re-search-forward (concat "^" rmail-unix-mail-delimiter) nil t) |
270 | 754 (replace-match |
755 (concat | |
756 "Mail-from: \\&" | |
757 ;; Keep and reformat the date if we don't | |
758 ;; have a Date: field. | |
759 (if has-date | |
760 "" | |
1112 | 761 (concat |
762 "Date: \\3, \\5 \\4 \\9 \\6 " | |
763 | |
764 ;; The timezone could be matched by group 7 or group 10. | |
765 ;; If neither of them matched, assume EST, since only | |
766 ;; Easterners would be so sloppy. | |
767 ;; It's a shame the substitution can't use "\\10". | |
768 (cond | |
769 ((/= (match-beginning 7) (match-end 7)) "\\7") | |
770 ((/= (match-beginning 10) (match-end 10)) | |
771 (buffer-substring (match-beginning 10) | |
772 (match-end 10))) | |
773 (t "EST")) | |
774 "\n")) | |
270 | 775 ;; Keep and reformat the sender if we don't |
776 ;; have a From: field. | |
777 (if has-from | |
778 "" | |
779 "From: \\1\n"))))))))) | |
780 | |
781 ;;;; *** Rmail Message Formatting and Header Manipulation *** | |
782 | |
783 (defun rmail-reformat-message (beg end) | |
784 (goto-char beg) | |
785 (forward-line 1) | |
786 (if (/= (following-char) ?0) | |
787 (error "Bad format in RMAIL file.")) | |
788 (let ((buffer-read-only nil) | |
789 (delta (- (buffer-size) end))) | |
790 (delete-char 1) | |
791 (insert ?1) | |
792 (forward-line 1) | |
793 (if (looking-at "Summary-line: ") | |
794 (forward-line 1)) | |
795 (if (looking-at "\\*\\*\\* EOOH \\*\\*\\*\n") | |
796 (delete-region (point) | |
797 (progn (forward-line 1) (point)))) | |
798 (let ((str (buffer-substring (point) | |
799 (save-excursion (search-forward "\n\n" end 'move) | |
800 (point))))) | |
801 (insert str "*** EOOH ***\n") | |
802 (narrow-to-region (point) (- (buffer-size) delta))) | |
803 (goto-char (point-min)) | |
804 (if rmail-ignored-headers (rmail-clear-headers)) | |
805 (if rmail-message-filter (funcall rmail-message-filter)))) | |
806 | |
807 (defun rmail-clear-headers () | |
808 (if (search-forward "\n\n" nil t) | |
809 (save-restriction | |
810 (narrow-to-region (point-min) (point)) | |
811 (let ((buffer-read-only nil)) | |
812 (while (let ((case-fold-search t)) | |
813 (goto-char (point-min)) | |
814 (re-search-forward rmail-ignored-headers nil t)) | |
815 (beginning-of-line) | |
816 (delete-region (point) | |
817 (progn (re-search-forward "\n[^ \t]") | |
818 (forward-char -1) | |
819 (point)))))))) | |
820 | |
821 (defun rmail-toggle-header () | |
822 "Show original message header if pruned header currently shown, or vice versa." | |
823 (interactive) | |
824 (rmail-maybe-set-message-counters) | |
825 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max)) | |
826 (let ((buffer-read-only nil)) | |
827 (goto-char (point-min)) | |
828 (forward-line 1) | |
829 (if (= (following-char) ?1) | |
830 (progn (delete-char 1) | |
831 (insert ?0) | |
832 (forward-line 1) | |
833 (if (looking-at "Summary-Line:") | |
834 (forward-line 1)) | |
835 (insert "*** EOOH ***\n") | |
836 (forward-char -1) | |
837 (search-forward "\n*** EOOH ***\n") | |
838 (forward-line -1) | |
839 (let ((temp (point))) | |
840 (and (search-forward "\n\n" nil t) | |
841 (delete-region temp (point)))) | |
842 (goto-char (point-min)) | |
843 (search-forward "\n*** EOOH ***\n") | |
844 (narrow-to-region (point) (point-max))) | |
845 (rmail-reformat-message (point-min) (point-max))))) | |
846 | |
847 ;;;; *** Rmail Attributes and Keywords *** | |
848 | |
849 ;; Make a string describing current message's attributes and keywords | |
850 ;; and set it up as the name of a minor mode | |
851 ;; so it will appear in the mode line. | |
852 (defun rmail-display-labels () | |
853 (let ((blurb "") (beg (point-min-marker)) (end (point-max-marker))) | |
854 (save-excursion | |
855 (unwind-protect | |
856 (progn | |
857 (widen) | |
858 (goto-char (rmail-msgbeg rmail-current-message)) | |
859 (forward-line 1) | |
860 (if (looking-at "[01],") | |
861 (progn | |
862 (narrow-to-region (point) (progn (end-of-line) (point))) | |
863 ;; Truly valid BABYL format requires a space before each | |
864 ;; attribute or keyword name. Put them in if missing. | |
865 (let (buffer-read-only) | |
866 (goto-char (point-min)) | |
867 (while (search-forward "," nil t) | |
868 (or (looking-at "[ ,]") (eobp) | |
869 (insert " ")))) | |
870 (goto-char (point-max)) | |
871 (if (search-backward ",," nil 'move) | |
872 (progn | |
873 (if (> (point) (1+ (point-min))) | |
874 (setq blurb (buffer-substring (+ 1 (point-min)) (point)))) | |
875 (if (> (- (point-max) (point)) 2) | |
876 (setq blurb | |
877 (concat blurb | |
878 ";" | |
879 (buffer-substring (+ (point) 3) | |
880 (1- (point-max))))))))))) | |
881 ;; Note: we don't use save-restriction because that does not work right | |
882 ;; if changes are made outside the saved restriction | |
883 ;; before that restriction is restored. | |
884 (narrow-to-region beg end) | |
885 (set-marker beg nil) | |
886 (set-marker end nil))) | |
887 (while (string-match " +," blurb) | |
888 (setq blurb (concat (substring blurb 0 (match-beginning 0)) "," | |
889 (substring blurb (match-end 0))))) | |
890 (while (string-match ", +" blurb) | |
891 (setq blurb (concat (substring blurb 0 (match-beginning 0)) "," | |
892 (substring blurb (match-end 0))))) | |
893 (setq mode-line-process | |
894 (concat " " rmail-current-message "/" rmail-total-messages | |
895 blurb)))) | |
896 | |
897 ;; Turn an attribute of a message on or off according to STATE. | |
898 ;; ATTR is the name of the attribute, as a string. | |
899 ;; MSGNUM is message number to change; nil means current message. | |
900 (defun rmail-set-attribute (attr state &optional msgnum) | |
901 (let ((omax (point-max-marker)) | |
902 (omin (point-min-marker)) | |
903 (buffer-read-only nil)) | |
904 (or msgnum (setq msgnum rmail-current-message)) | |
905 (unwind-protect | |
906 (save-excursion | |
907 (widen) | |
908 (goto-char (+ 3 (rmail-msgbeg msgnum))) | |
909 (let ((curstate | |
910 (not | |
911 (null (search-backward (concat ", " attr ",") | |
912 (prog1 (point) (end-of-line)) t))))) | |
913 (or (eq curstate (not (not state))) | |
914 (if curstate | |
915 (delete-region (point) (1- (match-end 0))) | |
916 (beginning-of-line) | |
917 (forward-char 2) | |
918 (insert " " attr ",")))) | |
919 (if (string= attr "deleted") | |
920 (rmail-set-message-deleted-p msgnum state))) | |
921 ;; Note: we don't use save-restriction because that does not work right | |
922 ;; if changes are made outside the saved restriction | |
923 ;; before that restriction is restored. | |
924 (narrow-to-region omin omax) | |
925 (set-marker omin nil) | |
926 (set-marker omax nil) | |
927 (if (= msgnum rmail-current-message) | |
928 (rmail-display-labels))))) | |
929 | |
930 ;; Return t if the attributes/keywords line of msg number MSG | |
931 ;; contains a match for the regexp LABELS. | |
932 (defun rmail-message-labels-p (msg labels) | |
933 (save-excursion | |
934 (save-restriction | |
935 (widen) | |
936 (goto-char (rmail-msgbeg msg)) | |
937 (forward-char 3) | |
938 (re-search-backward labels (prog1 (point) (end-of-line)) t)))) | |
939 | |
940 ;;;; *** Rmail Message Selection And Support *** | |
941 | |
942 (defun rmail-msgend (n) | |
943 (marker-position (aref rmail-message-vector (1+ n)))) | |
944 | |
945 (defun rmail-msgbeg (n) | |
946 (marker-position (aref rmail-message-vector n))) | |
947 | |
948 (defun rmail-widen-to-current-msgbeg (function) | |
949 "Call FUNCTION with point at start of internal data of current message. | |
950 Assumes that bounds were previously narrowed to display the message in Rmail. | |
951 The bounds are widened enough to move point where desired, then narrowed | |
952 again afterward. | |
953 | |
954 FUNCTION may not change the visible text of the message, but it may | |
955 change the invisible header text." | |
956 (save-excursion | |
344 | 957 (let ((obeg (- (point-max) (point-min)))) |
270 | 958 (unwind-protect |
959 (progn | |
960 (narrow-to-region (rmail-msgbeg rmail-current-message) | |
961 (point-max)) | |
962 (goto-char (point-min)) | |
963 (funcall function)) | |
964 ;; Note: we don't use save-restriction because that does not work right | |
965 ;; if changes are made outside the saved restriction | |
966 ;; before that restriction is restored. | |
967 ;; Here we assume that changes made by FUNCTION | |
968 ;; occur before the visible region of the message. | |
344 | 969 (narrow-to-region (- (point-max) obeg) (point-max)))))) |
270 | 970 |
971 (defun rmail-forget-messages () | |
972 (unwind-protect | |
973 (if (vectorp rmail-message-vector) | |
974 (let* ((i 0) | |
975 (v rmail-message-vector) | |
976 (n (length v))) | |
977 (while (< i n) | |
978 (move-marker (aref v i) nil) | |
979 (setq i (1+ i))))) | |
980 (setq rmail-message-vector nil) | |
981 (setq rmail-deleted-vector nil))) | |
982 | |
983 (defun rmail-maybe-set-message-counters () | |
984 (if (not (and rmail-deleted-vector | |
985 rmail-message-vector | |
986 rmail-current-message | |
987 rmail-total-messages)) | |
988 (rmail-set-message-counters))) | |
989 | |
990 (defun rmail-count-new-messages (&optional nomsg) | |
991 (let* ((case-fold-search nil) | |
992 (total-messages 0) | |
993 (messages-head nil) | |
994 (deleted-head nil)) | |
995 (or nomsg (message "Counting new messages...")) | |
996 (goto-char (point-max)) | |
997 ;; Put at the end of messages-head | |
998 ;; the entry for message N+1, which marks | |
999 ;; the end of message N. (N = number of messages). | |
1000 (search-backward "\n\^_") | |
1001 (forward-char 1) | |
1002 (setq messages-head (list (point-marker))) | |
1003 (rmail-set-message-counters-counter (point-min)) | |
1004 (setq rmail-current-message (1+ rmail-total-messages)) | |
1005 (setq rmail-total-messages | |
1006 (+ rmail-total-messages total-messages)) | |
1007 (setq rmail-message-vector | |
1008 (vconcat rmail-message-vector (cdr messages-head))) | |
1009 (aset rmail-message-vector | |
1010 rmail-current-message (car messages-head)) | |
1011 (setq rmail-deleted-vector | |
1012 (concat rmail-deleted-vector deleted-head)) | |
1013 (setq rmail-summary-vector | |
1014 (vconcat rmail-summary-vector (make-vector total-messages nil))) | |
1015 (goto-char (point-min)) | |
1016 (or nomsg (message "Counting new messages...done (%d)" total-messages)))) | |
1017 | |
1018 (defun rmail-set-message-counters () | |
1019 (rmail-forget-messages) | |
1020 (save-excursion | |
1021 (save-restriction | |
1022 (widen) | |
1023 (let* ((point-save (point)) | |
1024 (total-messages 0) | |
1025 (messages-after-point) | |
1026 (case-fold-search nil) | |
1027 (messages-head nil) | |
1028 (deleted-head nil)) | |
1029 (message "Counting messages...") | |
1030 (goto-char (point-max)) | |
1031 ;; Put at the end of messages-head | |
1032 ;; the entry for message N+1, which marks | |
1033 ;; the end of message N. (N = number of messages). | |
1034 (search-backward "\n\^_") | |
1035 (forward-char 1) | |
1036 (setq messages-head (list (point-marker))) | |
1037 (rmail-set-message-counters-counter (min (point) point-save)) | |
1038 (setq messages-after-point total-messages) | |
1039 (rmail-set-message-counters-counter) | |
1040 (setq rmail-total-messages total-messages) | |
1041 (setq rmail-current-message | |
1042 (min total-messages | |
1043 (max 1 (- total-messages messages-after-point)))) | |
1044 (setq rmail-message-vector | |
1045 (apply 'vector (cons (point-min-marker) messages-head)) | |
1046 rmail-deleted-vector (concat "D" deleted-head) | |
1047 rmail-summary-vector (make-vector rmail-total-messages nil)) | |
1048 (message "Counting messages...done"))))) | |
1049 | |
1050 (defun rmail-set-message-counters-counter (&optional stop) | |
1051 (while (search-backward "\n\^_\^L\n" stop t) | |
1052 (forward-char 1) | |
1053 (setq messages-head (cons (point-marker) messages-head)) | |
1054 (save-excursion | |
1055 (setq deleted-head | |
1056 (cons (if (search-backward ", deleted," | |
1057 (prog1 (point) | |
1058 (forward-line 2)) | |
1059 t) | |
1060 ?D ?\ ) | |
1061 deleted-head))) | |
1062 (if (zerop (% (setq total-messages (1+ total-messages)) 20)) | |
1063 (message "Counting messages...%d" total-messages)))) | |
1064 | |
1065 (defun rmail-beginning-of-message () | |
1066 "Show current message starting from the beginning." | |
1067 (interactive) | |
1068 (rmail-show-message rmail-current-message)) | |
1069 | |
1070 (defun rmail-show-message (&optional n) | |
1071 "Show message number N (prefix argument), counting from start of file." | |
1072 (interactive "p") | |
1073 (rmail-maybe-set-message-counters) | |
1074 (widen) | |
1075 (if (zerop rmail-total-messages) | |
1076 (progn (narrow-to-region (point-min) (1- (point-max))) | |
1077 (goto-char (point-min)) | |
1078 (setq mode-line-process nil)) | |
1079 (let (blurb) | |
1080 (if (not n) | |
1081 (setq n rmail-current-message) | |
1082 (cond ((<= n 0) | |
1083 (setq n 1 | |
1084 rmail-current-message 1 | |
1085 blurb "No previous message")) | |
1086 ((> n rmail-total-messages) | |
1087 (setq n rmail-total-messages | |
1088 rmail-current-message rmail-total-messages | |
1089 blurb "No following message")) | |
1090 (t | |
1091 (setq rmail-current-message n)))) | |
1092 (let ((beg (rmail-msgbeg n)) | |
1093 (end (rmail-msgend n))) | |
1094 (goto-char beg) | |
1095 (forward-line 1) | |
1096 (if (= (following-char) ?0) | |
1097 (progn | |
1098 (rmail-reformat-message beg end) | |
1099 (rmail-set-attribute "unseen" nil)) | |
1100 (search-forward "\n*** EOOH ***\n" end t) | |
1101 (narrow-to-region (point) end)) | |
1102 (goto-char (point-min)) | |
1103 (rmail-display-labels) | |
1104 (run-hooks 'rmail-show-message-hook) | |
1105 (if blurb | |
1106 (message blurb)))))) | |
1107 | |
1108 (defun rmail-next-message (n) | |
1109 "Show following message whether deleted or not. | |
1110 With prefix arg N, moves forward N messages, or backward if N is negative." | |
1111 (interactive "p") | |
1112 (rmail-maybe-set-message-counters) | |
1113 (rmail-show-message (+ rmail-current-message n))) | |
1114 | |
1115 (defun rmail-previous-message (n) | |
1116 "Show previous message whether deleted or not. | |
1117 With prefix arg N, moves backward N messages, or forward if N is negative." | |
1118 (interactive "p") | |
1119 (rmail-next-message (- n))) | |
1120 | |
1121 (defun rmail-next-undeleted-message (n) | |
1122 "Show following non-deleted message. | |
1123 With prefix arg N, moves forward N non-deleted messages, | |
1124 or backward if N is negative." | |
1125 (interactive "p") | |
1126 (rmail-maybe-set-message-counters) | |
1127 (let ((lastwin rmail-current-message) | |
1128 (current rmail-current-message)) | |
1129 (while (and (> n 0) (< current rmail-total-messages)) | |
1130 (setq current (1+ current)) | |
1131 (if (not (rmail-message-deleted-p current)) | |
1132 (setq lastwin current n (1- n)))) | |
1133 (while (and (< n 0) (> current 1)) | |
1134 (setq current (1- current)) | |
1135 (if (not (rmail-message-deleted-p current)) | |
1136 (setq lastwin current n (1+ n)))) | |
1137 (if (/= lastwin rmail-current-message) | |
1138 (rmail-show-message lastwin)) | |
1139 (if (< n 0) | |
997
894201c58bb8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
937
diff
changeset
|
1140 (message "No previous nondeleted message")) |
270 | 1141 (if (> n 0) |
997
894201c58bb8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
937
diff
changeset
|
1142 (message "No following nondeleted message")))) |
270 | 1143 |
1144 (defun rmail-previous-undeleted-message (n) | |
1145 "Show previous non-deleted message. | |
1146 With prefix argument N, moves backward N non-deleted messages, | |
1147 or forward if N is negative." | |
1148 (interactive "p") | |
1149 (rmail-next-undeleted-message (- n))) | |
1150 | |
1151 (defun rmail-first-message () | |
1152 "Show first message in file." | |
1153 (interactive) | |
1154 (rmail-maybe-set-message-counters) | |
1155 (rmail-show-message 1)) | |
1156 | |
1157 (defun rmail-last-message () | |
1158 "Show last message in file." | |
1159 (interactive) | |
1160 (rmail-maybe-set-message-counters) | |
1161 (rmail-show-message rmail-total-messages)) | |
1162 | |
1163 (defun rmail-what-message () | |
1164 (let ((where (point)) | |
1165 (low 1) | |
1166 (high rmail-total-messages) | |
1167 (mid (/ rmail-total-messages 2))) | |
1168 (while (> (- high low) 1) | |
1169 (if (>= where (rmail-msgbeg mid)) | |
1170 (setq low mid) | |
1171 (setq high mid)) | |
1172 (setq mid (+ low (/ (- high low) 2)))) | |
1173 (if (>= where (rmail-msgbeg high)) high low))) | |
1174 | |
1175 (defvar rmail-search-last-regexp nil) | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1176 (defun rmail-search (regexp &optional n) |
270 | 1177 "Show message containing next match for REGEXP. |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1178 Prefix argument gives repeat count; negative argument means search |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1179 backwards (through earlier messages). |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1180 Interactively, empty argument means use same regexp used last time." |
270 | 1181 (interactive |
1182 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0)) | |
1183 (prompt | |
1184 (concat (if reversep "Reverse " "") "Rmail search (regexp): ")) | |
1185 regexp) | |
1186 (if rmail-search-last-regexp | |
1187 (setq prompt (concat prompt | |
1188 "(default " | |
1189 rmail-search-last-regexp | |
1190 ") "))) | |
1191 (setq regexp (read-string prompt)) | |
1192 (cond ((not (equal regexp "")) | |
1193 (setq rmail-search-last-regexp regexp)) | |
1194 ((not rmail-search-last-regexp) | |
1195 (error "No previous Rmail search string"))) | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1196 (list rmail-search-last-regexp |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1197 (prefix-numeric-value current-prefix-arg)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1198 (or n (setq n 1)) |
270 | 1199 (message "%sRmail search for %s..." |
937
0f082d63bfd6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
874
diff
changeset
|
1200 (if (< n 0) "Reverse " "") |
270 | 1201 regexp) |
1202 (rmail-maybe-set-message-counters) | |
1203 (let ((omin (point-min)) | |
1204 (omax (point-max)) | |
1205 (opoint (point)) | |
1206 win | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1207 (reversep (< n 0)) |
270 | 1208 (msg rmail-current-message)) |
1209 (unwind-protect | |
1210 (progn | |
1211 (widen) | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1212 (while (/= n 0) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1213 ;; Check messages one by one, advancing message number up or down |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1214 ;; but searching forward through each message. |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1215 (if reversep |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1216 (while (and (null win) (> msg 1)) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1217 (goto-char (rmail-msgbeg (setq msg (1- msg)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1218 (setq win (re-search-forward |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1219 regexp (rmail-msgend msg) t))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1220 (while (and (null win) (< msg rmail-total-messages)) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1221 (goto-char (rmail-msgbeg (setq msg (1+ msg)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1222 (setq win (re-search-forward regexp (rmail-msgend msg) t)))) |
937
0f082d63bfd6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
874
diff
changeset
|
1223 (setq n (+ n (if reversep 1 -1))))) |
270 | 1224 (if win |
1225 (progn | |
1226 ;; If this is a reverse search and we found a message, | |
1227 ;; search backward thru this message to position point. | |
1228 (if reversep | |
1229 (progn | |
1230 (goto-char (rmail-msgend msg)) | |
1231 (re-search-backward | |
1232 regexp (rmail-msgbeg msg) t))) | |
1233 (setq win (point)) | |
1234 (rmail-show-message msg) | |
1235 (message "%sRmail search for %s...done" | |
1236 (if reversep "Reverse " "") | |
1237 regexp) | |
1238 (goto-char win)) | |
1239 (goto-char opoint) | |
1240 (narrow-to-region omin omax) | |
1241 (ding) | |
1242 (message "Search failed: %s" regexp))))) | |
1243 | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1244 (defun rmail-search-backwards (regexp &optional n) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1245 "Show message containing previous match for REGEXP. |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1246 Prefix argument gives repeat count; negative argument means search |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1247 forward (through later messages). |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1248 Interactively, empty argument means use same regexp used last time." |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1249 (interactive |
937
0f082d63bfd6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
874
diff
changeset
|
1250 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0)) |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1251 (prompt |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1252 (concat (if reversep "Reverse " "") "Rmail search (regexp): ")) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1253 regexp) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1254 (if rmail-search-last-regexp |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1255 (setq prompt (concat prompt |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1256 "(default " |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1257 rmail-search-last-regexp |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1258 ") "))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1259 (setq regexp (read-string prompt)) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1260 (cond ((not (equal regexp "")) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1261 (setq rmail-search-last-regexp regexp)) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1262 ((not rmail-search-last-regexp) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1263 (error "No previous Rmail search string"))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1264 (list rmail-search-last-regexp |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1265 (prefix-numeric-value current-prefix-arg)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1266 (rmail-search regexp (- (or n -1)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1267 |
270 | 1268 ;; Show the first message which has the `unseen' attribute. |
1269 (defun rmail-first-unseen-message () | |
1360
9cb1a4b90b5c
Cleaned up rmail-first-unseen-message.
Joseph Arceneaux <jla@gnu.org>
parents:
1342
diff
changeset
|
1270 (rmail-maybe-set-message-counters) |
270 | 1271 (let ((current 1) |
1272 found) | |
1273 (save-restriction | |
1274 (widen) | |
1275 (while (and (not found) (< current rmail-total-messages)) | |
1276 (if (rmail-message-labels-p current ", ?\\(unseen\\),") | |
346 | 1277 (setq found current)) |
1278 (setq current (1+ current)))) | |
1342
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
1279 ;; Let the caller show the message. |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
1280 ;; (if found |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
1281 ;; (rmail-show-message found)) |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
1282 found)) |
270 | 1283 |
1284 ;;;; *** Rmail Message Deletion Commands *** | |
1285 | |
1286 (defun rmail-message-deleted-p (n) | |
1287 (= (aref rmail-deleted-vector n) ?D)) | |
1288 | |
1289 (defun rmail-set-message-deleted-p (n state) | |
1290 (aset rmail-deleted-vector n (if state ?D ?\ ))) | |
1291 | |
1292 (defun rmail-delete-message () | |
1293 "Delete this message and stay on it." | |
1294 (interactive) | |
1295 (rmail-set-attribute "deleted" t)) | |
1296 | |
1297 (defun rmail-undelete-previous-message () | |
1298 "Back up to deleted message, select it, and undelete it." | |
1299 (interactive) | |
1300 (let ((msg rmail-current-message)) | |
1301 (while (and (> msg 0) | |
1302 (not (rmail-message-deleted-p msg))) | |
1303 (setq msg (1- msg))) | |
1304 (if (= msg 0) | |
1305 (error "No previous deleted message") | |
1306 (if (/= msg rmail-current-message) | |
1307 (rmail-show-message msg)) | |
1308 (rmail-set-attribute "deleted" nil)))) | |
1309 | |
1310 (defun rmail-delete-forward (&optional backward) | |
1311 "Delete this message and move to next nondeleted one. | |
1312 Deleted messages stay in the file until the \\[rmail-expunge] command is given. | |
819
5bbabfcef929
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
814
diff
changeset
|
1313 With prefix argument, delete and move backward." |
270 | 1314 (interactive "P") |
1315 (rmail-set-attribute "deleted" t) | |
830
d7f1e2db9faf
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
819
diff
changeset
|
1316 (rmail-next-undeleted-message (if backward -1 1))) |
270 | 1317 |
1318 (defun rmail-delete-backward () | |
1319 "Delete this message and move to previous nondeleted one. | |
1320 Deleted messages stay in the file until the \\[rmail-expunge] command is given." | |
1321 (interactive) | |
1322 (rmail-delete-forward t)) | |
1323 | |
1324 (defun rmail-expunge () | |
1325 "Actually erase all deleted messages in the file." | |
1326 (interactive) | |
1327 (message "Expunging deleted messages...") | |
1328 ;; Discard all undo records for this buffer. | |
1329 (or (eq buffer-undo-list t) | |
1330 (setq buffer-undo-list nil)) | |
1331 (rmail-maybe-set-message-counters) | |
1332 (let* ((omax (- (buffer-size) (point-max))) | |
1333 (omin (- (buffer-size) (point-min))) | |
1334 (opoint (if (and (> rmail-current-message 0) | |
1335 (= ?D (aref rmail-deleted-vector rmail-current-message))) | |
1336 0 (- (point) (point-min)))) | |
1337 (messages-head (cons (aref rmail-message-vector 0) nil)) | |
1338 (messages-tail messages-head) | |
1339 ;; Don't make any undo records for the expunging. | |
1340 (buffer-undo-list t) | |
1341 (win)) | |
1342 (unwind-protect | |
1343 (save-excursion | |
1344 (widen) | |
1345 (goto-char (point-min)) | |
1346 (let ((counter 0) | |
1347 (number 1) | |
1348 (total rmail-total-messages) | |
1349 (new-message-number rmail-current-message) | |
1350 (new-summary nil) | |
1351 (buffer-read-only nil) | |
1352 (messages rmail-message-vector) | |
1353 (deleted rmail-deleted-vector) | |
1354 (summary rmail-summary-vector)) | |
1355 (setq rmail-total-messages nil | |
1356 rmail-current-message nil | |
1357 rmail-message-vector nil | |
1358 rmail-deleted-vector nil | |
1359 rmail-summary-vector nil) | |
1360 (while (<= number total) | |
1361 (if (= (aref deleted number) ?D) | |
1362 (progn | |
1363 (delete-region | |
1364 (marker-position (aref messages number)) | |
1365 (marker-position (aref messages (1+ number)))) | |
1366 (move-marker (aref messages number) nil) | |
1367 (if (> new-message-number counter) | |
1368 (setq new-message-number (1- new-message-number)))) | |
1369 (setq counter (1+ counter)) | |
1370 (setq messages-tail | |
1371 (setcdr messages-tail | |
1372 (cons (aref messages number) nil))) | |
1373 (setq new-summary | |
1374 (cons (if (= counter number) (aref summary (1- number))) | |
1375 new-summary))) | |
1376 (if (zerop (% (setq number (1+ number)) 20)) | |
1377 (message "Expunging deleted messages...%d" number))) | |
1378 (setq messages-tail | |
1379 (setcdr messages-tail | |
1380 (cons (aref messages number) nil))) | |
1381 (setq rmail-current-message new-message-number | |
1382 rmail-total-messages counter | |
1383 rmail-message-vector (apply 'vector messages-head) | |
1384 rmail-deleted-vector (make-string (1+ counter) ?\ ) | |
1385 rmail-summary-vector (vconcat (nreverse new-summary)) | |
1386 win t))) | |
1387 (message "Expunging deleted messages...done") | |
1388 (if (not win) | |
1389 (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax))) | |
1390 (rmail-show-message | |
1391 (if (zerop rmail-current-message) 1 nil)) | |
1392 (forward-char opoint)))) | |
1393 | |
1394 ;;;; *** Rmail Mailing Commands *** | |
1395 | |
1396 (defun rmail-mail () | |
1397 "Send mail in another window. While composing the message, use | |
1398 \\[mail-yank-original] to yank the original message into it." | |
1399 (interactive) | |
1400 (mail-other-window nil nil nil nil nil (current-buffer))) | |
1401 | |
1402 (defun rmail-continue () | |
1403 "Continue composing outgoing message previously being composed." | |
1404 (interactive) | |
1405 (mail-other-window t)) | |
1406 | |
1407 (defun rmail-reply (just-sender) | |
1408 "Reply to the current message. | |
1409 Normally include CC: to all other recipients of original message; | |
1410 prefix argument means ignore them. While composing the reply, | |
1411 use \\[mail-yank-original] to yank the original message into it." | |
1412 (interactive "P") | |
1413 (let (from reply-to cc subject date to message-id resent-reply-to) | |
1414 (save-excursion | |
1415 (save-restriction | |
1416 (widen) | |
1417 (goto-char (rmail-msgbeg rmail-current-message)) | |
1418 (forward-line 1) | |
1419 (if (= (following-char) ?0) | |
1420 (narrow-to-region | |
1421 (progn (forward-line 2) | |
1422 (point)) | |
1423 (progn (search-forward "\n\n" (rmail-msgend rmail-current-message) | |
1424 'move) | |
1425 (point))) | |
1426 (narrow-to-region (point) | |
1427 (progn (search-forward "\n*** EOOH ***\n") | |
1428 (beginning-of-line) (point)))) | |
1429 (setq resent-reply-to (mail-fetch-field "resent-reply-to" t) | |
1430 from (mail-fetch-field "from") | |
1431 reply-to (or resent-reply-to | |
1432 (mail-fetch-field "reply-to" nil t) | |
1433 from) | |
1434 cc (cond (just-sender nil) | |
1435 (resent-reply-to (mail-fetch-field "resent-cc" t)) | |
1436 (t (mail-fetch-field "cc" nil t))) | |
1437 subject (or (and resent-reply-to | |
1438 (mail-fetch-field "resent-subject" t)) | |
1439 (mail-fetch-field "subject")) | |
1440 date (cond (resent-reply-to | |
1441 (mail-fetch-field "resent-date" t)) | |
1442 ((mail-fetch-field "date"))) | |
1443 to (cond (resent-reply-to | |
1444 (mail-fetch-field "resent-to" t)) | |
1445 ((mail-fetch-field "to" nil t)) | |
1446 ;((mail-fetch-field "apparently-to")) ack gag barf | |
1447 (t "")) | |
1448 message-id (cond (resent-reply-to | |
1449 (mail-fetch-field "resent-message-id" t)) | |
1450 ((mail-fetch-field "message-id")))))) | |
1451 (and subject | |
1452 (string-match "\\`Re: " subject) | |
1453 (setq subject (substring subject 4))) | |
1454 (mail-other-window nil | |
1455 (mail-strip-quoted-names reply-to) | |
1456 subject | |
1457 (rmail-make-in-reply-to-field from date message-id) | |
1458 (if just-sender | |
1459 nil | |
1460 (let* ((cc-list (rmail-dont-reply-to | |
1461 (mail-strip-quoted-names | |
1462 (if (null cc) to (concat to ", " cc)))))) | |
1463 (if (string= cc-list "") nil cc-list))) | |
1464 (current-buffer) | |
1465 (list (list '(lambda (buf msgnum) | |
1466 (save-excursion | |
1467 (set-buffer buf) | |
1468 (rmail-set-attribute "answered" t msgnum))) | |
1469 (current-buffer) rmail-current-message))))) | |
1470 | |
1471 (defun rmail-make-in-reply-to-field (from date message-id) | |
1472 (cond ((not from) | |
1473 (if message-id | |
1474 message-id | |
1475 nil)) | |
1476 (mail-use-rfc822 | |
1477 (require 'rfc822) | |
1478 (let ((tem (car (rfc822-addresses from)))) | |
1479 (if message-id | |
1480 (if (string-match | |
1481 (regexp-quote (if (string-match "@[^@]*\\'" tem) | |
1482 (substring tem 0 (match-beginning 0)) | |
1483 tem)) | |
1484 message-id) | |
1485 ;; Message-ID is sufficiently informative | |
1486 message-id | |
1487 (concat message-id " (" tem ")")) | |
1488 ;; Use prin1 to fake RFC822 quoting | |
1489 (let ((field (prin1-to-string tem))) | |
1490 (if date | |
1491 (concat field "'s message of " date) | |
1492 field))))) | |
1493 ((let* ((foo "[^][\000-\037\177-\377()<>@,;:\\\" ]+") | |
1494 (bar "[^][\000-\037\177-\377()<>@,;:\\\"]+")) | |
1495 ;; Can't use format because format loses on \000 (unix *^&%*^&%$!!) | |
1496 (or (string-match (concat "\\`[ \t]*\\(" bar | |
1497 "\\)\\(<" foo "@" foo ">\\)?[ \t]*\\'") | |
1498 ;; "Unix Loser <Foo@bar.edu>" => "Unix Loser" | |
1499 from) | |
1500 (string-match (concat "\\`[ \t]*<" foo "@" foo ">[ \t]*(\\(" | |
1501 bar "\\))[ \t]*\\'") | |
1502 ;; "<Bugs@bar.edu>" (Losing Unix) => "Losing Unix" | |
1503 from))) | |
1504 (let ((start (match-beginning 1)) | |
1505 (end (match-end 1))) | |
1506 ;; Trim whitespace which above regexp match allows | |
1507 (while (and (< start end) | |
1508 (memq (aref from start) '(?\t ?\ ))) | |
1509 (setq start (1+ start))) | |
1510 (while (and (< start end) | |
1511 (memq (aref from (1- end)) '(?\t ?\ ))) | |
1512 (setq end (1- end))) | |
1513 (let ((field (substring from start end))) | |
1514 (if date (setq field (concat "message from " field " on " date))) | |
1515 (if message-id | |
1516 ;; "<AA259@bar.edu> (message from Unix Loser on 1-Apr-89)" | |
1517 (concat message-id " (" field ")") | |
1518 field)))) | |
1519 (t | |
1520 ;; If we can't kludge it simply, do it correctly | |
1521 (let ((mail-use-rfc822 t)) | |
1522 (rmail-make-in-reply-to-field from date message-id))))) | |
1523 | |
1524 (defun rmail-forward () | |
1525 "Forward the current message to another user." | |
1526 (interactive) | |
1527 (let ((forward-buffer (current-buffer)) | |
1528 (subject (concat "[" | |
1529 (mail-strip-quoted-names (mail-fetch-field "From")) | |
1530 ": " (or (mail-fetch-field "Subject") "") "]"))) | |
1137
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1531 ;; Turn off the usual actions for initializing the message body |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1532 ;; because we want to get only the text from the failure message. |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1533 (let (mail-signature mail-setup-hook) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1534 ;; If only one window, use it for the mail buffer. |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1535 ;; Otherwise, use another window for the mail buffer |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1536 ;; so that the Rmail buffer remains visible |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1537 ;; and sending the mail will get back to it. |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1538 (if (funcall (if (one-window-p t) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1539 (function mail) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1540 (function mail-other-window)) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1541 nil nil subject nil nil nil |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1542 (list (list (function (lambda (buf msgnum) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1543 (save-excursion |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1544 (set-buffer buf) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1545 (rmail-set-attribute "forwarded" t msgnum)))) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1546 (current-buffer) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1547 rmail-current-message))) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1548 (save-excursion |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1549 (goto-char (point-max)) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1550 (forward-line 1) |
6f2689fa1c37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1135
diff
changeset
|
1551 (insert-buffer forward-buffer)))))) |
270 | 1552 |
1553 (defun rmail-resend (address &optional from comment mail-alias-file) | |
1554 "Resend current message to ADDRESSES. | |
1555 ADDRESSES should be a single address, a a string consisting of several | |
1556 addresses separated by commas, or a list of addresses. | |
1557 | |
1558 Optional FROM is the address to resend the message from, and | |
1559 defaults to the username of the person redistributing the message. | |
1560 Optional COMMENT is a string that will be inserted as a comment in the | |
1561 resent message. | |
1562 Optional ALIAS-FILE is alternate aliases file to be used by sendmail, | |
1563 typically for purposes of moderating a list." | |
1564 (interactive "sResend to: ") | |
1565 (if (not from) (setq from (user-login-name))) | |
1566 (let ((tembuf (generate-new-buffer " sendmail temp")) | |
1567 (mail-header-separator "") | |
1568 (case-fold-search nil) | |
1569 (mailbuf (current-buffer))) | |
1570 (unwind-protect | |
1571 (save-excursion | |
1572 ;;>> Copy message into temp buffer | |
1573 (set-buffer tembuf) | |
1574 (insert-buffer-substring mailbuf) | |
1575 (goto-char (point-min)) | |
1576 ;;>> Insert resent-from: | |
1577 (insert "Resent-From: " from "\n") | |
1578 (insert "Resent-Date: " (current-time-string) "\n") | |
1579 ;;>> Insert resent-to: and bcc if need be. | |
1580 (let ((before (point))) | |
1581 (insert "Resent-To: " (if (stringp address) | |
1582 address | |
1583 (mapconcat 'identity address ",\n\t")) | |
1584 "\n") | |
1585 (expand-mail-aliases before (point))) | |
1586 ;;>> Set up comment, if any. | |
1587 (if (and (sequencep comment) (not (zerop (length comment)))) | |
1588 (let ((before (point)) | |
1589 after) | |
1590 (insert comment) | |
1591 (or (eolp) (insert "\n")) | |
1592 (setq after (point)) | |
1593 (goto-char before) | |
1594 (while (< (point) after) | |
1595 (insert "Resent-Comment: ") | |
1596 (forward-line 1)))) | |
1597 ;; Don't expand aliases in the destination fields | |
1598 ;; of the original message. | |
1599 (let (mail-aliases) | |
1600 (sendmail-send-it))) | |
1601 (kill-buffer tembuf)))) | |
1602 | |
1267
1e1a54ebb29b
(mail-unsent-separator): Add another alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1165
diff
changeset
|
1603 (defvar mail-unsent-separator |
1370
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1604 (concat "^ *---+ +Unsent message follows +---+ *$\\|" |
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1605 "^ *---+ +Returned message +---+ *$\\|" |
1372
e839dc00fc2e
(mail-unsent-separator): Handle "Message text follows".
Richard M. Stallman <rms@gnu.org>
parents:
1370
diff
changeset
|
1606 "^ *---+ +Original message +---+ *$\\|" |
e839dc00fc2e
(mail-unsent-separator): Handle "Message text follows".
Richard M. Stallman <rms@gnu.org>
parents:
1370
diff
changeset
|
1607 "^|? *---+ +Message text follows: +---+ *|?$")) |
270 | 1608 |
1609 (defun rmail-retry-failure () | |
1610 "Edit a mail message which is based on the contents of the current message. | |
1611 For a message rejected by the mail system, extract the interesting headers and | |
1612 the body of the original message; otherwise copy the current message." | |
1613 (interactive) | |
1614 (require 'mail-utils) | |
1615 (let (to subj irp2 cc orig-message) | |
1616 (save-excursion | |
1617 ;; Narrow down to just the quoted original message | |
1618 (rmail-beginning-of-message) | |
1370
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1619 (let ((case-fold-search t)) |
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1620 (or (re-search-forward mail-unsent-separator nil t) |
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1621 (error "Cannot parse this as a failure message"))) |
270 | 1622 (save-restriction |
1623 (narrow-to-region (point) (point-max)) | |
1624 ;; Now mail-fetch-field will get from headers of the original message, | |
1625 ;; not from the headers of the rejection. | |
1626 (setq to (mail-fetch-field "To") | |
1627 subj (mail-fetch-field "Subject") | |
1628 irp2 (mail-fetch-field "In-reply-to") | |
1629 cc (mail-fetch-field "Cc")) | |
1630 ;; Get the entire text (not headers) of the original message. | |
1631 (setq orig-message | |
1632 (buffer-substring | |
1633 (progn (search-forward "\n\n") (point)) | |
1634 (point-max))))) | |
1635 ;; Start sending a new message; default header fields from the original. | |
1135
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1636 ;; Turn off the usual actions for initializing the message body |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1637 ;; because we want to get only the text from the failure message. |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1638 (let (mail-signature mail-setup-hook) |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1639 (if (mail-other-window nil to subj irp2 cc (current-buffer)) |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1640 ;; Insert original text as initial text of new draft message. |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1641 (progn |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1642 (goto-char (point-max)) |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1643 (insert orig-message) |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1644 (goto-char (point-min)) |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1645 (end-of-line)))))) |
270 | 1646 |
1647 ;;;; *** Rmail Specify Inbox Files *** | |
1648 | |
1649 (autoload 'set-rmail-inbox-list "rmailmsc" | |
1650 "Set the inbox list of the current RMAIL file to FILE-NAME. | |
1651 This may be a list of file names separated by commas. | |
1652 If FILE-NAME is empty, remove any inbox list." | |
1653 t) | |
1654 | |
1655 ;;;; *** Rmail Commands for Labels *** | |
1656 | |
1657 (autoload 'rmail-add-label "rmailkwd" | |
1658 "Add LABEL to labels associated with current RMAIL message. | |
1659 Completion is performed over known labels when reading." | |
1660 t) | |
1661 | |
1662 (autoload 'rmail-kill-label "rmailkwd" | |
1663 "Remove LABEL from labels associated with current RMAIL message. | |
1664 Completion is performed over known labels when reading." | |
1665 t) | |
1666 | |
1667 (autoload 'rmail-next-labeled-message "rmailkwd" | |
1668 "Show next message with LABEL. Defaults to last label used. | |
1669 With prefix argument N moves forward N messages with this label." | |
1670 t) | |
1671 | |
1672 (autoload 'rmail-previous-labeled-message "rmailkwd" | |
1673 "Show previous message with LABEL. Defaults to last label used. | |
1674 With prefix argument N moves backward N messages with this label." | |
1675 t) | |
1676 | |
1677 ;;;; *** Rmail Edit Mode *** | |
1678 | |
1679 (autoload 'rmail-edit-current-message "rmailedit" | |
1680 "Edit the contents of the current message" | |
1681 t) | |
1682 | |
1683 ;;;; *** Rmail Summary Mode *** | |
1684 | |
1685 (autoload 'rmail-summary "rmailsum" | |
1686 "Display a summary of all messages, one line per message." | |
1687 t) | |
1688 | |
1689 (autoload 'rmail-summary-by-labels "rmailsum" | |
1690 "Display a summary of all messages with one or more LABELS. | |
1691 LABELS should be a string containing the desired labels, separated by commas." | |
1692 t) | |
1693 | |
1694 (autoload 'rmail-summary-by-recipients "rmailsum" | |
1695 "Display a summary of all messages with the given RECIPIENTS. | |
1696 Normally checks the To, From and Cc fields of headers; but if PRIMARY-ONLY | |
1697 is non-nil (prefix arg given), only look in the To and From fields. | |
1698 RECIPIENTS is a string of names separated by commas." | |
1699 t) | |
1700 | |
1701 ;;;; *** Rmail output messages to files *** | |
1702 | |
1703 (autoload 'rmail-output-to-rmail-file "rmailout" | |
1704 "Append the current message to an Rmail file named FILE-NAME. | |
1705 If the file does not exist, ask if it should be created. | |
1706 If file is being visited, the message is appended to the Emacs | |
1707 buffer visiting that file." | |
1708 t) | |
1709 | |
1710 (autoload 'rmail-output "rmailout" | |
1711 "Append this message to Unix mail file named FILE-NAME." | |
1712 t) | |
1713 | |
1714 ;;;; *** Rmail undigestification *** | |
1715 | |
1716 (autoload 'undigestify-rmail-message "undigest" | |
1717 "Break up a digest message into its constituent messages. | |
1718 Leaves original message, deleted, before the undigestified messages." | |
1719 t) | |
584 | 1720 |
1721 (provide 'rmail) | |
1722 | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
1723 ;;; rmail.el ends here |