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