Mercurial > emacs
annotate lisp/mail/rmail.el @ 5274:89b71a85be3e
(rmail-quit): Expunge without updating summary.
(rmail-resend): Delete more than one Sender,
but only in the headers, not in the body.
(rmail-resend): Doc fix.
(rmail): Doc fix.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 23 Dec 1993 03:24:31 +0000 |
parents | 3fb665ab94c1 |
children | 2c747b081be1 |
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 |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
3 ;; Copyright (C) 1985, 1986, 1987, 1988, 1993 Free Software Foundation, Inc. |
846
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 | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
31 ;; Extended by Bob Weiner of Motorola |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
32 ;; New features include: rmail and rmail-summary buffers remain |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
33 ;; synchronized and key bindings basically operate the same way in both |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
34 ;; buffers, summary by topic or by regular expression, rmail-reply-prefix |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
35 ;; variable, and a bury rmail buffer (wipe) command. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
36 ;; |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
37 |
270 | 38 (require 'mail-utils) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
39 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
40 ;; For Emacs V18 compatibility |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
41 (and (not (fboundp 'user-original-login-name)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
42 (fboundp 'user-real-login-name) |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2423
diff
changeset
|
43 (defalias 'user-original-login-name 'user-real-login-name)) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
44 (and (not (fboundp 'buffer-disable-undo)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
45 (fboundp 'buffer-flush-undo) |
2571
b65cf676a09b
All fsets changed to defaliases.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2423
diff
changeset
|
46 (defalias 'buffer-disable-undo 'buffer-flush-undo)) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
47 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
48 ; These variables now declared in paths.el. |
270 | 49 ;(defvar rmail-spool-directory "/usr/spool/mail/" |
50 ; "This is the name of the directory used by the system mailer for\n\ | |
51 ;delivering new mail. It's name should end with a slash.") | |
52 ;(defvar rmail-file-name | |
53 ; (expand-file-name "~/RMAIL") | |
54 ; "") | |
55 | |
56 ;;;###autoload | |
57 (defvar rmail-dont-reply-to-names nil "\ | |
58 *A regexp specifying names to prune of reply to messages. | |
3931 | 59 A value of nil means exclude your own name only.") |
270 | 60 |
61 ;;;###autoload | |
62 (defvar rmail-default-dont-reply-to-names "info-" "\ | |
63 A regular expression specifying part of the value of the default value of | |
64 the variable `rmail-dont-reply-to-names', for when the user does not set | |
65 `rmail-dont-reply-to-names' explicitly. (The other part of the default | |
66 value is the user's name.) | |
3931 | 67 It is useful to set this variable in the site customization file.") |
270 | 68 |
69 ;;;###autoload | |
70 (defvar rmail-ignored-headers "^via:\\|^mail-from:\\|^origin:\\|^status:\\|^received:\\|^message-id:\\|^summary-line:" "\ | |
71 *Gubbish headers one would rather not see.") | |
72 | |
73 ;;;###autoload | |
74 (defvar rmail-delete-after-output nil "\ | |
75 *Non-nil means automatically delete a message that is copied to a file.") | |
76 | |
77 ;;;###autoload | |
3631
0c063224b5d2
(rmail-primary-inbox-list): Use defvar, not defconst.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
78 (defvar rmail-primary-inbox-list nil "\ |
2423
5dd3b7338f71
(rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents:
2076
diff
changeset
|
79 *List of files which are inboxes for user's primary mail file `~/RMAIL'. |
5dd3b7338f71
(rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents:
2076
diff
changeset
|
80 `nil' means the default, which is (\"/usr/spool/mail/$USER\") |
5dd3b7338f71
(rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents:
2076
diff
changeset
|
81 \(the name varies depending on the operating system, |
270 | 82 and the value of the environment variable MAIL overrides it).") |
83 | |
4108
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
84 ;;;###autoload |
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
85 (defvar rmail-mail-new-frame nil |
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
86 "*Non-nil means Rmail makes a new frame for composing outgoing mail.") |
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
87 |
4844
25d94807689e
(rmail-retry-setup-hook): New hook variable.
Richard M. Stallman <rms@gnu.org>
parents:
4838
diff
changeset
|
88 ;;;###autoload |
25d94807689e
(rmail-retry-setup-hook): New hook variable.
Richard M. Stallman <rms@gnu.org>
parents:
4838
diff
changeset
|
89 (defvar rmail-retry-setup-hook nil |
25d94807689e
(rmail-retry-setup-hook): New hook variable.
Richard M. Stallman <rms@gnu.org>
parents:
4838
diff
changeset
|
90 "Hook that `rmail-retry-failure' uses in place of `mail-setup-hook'.") |
25d94807689e
(rmail-retry-setup-hook): New hook variable.
Richard M. Stallman <rms@gnu.org>
parents:
4838
diff
changeset
|
91 |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
92 ;; These may be altered by site-init.el to match the format of mmdf files |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
93 ;; delimiting used on a given host (delim1 and delim2 from the config |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
94 ;; files). |
270 | 95 |
96 (defvar mmdf-delim1 "^\001\001\001\001\n" | |
97 "Regexp marking the start of an mmdf message") | |
98 (defvar mmdf-delim2 "^\001\001\001\001\n" | |
99 "Regexp marking the end of an mmdf message") | |
100 | |
101 (defvar rmail-message-filter nil | |
102 "If non nil, is a filter function for new headers in RMAIL. | |
103 Called with region narrowed to unformatted header.") | |
104 | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
105 (defvar rmail-reply-prefix "Re: " |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
106 "String to prepend to Subject line when replying to a message.") |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
107 |
270 | 108 (defvar rmail-mode-map nil) |
109 | |
110 (defvar rmail-inbox-list nil) | |
111 (defvar rmail-keywords nil) | |
112 | |
113 ;; Message counters and markers. Deleted flags. | |
114 | |
115 (defvar rmail-current-message nil) | |
116 (defvar rmail-total-messages nil) | |
117 (defvar rmail-message-vector nil) | |
118 (defvar rmail-deleted-vector nil) | |
119 | |
120 ;; These are used by autoloaded rmail-summary. | |
121 | |
122 (defvar rmail-summary-buffer nil) | |
123 (defvar rmail-summary-vector nil) | |
124 | |
125 ;; `Sticky' default variables. | |
126 | |
127 ;; Last individual label specified to a or k. | |
128 (defvar rmail-last-label nil) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
129 ;; Last set of values specified to C-M-n, C-M-p, C-M-s or C-M-l. |
270 | 130 (defvar rmail-last-multi-labels nil) |
131 (defvar rmail-last-file nil) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
132 (defvar rmail-last-regexp nil) |
4263
7c7fa71cfd6e
(rmail-last-rmail-file): Initialize to a file name.
Richard M. Stallman <rms@gnu.org>
parents:
4108
diff
changeset
|
133 (defvar rmail-last-rmail-file (expand-file-name "~/XMAIL")) |
617 | 134 |
621 | 135 ;;; Regexp matching the delimiter of messages in UNIX mail format |
136 ;;; (UNIX From lines), minus the initial ^. Note that if you change | |
137 ;;; this expression, you must change the code in rmail-nuke-pinhead-header | |
138 ;;; that knows the exact ordering of the \\( \\) subexpressions. | |
617 | 139 (defvar rmail-unix-mail-delimiter |
1112 | 140 (let ((time-zone-regexp |
1704
7e1897c2951b
* rmail.el (rmail-unix-mail-delimiter): Not all time zone names
Jim Blandy <jimb@redhat.com>
parents:
1464
diff
changeset
|
141 (concat "\\([A-Z]?[A-Z][A-Z][A-Z]\\( DST\\)?" |
1112 | 142 "\\|[-+]?[0-9][0-9][0-9][0-9]" |
143 "\\|" | |
144 "\\) *"))) | |
145 (concat | |
146 "From " | |
147 | |
148 ;; Username, perhaps with a quoted section that can contain spaces. | |
149 "\\(" | |
150 "[^ \n]*" | |
151 "\\(\\|\".*\"[^ \n]*\\)" | |
152 "\\) ?" | |
153 | |
154 ;; The time the message was sent. | |
155 "\\([^ \n]*\\) *" ; day of the week | |
156 "\\([^ ]*\\) *" ; month | |
157 "\\([0-9]*\\) *" ; day of month | |
158 "\\([0-9:]*\\) *" ; time of day | |
159 | |
160 ;; Perhaps a time zone, specified by an abbreviation, or by a | |
161 ;; numeric offset. | |
162 time-zone-regexp | |
163 | |
164 ;; The year. | |
165 " [0-9][0-9]\\([0-9]*\\) *" | |
166 | |
167 ;; On some systems the time zone can appear after the year, too. | |
168 time-zone-regexp | |
169 | |
170 ;; I'm not sure what this is. | |
171 "\\(remote from [^\n]*\\)?" | |
172 | |
173 "\n")) | |
174 nil) | |
175 | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
176 ;; Perform BODY in the summary buffer |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
177 ;; in such a way that its cursor is properly updated in its own window. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
178 (defmacro rmail-select-summary (&rest body) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
179 (` (progn (if (rmail-summary-displayed) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
180 (let ((window (selected-window))) |
3462
2624c18df764
(rmail-select-summary): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
3083
diff
changeset
|
181 (save-excursion |
2624c18df764
(rmail-select-summary): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
3083
diff
changeset
|
182 (unwind-protect |
2624c18df764
(rmail-select-summary): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
3083
diff
changeset
|
183 (progn |
2624c18df764
(rmail-select-summary): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
3083
diff
changeset
|
184 (pop-to-buffer rmail-summary-buffer) |
2624c18df764
(rmail-select-summary): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
3083
diff
changeset
|
185 (,@ body)) |
2624c18df764
(rmail-select-summary): Add a save-excursion.
Richard M. Stallman <rms@gnu.org>
parents:
3083
diff
changeset
|
186 (select-window window)))) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
187 (save-excursion |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
188 (set-buffer rmail-summary-buffer) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
189 (progn (,@ body)))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
190 (rmail-maybe-display-summary)))) |
270 | 191 |
192 ;;;; *** Rmail Mode *** | |
193 | |
194 ;;;###autoload | |
195 (defun rmail (&optional file-name-arg) | |
196 "Read and edit incoming mail. | |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
197 Moves messages into file named by `rmail-file-name' (a babyl format file) |
270 | 198 and edits that file in RMAIL Mode. |
199 Type \\[describe-mode] once editing that file, for a list of RMAIL commands. | |
200 | |
5274
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
201 May be called with file name as argument; then performs rmail editing on |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
202 that file, but does not copy any new mail into the file. |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
203 Interactively, if you supply a prefix argument, then you |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
204 have a chance to specify a file name with the minibuffer." |
270 | 205 (interactive (if current-prefix-arg |
206 (list (read-file-name "Run rmail on RMAIL file: " | |
207 nil nil t)))) | |
208 (or rmail-last-file | |
209 (setq rmail-last-file (expand-file-name "~/xmail"))) | |
210 (let* ((file-name (expand-file-name (or file-name-arg rmail-file-name))) | |
211 (existed (get-file-buffer file-name))) | |
212 ;; Like find-file, but in the case where a buffer existed | |
213 ;; and the file was reverted, recompute the message-data. | |
214 (if (and existed (not (verify-visited-file-modtime existed))) | |
215 (progn | |
216 ;; Don't be confused by apparent local-variables spec | |
217 ;; in the last message in the RMAIL file. | |
1024
ceb4469d3cd7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
997
diff
changeset
|
218 (let ((enable-local-variables nil)) |
270 | 219 (find-file file-name)) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
220 (if (and (verify-visited-file-modtime existed) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
221 (eq major-mode 'rmail-mode)) |
270 | 222 (progn (rmail-forget-messages) |
223 (rmail-set-message-counters)))) | |
1024
ceb4469d3cd7
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
997
diff
changeset
|
224 (let ((enable-local-variables nil)) |
270 | 225 (find-file file-name))) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
226 (if (eq major-mode 'rmail-edit-mode) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
227 (error "Exit Rmail Edit mode before getting new mail.")) |
270 | 228 (if (and existed (> (buffer-size) 0)) |
229 ;; Buffer not new and not empty; ensure in proper mode, but that's all. | |
230 (or (eq major-mode 'rmail-mode) | |
231 (rmail-mode-2)) | |
232 (rmail-mode-2) | |
233 ;; Convert all or part to Babyl file if possible. | |
234 (rmail-convert-file) | |
235 (goto-char (point-max)) | |
236 (if (null rmail-inbox-list) | |
237 (progn | |
238 (rmail-set-message-counters) | |
239 (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
|
240 (let ((existing-unseen (rmail-first-unseen-message))) |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
241 (or file-name-arg |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
242 (rmail-get-new-mail)) |
1342
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
243 ;; 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
|
244 ;; 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
|
245 ;; determine already unseen messages first, as rmail-get-new-mail |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3540
diff
changeset
|
246 ;; positions on the first new message, thus marking it as seen. |
1342
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
247 (rmail-show-message existing-unseen)))) |
270 | 248 |
249 ;; Given the value of MAILPATH, return a list of inbox file names. | |
250 ;; This is turned off because it is not clear that the user wants | |
251 ;; all these inboxes to feed into the primary rmail file. | |
252 ; (defun rmail-convert-mailpath (string) | |
253 ; (let (idx list) | |
254 ; (while (setq idx (string-match "[%:]" string)) | |
255 ; (let ((this (substring string 0 idx))) | |
256 ; (setq string (substring string (1+ idx))) | |
257 ; (setq list (cons (if (string-match "%" this) | |
258 ; (substring this 0 (string-match "%" this)) | |
259 ; this) | |
260 ; list)))) | |
261 ; list)) | |
262 | |
263 ; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line | |
264 ; will not cause emacs 18.55 problems. | |
265 | |
266 (defun rmail-convert-file () | |
267 (let (convert) | |
268 (widen) | |
269 (goto-char (point-min)) | |
270 ;; If file doesn't start like a Babyl file, | |
271 ;; convert it to one, by adding a header and converting each message. | |
272 (cond ((looking-at "BABYL OPTIONS:")) | |
273 ((looking-at "Version: 5\n") | |
274 ;; Losing babyl file made by old version of Rmail. | |
275 ;; Just fix the babyl file header; don't make a new one, | |
276 ;; so we don't lose the Labels: file attribute, etc. | |
277 (let ((buffer-read-only nil)) | |
278 (insert "BABYL OPTIONS: -*- rmail -*-\n"))) | |
4764
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
279 ((equal (point-min) (point-max)) |
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
280 ;; Empty RMAIL file. Just insert the header. |
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
281 (rmail-insert-rmail-file-header)) |
270 | 282 (t |
4764
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
283 ;; Non-empty file in non-RMAIL format. Add header and convert. |
270 | 284 (setq convert t) |
285 (rmail-insert-rmail-file-header))) | |
286 ;; If file was not a Babyl file or if there are | |
287 ;; Unix format messages added at the end, | |
288 ;; convert file as necessary. | |
289 (if (or convert | |
4673
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
290 (save-excursion |
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
291 (goto-char (point-max)) |
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
292 (search-backward "\^_") |
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
293 (forward-char 1) |
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
294 (looking-at "\n*From "))) |
270 | 295 (let ((buffer-read-only nil)) |
296 (message "Converting to Babyl format...") | |
4673
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
297 ;; If file needs conversion, convert it all, |
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
298 ;; except for the BABYL header. |
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
299 ;; (rmail-convert-to-babyl-format would delete the header.) |
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
300 (goto-char (point-min)) |
047e8f8469d9
(rmail-convert-file): Exclude the Babyl header
Richard M. Stallman <rms@gnu.org>
parents:
4579
diff
changeset
|
301 (search-forward "\n\^_" nil t) |
4698
196fac1c1086
(rmail-convert-file): Narrow to exclude the Babyl header.
Richard M. Stallman <rms@gnu.org>
parents:
4673
diff
changeset
|
302 (narrow-to-region (point) (point-max)) |
270 | 303 (rmail-convert-to-babyl-format) |
304 (message "Converting to Babyl format...done"))))) | |
305 | |
4764
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
306 ;;; I have checked that adding "-*- rmail -*-" to the BABYL OPTIONS line |
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
307 ;;; will not cause emacs 18.55 problems. |
270 | 308 |
309 (defun rmail-insert-rmail-file-header () | |
310 (let ((buffer-read-only nil)) | |
311 (insert "BABYL OPTIONS: -*- rmail -*- | |
312 Version: 5 | |
313 Labels: | |
314 Note: This is the header of an rmail file. | |
315 Note: If you are seeing it in rmail, | |
316 Note: it means the file has no messages in it.\n\^_"))) | |
317 | |
318 (if rmail-mode-map | |
319 nil | |
320 (setq rmail-mode-map (make-keymap)) | |
321 (suppress-keymap rmail-mode-map) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
322 (define-key rmail-mode-map "a" 'rmail-add-label) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
323 (define-key rmail-mode-map "b" 'rmail-bury) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
324 (define-key rmail-mode-map "c" 'rmail-continue) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
325 (define-key rmail-mode-map "d" 'rmail-delete-forward) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
326 (define-key rmail-mode-map "\C-d" 'rmail-delete-backward) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
327 (define-key rmail-mode-map "e" 'rmail-edit-current-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
328 (define-key rmail-mode-map "f" 'rmail-forward) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
329 (define-key rmail-mode-map "g" 'rmail-get-new-mail) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
330 (define-key rmail-mode-map "h" 'rmail-summary) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
331 (define-key rmail-mode-map "i" 'rmail-input) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
332 (define-key rmail-mode-map "j" 'rmail-show-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
333 (define-key rmail-mode-map "k" 'rmail-kill-label) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
334 (define-key rmail-mode-map "l" 'rmail-summary-by-labels) |
270 | 335 (define-key rmail-mode-map "\e\C-h" 'rmail-summary) |
336 (define-key rmail-mode-map "\e\C-l" 'rmail-summary-by-labels) | |
337 (define-key rmail-mode-map "\e\C-r" 'rmail-summary-by-recipients) | |
338 (define-key rmail-mode-map "\e\C-s" 'rmail-summary-by-regexp) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
339 (define-key rmail-mode-map "\e\C-t" 'rmail-summary-by-topic) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
340 (define-key rmail-mode-map "m" 'rmail-mail) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
341 (define-key rmail-mode-map "\em" 'rmail-retry-failure) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
342 (define-key rmail-mode-map "n" 'rmail-next-undeleted-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
343 (define-key rmail-mode-map "\en" 'rmail-next-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
344 (define-key rmail-mode-map "\e\C-n" 'rmail-next-labeled-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
345 (define-key rmail-mode-map "o" 'rmail-output-to-rmail-file) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
346 (define-key rmail-mode-map "\C-o" 'rmail-output) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
347 (define-key rmail-mode-map "p" 'rmail-previous-undeleted-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
348 (define-key rmail-mode-map "\ep" 'rmail-previous-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
349 (define-key rmail-mode-map "\e\C-p" 'rmail-previous-labeled-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
350 (define-key rmail-mode-map "q" 'rmail-quit) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
351 (define-key rmail-mode-map "r" 'rmail-reply) |
1464
7f25b15a6809
(rmail-mode-map): Delete binding of M-r (use global one).
Richard M. Stallman <rms@gnu.org>
parents:
1382
diff
changeset
|
352 ;; I find I can't live without the default M-r command -- rms. |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
353 ;; (define-key rmail-mode-map "\er" 'rmail-search-backwards) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
354 (define-key rmail-mode-map "s" 'rmail-expunge-and-save) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
355 (define-key rmail-mode-map "\es" 'rmail-search) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
356 (define-key rmail-mode-map "t" 'rmail-toggle-header) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
357 (define-key rmail-mode-map "u" 'rmail-undelete-previous-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
358 (define-key rmail-mode-map "w" 'rmail-edit-current-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
359 (define-key rmail-mode-map "x" 'rmail-expunge) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
360 (define-key rmail-mode-map "." 'rmail-beginning-of-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
361 (define-key rmail-mode-map "<" 'rmail-first-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
362 (define-key rmail-mode-map ">" 'rmail-last-message) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
363 (define-key rmail-mode-map " " 'scroll-up) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
364 (define-key rmail-mode-map "\177" 'scroll-down) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
365 (define-key rmail-mode-map "?" 'describe-mode) |
3877
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
366 (define-key rmail-mode-map "\C-c\C-s\C-d" 'rmail-sort-by-date) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
367 (define-key rmail-mode-map "\C-c\C-s\C-s" 'rmail-sort-by-subject) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
368 (define-key rmail-mode-map "\C-c\C-s\C-a" 'rmail-sort-by-author) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
369 (define-key rmail-mode-map "\C-c\C-s\C-r" 'rmail-sort-by-recipient) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
370 (define-key rmail-mode-map "\C-c\C-s\C-c" 'rmail-sort-by-correspondent) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
371 (define-key rmail-mode-map "\C-c\C-s\C-l" 'rmail-sort-by-lines) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
372 ) |
3863
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
373 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
374 (define-key rmail-mode-map [menu-bar] (make-sparse-keymap)) |
270 | 375 |
3863
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
376 (define-key rmail-mode-map [menu-bar classify] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
377 (cons "Classify" (make-sparse-keymap "Classify"))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
378 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
379 (define-key rmail-mode-map [menu-bar classify output-inbox] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
380 '("Output (inbox)" . rmail-output)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
381 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
382 (define-key rmail-mode-map [menu-bar classify output] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
383 '("Output (Rmail)" . rmail-output-to-rmail-file)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
384 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
385 (define-key rmail-mode-map [menu-bar classify kill-label] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
386 '("Kill Label" . rmail-kill-label)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
387 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
388 (define-key rmail-mode-map [menu-bar classify add-label] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
389 '("Add Label" . rmail-add-label)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
390 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
391 (define-key rmail-mode-map [menu-bar summary] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
392 (cons "Summary" (make-sparse-keymap "Summary"))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
393 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
394 (define-key rmail-mode-map [menu-bar summary labels] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
395 '("By Labels" . rmail-summary-by-labels)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
396 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
397 (define-key rmail-mode-map [menu-bar summary recipients] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
398 '("By Recipients" . rmail-summary-by-recipients)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
399 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
400 (define-key rmail-mode-map [menu-bar summary topic] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
401 '("By Topic" . rmail-summary-by-topic)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
402 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
403 (define-key rmail-mode-map [menu-bar summary regexp] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
404 '("By Regexp" . rmail-summary-by-regexp)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
405 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
406 (define-key rmail-mode-map [menu-bar summary all] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
407 '("All" . rmail-summary)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
408 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
409 (define-key rmail-mode-map [menu-bar mail] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
410 (cons "Mail" (make-sparse-keymap "Mail"))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
411 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
412 (define-key rmail-mode-map [menu-bar mail continue] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
413 '("Continue" . rmail-continue)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
414 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
415 (define-key rmail-mode-map [menu-bar mail forward] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
416 '("Forward" . rmail-forward)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
417 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
418 (define-key rmail-mode-map [menu-bar mail retry] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
419 '("Retry" . rmail-retry-failure)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
420 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
421 (define-key rmail-mode-map [menu-bar mail reply] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
422 '("Reply" . rmail-reply)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
423 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
424 (define-key rmail-mode-map [menu-bar mail mail] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
425 '("Mail" . rmail-mail)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
426 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
427 (define-key rmail-mode-map [menu-bar delete] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
428 (cons "Delete" (make-sparse-keymap "Delete"))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
429 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
430 (define-key rmail-mode-map [menu-bar delete expunge/save] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
431 '("Expunge/Save" . rmail-expunge-and-save)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
432 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
433 (define-key rmail-mode-map [menu-bar delete expunge] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
434 '("Expunge" . rmail-expunge)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
435 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
436 (define-key rmail-mode-map [menu-bar delete undelete] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
437 '("Undelete" . rmail-undelete-previous-message)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
438 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
439 (define-key rmail-mode-map [menu-bar delete delete] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
440 '("Delete" . rmail-delete-forward)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
441 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
442 (define-key rmail-mode-map [menu-bar move] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
443 (cons "Move" (make-sparse-keymap "Move"))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
444 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
445 (define-key rmail-mode-map [menu-bar move search-back] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
446 '("Search Back" . rmail-search-backward)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
447 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
448 (define-key rmail-mode-map [menu-bar move search] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
449 '("Search" . rmail-search)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
450 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
451 (define-key rmail-mode-map [menu-bar move previous] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
452 '("Previous Nondeleted" . rmail-previous-undeleted-message)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
453 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
454 (define-key rmail-mode-map [menu-bar move next] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
455 '("Next Nondeleted" . rmail-next-undeleted-message)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
456 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
457 (define-key rmail-mode-map [menu-bar move last] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
458 '("Last" . rmail-last-message)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
459 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
460 (define-key rmail-mode-map [menu-bar move first] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
461 '("First" . rmail-first-message)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
462 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
463 (define-key rmail-mode-map [menu-bar move previous] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
464 '("Previous" . rmail-previous-message)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
465 |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
466 (define-key rmail-mode-map [menu-bar move next] |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
467 '("Next" . rmail-next-message)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
468 |
270 | 469 ;; Rmail mode is suitable only for specially formatted data. |
470 (put 'rmail-mode 'mode-class 'special) | |
471 | |
1382
9b210c7d6c23
* rmail.el (rmail-mode): Make this autoload; we might find a file
Jim Blandy <jimb@redhat.com>
parents:
1372
diff
changeset
|
472 ;;;###autoload |
270 | 473 (defun rmail-mode () |
474 "Rmail Mode is used by \\<rmail-mode-map>\\[rmail] for editing Rmail files. | |
475 All normal editing commands are turned off. | |
476 Instead, these commands are available: | |
477 | |
478 \\[rmail-beginning-of-message] Move point to front of this message (same as \\[beginning-of-buffer]). | |
479 \\[scroll-up] Scroll to next screen of this message. | |
480 \\[scroll-down] Scroll to previous screen of this message. | |
481 \\[rmail-next-undeleted-message] Move to Next non-deleted message. | |
482 \\[rmail-previous-undeleted-message] Move to Previous non-deleted message. | |
483 \\[rmail-next-message] Move to Next message whether deleted or not. | |
484 \\[rmail-previous-message] Move to Previous message whether deleted or not. | |
485 \\[rmail-first-message] Move to the first message in Rmail file. | |
486 \\[rmail-last-message] Move to the last message in Rmail file. | |
487 \\[rmail-show-message] Jump to message specified by numeric position in file. | |
488 \\[rmail-search] Search for string and show message it is found in. | |
489 \\[rmail-delete-forward] Delete this message, move to next nondeleted. | |
490 \\[rmail-delete-backward] Delete this message, move to previous nondeleted. | |
491 \\[rmail-undelete-previous-message] Undelete message. Tries current message, then earlier messages | |
492 till a deleted message is found. | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
493 \\[rmail-edit-current-message] Edit the current message. \\[rmail-cease-edit] to return to Rmail. |
270 | 494 \\[rmail-expunge] Expunge deleted messages. |
495 \\[rmail-expunge-and-save] Expunge and save the file. | |
496 \\[rmail-quit] Quit Rmail: expunge, save, then switch to another buffer. | |
497 \\[save-buffer] Save without expunging. | |
2423
5dd3b7338f71
(rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents:
2076
diff
changeset
|
498 \\[rmail-get-new-mail] Move new mail from system spool directory into this file. |
270 | 499 \\[rmail-mail] Mail a message (same as \\[mail-other-window]). |
500 \\[rmail-continue] Continue composing outgoing message started before. | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
501 \\[rmail-reply] Reply to this message. Like \\[rmail-mail] but initializes some fields. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
502 \\[rmail-retry-failure] Send this message again. Used on a mailer failure message. |
270 | 503 \\[rmail-forward] Forward this message to another user. |
504 \\[rmail-output-to-rmail-file] Output this message to an Rmail file (append it). | |
505 \\[rmail-output] Output this message to a Unix-format mail file (append it). | |
506 \\[rmail-input] Input Rmail file. Run Rmail on that file. | |
507 \\[rmail-add-label] Add label to message. It will be displayed in the mode line. | |
508 \\[rmail-kill-label] Kill label. Remove a label from current message. | |
509 \\[rmail-next-labeled-message] Move to Next message with specified label | |
510 (label defaults to last one specified). | |
511 Standard labels: filed, unseen, answered, forwarded, deleted. | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
512 Any other label is present only if you add it with \\[rmail-add-label]. |
270 | 513 \\[rmail-previous-labeled-message] Move to Previous message with specified label |
514 \\[rmail-summary] Show headers buffer, with a one line summary of each message. | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
515 \\[rmail-summary-by-labels] Summarize only messages with particular label(s). |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
516 \\[rmail-summary-by-recipients] Summarize only messages with particular recipient(s). |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
517 \\[rmail-summary-by-regexp] Summarize only messages with particular regexp(s). |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
518 \\[rmail-summary-by-topic] Summarize only messages with subject line regexp(s). |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
519 \\[rmail-toggle-header] Toggle display of complete header." |
270 | 520 (interactive) |
521 (rmail-mode-2) | |
522 (rmail-set-message-counters) | |
3864
ee987f852b10
(rmail-mode): Move to the last message.
Richard M. Stallman <rms@gnu.org>
parents:
3863
diff
changeset
|
523 (rmail-show-message rmail-total-messages)) |
270 | 524 |
525 (defun rmail-mode-2 () | |
526 (kill-all-local-variables) | |
527 (rmail-mode-1) | |
528 (rmail-variables) | |
529 (run-hooks 'rmail-mode-hook)) | |
530 | |
531 (defun rmail-mode-1 () | |
532 (setq major-mode 'rmail-mode) | |
533 (setq mode-name "RMAIL") | |
534 (setq buffer-read-only t) | |
535 ;; No need to auto save RMAIL files. | |
536 (setq buffer-auto-save-file-name nil) | |
537 (if (boundp 'mode-line-modified) | |
538 (setq mode-line-modified "--- ") | |
539 (setq mode-line-format | |
540 (cons "--- " (cdr (default-value 'mode-line-format))))) | |
541 (use-local-map rmail-mode-map) | |
542 (set-syntax-table text-mode-syntax-table) | |
543 (setq local-abbrev-table text-mode-abbrev-table)) | |
544 | |
545 (defun rmail-variables () | |
546 (make-local-variable 'revert-buffer-function) | |
547 (setq revert-buffer-function 'rmail-revert) | |
548 (make-local-variable 'rmail-last-label) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
549 (make-local-variable 'rmail-last-regexp) |
270 | 550 (make-local-variable 'rmail-deleted-vector) |
551 (make-local-variable 'rmail-summary-buffer) | |
552 (make-local-variable 'rmail-summary-vector) | |
553 (make-local-variable 'rmail-current-message) | |
554 (make-local-variable 'rmail-total-messages) | |
555 (make-local-variable 'require-final-newline) | |
556 (setq require-final-newline nil) | |
557 (make-local-variable 'version-control) | |
558 (setq version-control 'never) | |
559 (make-local-variable 'file-precious-flag) | |
560 (setq file-precious-flag t) | |
561 (make-local-variable 'rmail-message-vector) | |
562 (make-local-variable 'rmail-last-file) | |
563 (make-local-variable 'rmail-inbox-list) | |
564 (setq rmail-inbox-list (rmail-parse-file-inboxes)) | |
3540
c14c0f2954fd
(rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents:
3484
diff
changeset
|
565 ;; Provide default set of inboxes for primary mail file ~/RMAIL. |
c14c0f2954fd
(rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents:
3484
diff
changeset
|
566 (and (null rmail-inbox-list) |
4010
735b8dc6cdd2
(rmail-variables): Compare truename as well as given name
Richard M. Stallman <rms@gnu.org>
parents:
3931
diff
changeset
|
567 (or (equal buffer-file-name (expand-file-name rmail-file-name)) |
5192
3fb665ab94c1
(rmail-variables): Abbreviate truename for comparison.
Richard M. Stallman <rms@gnu.org>
parents:
5047
diff
changeset
|
568 (equal buffer-file-truename |
3fb665ab94c1
(rmail-variables): Abbreviate truename for comparison.
Richard M. Stallman <rms@gnu.org>
parents:
5047
diff
changeset
|
569 (abbreviate-file-name (file-truename rmail-file-name)))) |
3540
c14c0f2954fd
(rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents:
3484
diff
changeset
|
570 (setq rmail-inbox-list |
c14c0f2954fd
(rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents:
3484
diff
changeset
|
571 (or rmail-primary-inbox-list |
c14c0f2954fd
(rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents:
3484
diff
changeset
|
572 (list (or (getenv "MAIL") |
c14c0f2954fd
(rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents:
3484
diff
changeset
|
573 (concat rmail-spool-directory |
c14c0f2954fd
(rmail-variables): Default rmail-inbox-list here.
Richard M. Stallman <rms@gnu.org>
parents:
3484
diff
changeset
|
574 (user-original-login-name))))))) |
270 | 575 (make-local-variable 'rmail-keywords) |
576 ;; this gets generated as needed | |
280
e6f9ccb230ad
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
270
diff
changeset
|
577 (setq rmail-keywords nil)) |
270 | 578 |
579 ;; Handle M-x revert-buffer done in an rmail-mode buffer. | |
580 (defun rmail-revert (arg noconfirm) | |
581 (let (revert-buffer-function) | |
582 ;; Call our caller again, but this time it does the default thing. | |
583 (if (revert-buffer arg noconfirm) | |
584 ;; If the user said "yes", and we changed something, | |
585 ;; reparse the messages. | |
586 (progn | |
587 (rmail-convert-file) | |
588 (goto-char (point-max)) | |
589 (rmail-set-message-counters) | |
590 (rmail-show-message))))) | |
591 | |
592 ;; Return a list of files from this buffer's Mail: option. | |
593 ;; Does not assume that messages have been parsed. | |
594 ;; Just returns nil if buffer does not look like Babyl format. | |
595 (defun rmail-parse-file-inboxes () | |
596 (save-excursion | |
597 (save-restriction | |
598 (widen) | |
599 (goto-char 1) | |
600 (cond ((looking-at "BABYL OPTIONS:") | |
601 (search-forward "\n\^_" nil 'move) | |
602 (narrow-to-region 1 (point)) | |
603 (goto-char 1) | |
604 (if (search-forward "\nMail:" nil t) | |
605 (progn | |
606 (narrow-to-region (point) (progn (end-of-line) (point))) | |
607 (goto-char (point-min)) | |
608 (mail-parse-comma-list)))))))) | |
609 | |
610 (defun rmail-expunge-and-save () | |
611 "Expunge and save RMAIL file." | |
612 (interactive) | |
613 (rmail-expunge) | |
614 (save-buffer)) | |
615 | |
616 (defun rmail-quit () | |
617 "Quit out of RMAIL." | |
618 (interactive) | |
619 (rmail-expunge-and-save) | |
620 ;; Don't switch to the summary buffer even if it was recently visible. | |
621 (if rmail-summary-buffer | |
622 (bury-buffer rmail-summary-buffer)) | |
623 (let ((obuf (current-buffer))) | |
624 (switch-to-buffer (other-buffer)) | |
625 (bury-buffer obuf))) | |
626 | |
627 ;;;###autoload | |
628 (defun rmail-input (filename) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
629 "Run Rmail on file FILENAME." |
270 | 630 (interactive "FRun rmail on RMAIL file: ") |
631 (rmail filename)) | |
632 | |
633 | |
634 ;;;; *** Rmail input *** | |
635 | |
636 ;; RLK feature not added in this version: | |
637 ;; argument specifies inbox file or files in various ways. | |
638 | |
639 (defun rmail-get-new-mail (&optional file-name) | |
640 "Move any new mail from this RMAIL file's inbox files. | |
641 The inbox files can be specified with the file's Mail: option. The | |
642 variable `rmail-primary-inbox-list' specifies the inboxes for your | |
2423
5dd3b7338f71
(rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents:
2076
diff
changeset
|
643 primary RMAIL file if it has no Mail: option. By default, this is |
5dd3b7338f71
(rmail): Don't use mbox as inbox by default.
Richard M. Stallman <rms@gnu.org>
parents:
2076
diff
changeset
|
644 your /usr/spool/mail/$USER. |
270 | 645 |
646 You can also specify the file to get new mail from. In this case, the | |
647 file of new mail is not changed or deleted. Noninteractively, you can | |
648 pass the inbox file name as an argument. Interactively, a prefix | |
649 argument causes us to read a file name and use that file as the inbox." | |
650 (interactive | |
651 (list (if current-prefix-arg | |
652 (read-file-name "Get new mail from file: ")))) | |
653 (or (verify-visited-file-modtime (current-buffer)) | |
654 (progn | |
655 (find-file (buffer-file-name)) | |
2006
3f64e7ba7fdd
(rmail-get-new-mail): Reset read-only after find-file.
Richard M. Stallman <rms@gnu.org>
parents:
1757
diff
changeset
|
656 (setq buffer-read-only t) |
270 | 657 (if (verify-visited-file-modtime (current-buffer)) |
658 (rmail-forget-messages)))) | |
659 (rmail-maybe-set-message-counters) | |
660 (widen) | |
661 ;; Get rid of all undo records for this buffer. | |
662 (or (eq buffer-undo-list t) | |
663 (setq buffer-undo-list nil)) | |
664 (unwind-protect | |
665 (let ((opoint (point)) | |
666 (new-messages 0) | |
667 (delete-files ()) | |
668 ;; If buffer has not changed yet, and has not been saved yet, | |
669 ;; don't replace the old backup file now. | |
670 (make-backup-files (and make-backup-files (buffer-modified-p))) | |
671 (buffer-read-only nil) | |
672 ;; Don't make undo records for what we do in getting mail. | |
673 (buffer-undo-list t)) | |
674 (goto-char (point-max)) | |
675 (skip-chars-backward " \t\n") ; just in case of brain damage | |
676 (delete-region (point) (point-max)) ; caused by require-final-newline | |
677 (save-excursion | |
678 (save-restriction | |
679 (narrow-to-region (point) (point)) | |
680 ;; Read in the contents of the inbox files, | |
681 ;; renaming them as necessary, | |
682 ;; and adding to the list of files to delete eventually. | |
683 (if file-name | |
684 (rmail-insert-inbox-text (list file-name) nil) | |
685 (setq delete-files (rmail-insert-inbox-text rmail-inbox-list t))) | |
686 ;; Scan the new text and convert each message to babyl format. | |
687 (goto-char (point-min)) | |
688 (save-excursion | |
689 (setq new-messages (rmail-convert-to-babyl-format))) | |
690 (or (zerop new-messages) | |
691 (let (success) | |
692 (widen) | |
693 (search-backward "\n\^_") | |
694 (narrow-to-region (point) (point-max)) | |
695 (goto-char (1+ (point-min))) | |
696 (rmail-count-new-messages) | |
697 (save-buffer))) | |
698 ;; Delete the old files, now that babyl file is saved. | |
699 (while delete-files | |
700 (condition-case () | |
1165 | 701 ;; First, try deleting. |
702 (condition-case () | |
703 (delete-file (car delete-files)) | |
704 (file-error | |
705 ;; If we can't delete it, truncate it. | |
706 (write-region (point) (point) (car delete-files)))) | |
270 | 707 (file-error nil)) |
708 (setq delete-files (cdr delete-files))))) | |
709 (if (= new-messages 0) | |
710 (progn (goto-char opoint) | |
711 (if (or file-name rmail-inbox-list) | |
712 (message "(No new mail has arrived)"))) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
713 (if (rmail-summary-exists) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
714 (rmail-select-summary |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
715 (rmail-update-summary))) |
270 | 716 (message "%d new message%s read" |
717 new-messages (if (= 1 new-messages) "" "s")) | |
718 (and (boundp 'display-time-string) | |
719 (string-match " Mail" display-time-string) | |
720 (setq display-time-string | |
721 (concat | |
722 (substring display-time-string 0 (match-beginning 0)) | |
723 (substring display-time-string (match-end 0)))) | |
724 (force-mode-line-update 'all)))) | |
725 ;; Don't leave the buffer screwed up if we get a disk-full error. | |
726 (rmail-show-message))) | |
727 | |
728 (defun rmail-insert-inbox-text (files renamep) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
729 (let (file tofile delete-files movemail popmail) |
270 | 730 (while files |
731 (setq file (expand-file-name (substitute-in-file-name (car files))) | |
732 ;;>> un*x specific << | |
813 | 733 ;; The "+" used to be "~", which is an extremely poor choice; |
734 ;; it might accidentally be deleted when space is low | |
735 ;; (as happened to me!). | |
736 tofile (concat file "+")) | |
270 | 737 ;; If getting from mail spool directory, |
738 ;; use movemail to move rather than just renaming, | |
739 ;; so as to interlock with the mailer. | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
740 (setq movemail (equal (file-name-directory file) rmail-spool-directory) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
741 popmail (string-match "^po:" (file-name-nondirectory file))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
742 (if popmail (setq file (file-name-nondirectory file) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
743 renamep t)) |
270 | 744 (if movemail |
745 (progn | |
746 (setq tofile (expand-file-name | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
747 ;; Generate name to move to from inbox name, |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
748 ;; in case of multiple inboxes that need moving. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
749 (concat ".newmail-" (file-name-nondirectory file)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
750 ;; Use the directory of this rmail file |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
751 ;; because it's a nuisance to use the homedir |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
752 ;; if that is on a full disk and this rmail |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
753 ;; file isn't. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
754 (file-name-directory |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
755 (expand-file-name buffer-file-name)))) |
270 | 756 ;; On some systems, /usr/spool/mail/foo is a directory |
757 ;; and the actual inbox is /usr/spool/mail/foo/foo. | |
758 (if (file-directory-p file) | |
759 (setq file (expand-file-name (user-original-login-name) | |
760 file))))) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
761 (if popmail |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
762 (message "Getting mail from post office ...") |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
763 (if (or (and (file-exists-p tofile) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
764 (/= 0 (nth 7 (file-attributes tofile)))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
765 (and (file-exists-p file) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
766 (/= 0 (nth 7 (file-attributes file))))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
767 (message "Getting mail from %s..." file))) |
270 | 768 ;; Set TOFILE if have not already done so, and |
769 ;; rename or copy the file FILE to TOFILE if and as appropriate. | |
770 (cond ((not renamep) | |
771 (setq tofile file)) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
772 ((or (file-exists-p tofile) (and (not popmail) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
773 (not (file-exists-p file)))) |
270 | 774 nil) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
775 ((and (not movemail) (not popmail)) |
4071
4f387cc0a49f
(rmail-insert-inbox-text): If inbox is not in the
Richard M. Stallman <rms@gnu.org>
parents:
4020
diff
changeset
|
776 ;; Try copying. If that fails (perhaps no space), |
4f387cc0a49f
(rmail-insert-inbox-text): If inbox is not in the
Richard M. Stallman <rms@gnu.org>
parents:
4020
diff
changeset
|
777 ;; rename instead. |
4f387cc0a49f
(rmail-insert-inbox-text): If inbox is not in the
Richard M. Stallman <rms@gnu.org>
parents:
4020
diff
changeset
|
778 (condition-case nil |
4f387cc0a49f
(rmail-insert-inbox-text): If inbox is not in the
Richard M. Stallman <rms@gnu.org>
parents:
4020
diff
changeset
|
779 (copy-file file tofile nil) |
4f387cc0a49f
(rmail-insert-inbox-text): If inbox is not in the
Richard M. Stallman <rms@gnu.org>
parents:
4020
diff
changeset
|
780 (error |
4f387cc0a49f
(rmail-insert-inbox-text): If inbox is not in the
Richard M. Stallman <rms@gnu.org>
parents:
4020
diff
changeset
|
781 (rename-file file tofile nil))) |
1165 | 782 ;; Make the real inbox file empty. |
783 ;; Leaving it deleted could cause lossage | |
784 ;; because mailers often won't create the file. | |
785 (condition-case () | |
786 (write-region (point) (point) file) | |
787 (file-error nil))) | |
270 | 788 (t |
789 (let ((errors nil)) | |
790 (unwind-protect | |
791 (save-excursion | |
792 (setq errors (generate-new-buffer " *rmail loss*")) | |
793 (buffer-disable-undo errors) | |
794 (call-process | |
795 (expand-file-name "movemail" exec-directory) | |
796 nil errors nil file tofile) | |
797 (if (not (buffer-modified-p errors)) | |
798 ;; No output => movemail won | |
799 nil | |
800 (set-buffer errors) | |
801 (subst-char-in-region (point-min) (point-max) | |
802 ?\n ?\ ) | |
803 (goto-char (point-max)) | |
804 (skip-chars-backward " \t") | |
805 (delete-region (point) (point-max)) | |
806 (goto-char (point-min)) | |
807 (if (looking-at "movemail: ") | |
808 (delete-region (point-min) (match-end 0))) | |
809 (beep t) | |
810 (message (concat "movemail: " | |
811 (buffer-substring (point-min) | |
812 (point-max)))) | |
813 (sit-for 3) | |
814 nil)) | |
815 (if errors (kill-buffer errors)))))) | |
816 ;; At this point, TOFILE contains the name to read: | |
817 ;; Either the alternate name (if we renamed) | |
818 ;; or the actual inbox (if not renaming). | |
819 (if (file-exists-p tofile) | |
820 (let (size) | |
821 (goto-char (point-max)) | |
822 (setq size (nth 1 (insert-file-contents tofile))) | |
823 (goto-char (point-max)) | |
824 (or (= (preceding-char) ?\n) | |
825 (zerop size) | |
826 (insert ?\n)) | |
827 (setq delete-files (cons tofile delete-files)))) | |
828 (message "") | |
829 (setq files (cdr files))) | |
830 delete-files)) | |
831 | |
832 ;; the rmail-break-forwarded-messages feature is not implemented | |
833 (defun rmail-convert-to-babyl-format () | |
834 (let ((count 0) start | |
402
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
835 (case-fold-search nil) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
836 (invalid-input-resync |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
837 (function (lambda () |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
838 (message "Invalid Babyl format in inbox!") |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
839 (sit-for 1) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
840 ;; Try to get back in sync with a real message. |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
841 (if (re-search-forward |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
842 (concat mmdf-delim1 "\\|^From") nil t) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
843 (beginning-of-line) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
844 (goto-char (point-max))))))) |
270 | 845 (goto-char (point-min)) |
846 (save-restriction | |
847 (while (not (eobp)) | |
848 (cond ((looking-at "BABYL OPTIONS:");Babyl header | |
402
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
849 (if (search-forward "\n\^_" nil t) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
850 ;; If we find the proper terminator, delete through there. |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
851 (delete-region (point-min) (point)) |
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
852 (funcall invalid-input-resync) |
405
698d5d6e8f8b
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
403
diff
changeset
|
853 (delete-region (point-min) (point)))) |
270 | 854 ;; Babyl format message |
855 ((looking-at "\^L") | |
856 (or (search-forward "\n\^_" nil t) | |
402
14485c6a56aa
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
346
diff
changeset
|
857 (funcall invalid-input-resync)) |
270 | 858 (setq count (1+ count)) |
859 ;; Make sure there is no extra white space after the ^_ | |
860 ;; at the end of the message. | |
861 ;; Narrowing will make sure that whatever follows the junk | |
862 ;; will be treated properly. | |
863 (delete-region (point) | |
864 (save-excursion | |
865 (skip-chars-forward " \t\n") | |
866 (point))) | |
867 (narrow-to-region (point) (point-max))) | |
868 ;;*** MMDF format | |
869 ((let ((case-fold-search t)) | |
870 (looking-at mmdf-delim1)) | |
871 (let ((case-fold-search t)) | |
872 (replace-match "\^L\n0, unseen,,\n*** EOOH ***\n") | |
873 (setq start (point)) | |
874 (re-search-forward mmdf-delim2 nil t) | |
875 (replace-match "\^_")) | |
876 (save-excursion | |
877 (save-restriction | |
878 (narrow-to-region start (1- (point))) | |
879 (goto-char (point-min)) | |
880 (while (search-forward "\n\^_" nil t); single char "\^_" | |
881 (replace-match "\n^_")))); 2 chars: "^" and "_" | |
882 (narrow-to-region (point) (point-max)) | |
883 (setq count (1+ count))) | |
884 ;;*** Mail format | |
885 ((looking-at "^From ") | |
886 (setq start (point)) | |
887 (insert "\^L\n0, unseen,,\n*** EOOH ***\n") | |
888 (rmail-nuke-pinhead-header) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
889 ;; If this message has a Content-Length field, |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
890 ;; skip to the end of the contents. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
891 (let* ((header-end (save-excursion |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
892 (and (re-search-forward "\n\n" nil t) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
893 (point)))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
894 (case-fold-search t) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
895 (size |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
896 ;; Get the numeric value from the Content-Length field. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
897 (save-excursion |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
898 ;; Back up to end of prev line, |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
899 ;; in case the Content-Length field comes first. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
900 (forward-char -1) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
901 (and (search-forward "\ncontent-length: " |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
902 header-end t) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
903 (let ((beg (point)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
904 (eol (progn (end-of-line) (point)))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
905 (read (buffer-substring beg eol))))))) |
4819
22656ec8d019
(rmail-convert-to-babyl-format): Protect against
Richard M. Stallman <rms@gnu.org>
parents:
4764
diff
changeset
|
906 (and size (numberp size) (>= size 0) |
22656ec8d019
(rmail-convert-to-babyl-format): Protect against
Richard M. Stallman <rms@gnu.org>
parents:
4764
diff
changeset
|
907 (goto-char (+ header-end size)))) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
908 |
270 | 909 (if (re-search-forward |
910 (concat "^[\^_]?\\(" | |
617 | 911 rmail-unix-mail-delimiter |
912 "\\|" | |
270 | 913 mmdf-delim1 "\\|" |
914 "^BABYL OPTIONS:\\|" | |
915 "\^L\n[01],\\)") nil t) | |
916 (goto-char (match-beginning 1)) | |
917 (goto-char (point-max))) | |
918 (setq count (1+ count)) | |
919 (save-excursion | |
920 (save-restriction | |
921 (narrow-to-region start (point)) | |
922 (goto-char (point-min)) | |
923 (while (search-forward "\n\^_" nil t); single char | |
924 (replace-match "\n^_")))); 2 chars: "^" and "_" | |
925 (insert ?\^_) | |
926 (narrow-to-region (point) (point-max))) | |
927 ;; | |
2700
9de57e00caf7
(rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents:
2687
diff
changeset
|
928 ;; This kludge is because some versions of sendmail.el |
9de57e00caf7
(rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents:
2687
diff
changeset
|
929 ;; insert an extra newline at the beginning that shouldn't |
9de57e00caf7
(rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents:
2687
diff
changeset
|
930 ;; be there. sendmail.el has been fixed, but old versions |
9de57e00caf7
(rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents:
2687
diff
changeset
|
931 ;; may still be in use. -- rms, 7 May 1993. |
9de57e00caf7
(rmail-convert-to-babyl-format): Delete 1 char
Richard M. Stallman <rms@gnu.org>
parents:
2687
diff
changeset
|
932 ((eolp) (delete-char 1)) |
405
698d5d6e8f8b
*** empty log message ***
Michael I. Bushnell <mib@gnu.org>
parents:
403
diff
changeset
|
933 (t (error "Cannot convert to babyl format"))))) |
270 | 934 count)) |
935 | |
936 ;; Delete the "From ..." line, creating various other headers with | |
937 ;; information from it if they don't already exist. Now puts the | |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
938 ;; original line into a mail-from: header line for debugging and for |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
939 ;; use by the rmail-output function. |
270 | 940 (defun rmail-nuke-pinhead-header () |
941 (save-excursion | |
942 (save-restriction | |
943 (let ((start (point)) | |
944 (end (progn | |
945 (condition-case () | |
946 (search-forward "\n\n") | |
947 (error | |
948 (goto-char (point-max)) | |
949 (insert "\n\n"))) | |
950 (point))) | |
951 has-from has-date) | |
952 (narrow-to-region start end) | |
953 (let ((case-fold-search t)) | |
954 (goto-char start) | |
955 (setq has-from (search-forward "\nFrom:" nil t)) | |
956 (goto-char start) | |
957 (setq has-date (and (search-forward "\nDate:" nil t) (point))) | |
958 (goto-char start)) | |
959 (let ((case-fold-search nil)) | |
617 | 960 (if (re-search-forward (concat "^" rmail-unix-mail-delimiter) nil t) |
270 | 961 (replace-match |
962 (concat | |
963 "Mail-from: \\&" | |
964 ;; Keep and reformat the date if we don't | |
965 ;; have a Date: field. | |
966 (if has-date | |
967 "" | |
1112 | 968 (concat |
969 "Date: \\3, \\5 \\4 \\9 \\6 " | |
970 | |
971 ;; The timezone could be matched by group 7 or group 10. | |
972 ;; If neither of them matched, assume EST, since only | |
973 ;; Easterners would be so sloppy. | |
974 ;; It's a shame the substitution can't use "\\10". | |
975 (cond | |
976 ((/= (match-beginning 7) (match-end 7)) "\\7") | |
977 ((/= (match-beginning 10) (match-end 10)) | |
978 (buffer-substring (match-beginning 10) | |
979 (match-end 10))) | |
980 (t "EST")) | |
981 "\n")) | |
270 | 982 ;; Keep and reformat the sender if we don't |
983 ;; have a From: field. | |
984 (if has-from | |
985 "" | |
4340
505fb5222dea
(rmail-nuke-pinhead-header): Tell replace-match not to alter the case.
Richard M. Stallman <rms@gnu.org>
parents:
4332
diff
changeset
|
986 "From: \\1\n")) |
505fb5222dea
(rmail-nuke-pinhead-header): Tell replace-match not to alter the case.
Richard M. Stallman <rms@gnu.org>
parents:
4332
diff
changeset
|
987 t))))))) |
270 | 988 |
989 ;;;; *** Rmail Message Formatting and Header Manipulation *** | |
990 | |
991 (defun rmail-reformat-message (beg end) | |
992 (goto-char beg) | |
993 (forward-line 1) | |
994 (if (/= (following-char) ?0) | |
995 (error "Bad format in RMAIL file.")) | |
996 (let ((buffer-read-only nil) | |
997 (delta (- (buffer-size) end))) | |
998 (delete-char 1) | |
999 (insert ?1) | |
1000 (forward-line 1) | |
4340
505fb5222dea
(rmail-nuke-pinhead-header): Tell replace-match not to alter the case.
Richard M. Stallman <rms@gnu.org>
parents:
4332
diff
changeset
|
1001 (let ((case-fold-search t)) |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1002 (while (looking-at "Summary-line:\\|Mail-From:") |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1003 (forward-line 1))) |
270 | 1004 (if (looking-at "\\*\\*\\* EOOH \\*\\*\\*\n") |
1005 (delete-region (point) | |
1006 (progn (forward-line 1) (point)))) | |
1007 (let ((str (buffer-substring (point) | |
1008 (save-excursion (search-forward "\n\n" end 'move) | |
1009 (point))))) | |
1010 (insert str "*** EOOH ***\n") | |
1011 (narrow-to-region (point) (- (buffer-size) delta))) | |
1012 (goto-char (point-min)) | |
1013 (if rmail-ignored-headers (rmail-clear-headers)) | |
1014 (if rmail-message-filter (funcall rmail-message-filter)))) | |
1015 | |
1016 (defun rmail-clear-headers () | |
1017 (if (search-forward "\n\n" nil t) | |
1018 (save-restriction | |
1019 (narrow-to-region (point-min) (point)) | |
1020 (let ((buffer-read-only nil)) | |
1021 (while (let ((case-fold-search t)) | |
1022 (goto-char (point-min)) | |
1023 (re-search-forward rmail-ignored-headers nil t)) | |
1024 (beginning-of-line) | |
1025 (delete-region (point) | |
1026 (progn (re-search-forward "\n[^ \t]") | |
1027 (forward-char -1) | |
1028 (point)))))))) | |
1029 | |
1030 (defun rmail-toggle-header () | |
1031 "Show original message header if pruned header currently shown, or vice versa." | |
1032 (interactive) | |
1033 (rmail-maybe-set-message-counters) | |
1034 (narrow-to-region (rmail-msgbeg rmail-current-message) (point-max)) | |
1035 (let ((buffer-read-only nil)) | |
1036 (goto-char (point-min)) | |
1037 (forward-line 1) | |
1038 (if (= (following-char) ?1) | |
1039 (progn (delete-char 1) | |
1040 (insert ?0) | |
1041 (forward-line 1) | |
4340
505fb5222dea
(rmail-nuke-pinhead-header): Tell replace-match not to alter the case.
Richard M. Stallman <rms@gnu.org>
parents:
4332
diff
changeset
|
1042 (let ((case-fold-search t)) |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1043 (while (looking-at "Summary-Line:\\|Mail-From:") |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1044 (forward-line 1))) |
270 | 1045 (insert "*** EOOH ***\n") |
1046 (forward-char -1) | |
1047 (search-forward "\n*** EOOH ***\n") | |
1048 (forward-line -1) | |
1049 (let ((temp (point))) | |
1050 (and (search-forward "\n\n" nil t) | |
1051 (delete-region temp (point)))) | |
1052 (goto-char (point-min)) | |
1053 (search-forward "\n*** EOOH ***\n") | |
1054 (narrow-to-region (point) (point-max))) | |
1055 (rmail-reformat-message (point-min) (point-max))))) | |
1056 | |
1057 ;;;; *** Rmail Attributes and Keywords *** | |
1058 | |
1059 ;; Make a string describing current message's attributes and keywords | |
1060 ;; and set it up as the name of a minor mode | |
1061 ;; so it will appear in the mode line. | |
1062 (defun rmail-display-labels () | |
1063 (let ((blurb "") (beg (point-min-marker)) (end (point-max-marker))) | |
1064 (save-excursion | |
1065 (unwind-protect | |
1066 (progn | |
1067 (widen) | |
1068 (goto-char (rmail-msgbeg rmail-current-message)) | |
1069 (forward-line 1) | |
1070 (if (looking-at "[01],") | |
1071 (progn | |
1072 (narrow-to-region (point) (progn (end-of-line) (point))) | |
1073 ;; Truly valid BABYL format requires a space before each | |
1074 ;; attribute or keyword name. Put them in if missing. | |
1075 (let (buffer-read-only) | |
1076 (goto-char (point-min)) | |
1077 (while (search-forward "," nil t) | |
1078 (or (looking-at "[ ,]") (eobp) | |
1079 (insert " ")))) | |
1080 (goto-char (point-max)) | |
1081 (if (search-backward ",," nil 'move) | |
1082 (progn | |
1083 (if (> (point) (1+ (point-min))) | |
1084 (setq blurb (buffer-substring (+ 1 (point-min)) (point)))) | |
1085 (if (> (- (point-max) (point)) 2) | |
1086 (setq blurb | |
1087 (concat blurb | |
1088 ";" | |
1089 (buffer-substring (+ (point) 3) | |
1090 (1- (point-max))))))))))) | |
1091 ;; Note: we don't use save-restriction because that does not work right | |
1092 ;; if changes are made outside the saved restriction | |
1093 ;; before that restriction is restored. | |
1094 (narrow-to-region beg end) | |
1095 (set-marker beg nil) | |
1096 (set-marker end nil))) | |
1097 (while (string-match " +," blurb) | |
1098 (setq blurb (concat (substring blurb 0 (match-beginning 0)) "," | |
1099 (substring blurb (match-end 0))))) | |
1100 (while (string-match ", +" blurb) | |
1101 (setq blurb (concat (substring blurb 0 (match-beginning 0)) "," | |
1102 (substring blurb (match-end 0))))) | |
1103 (setq mode-line-process | |
1104 (concat " " rmail-current-message "/" rmail-total-messages | |
1105 blurb)))) | |
1106 | |
1107 ;; Turn an attribute of a message on or off according to STATE. | |
1108 ;; ATTR is the name of the attribute, as a string. | |
1109 ;; MSGNUM is message number to change; nil means current message. | |
1110 (defun rmail-set-attribute (attr state &optional msgnum) | |
1111 (let ((omax (point-max-marker)) | |
1112 (omin (point-min-marker)) | |
1113 (buffer-read-only nil)) | |
1114 (or msgnum (setq msgnum rmail-current-message)) | |
5047
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1115 (if (> msgnum 0) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1116 (unwind-protect |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1117 (save-excursion |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1118 (widen) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1119 (goto-char (+ 3 (rmail-msgbeg msgnum))) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1120 (let ((curstate |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1121 (not |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1122 (null (search-backward (concat ", " attr ",") |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1123 (prog1 (point) (end-of-line)) t))))) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1124 (or (eq curstate (not (not state))) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1125 (if curstate |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1126 (delete-region (point) (1- (match-end 0))) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1127 (beginning-of-line) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1128 (forward-char 2) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1129 (insert " " attr ",")))) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1130 (if (string= attr "deleted") |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1131 (rmail-set-message-deleted-p msgnum state))) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1132 ;; Note: we don't use save-restriction because that does not work right |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1133 ;; if changes are made outside the saved restriction |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1134 ;; before that restriction is restored. |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1135 (narrow-to-region omin omax) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1136 (set-marker omin nil) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1137 (set-marker omax nil) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1138 (if (= msgnum rmail-current-message) |
1ada11e2d89a
(rmail-set-attribute): Do nothing if MSGNUM is 0.
Richard M. Stallman <rms@gnu.org>
parents:
4969
diff
changeset
|
1139 (rmail-display-labels)))))) |
270 | 1140 |
1141 ;; Return t if the attributes/keywords line of msg number MSG | |
1142 ;; contains a match for the regexp LABELS. | |
1143 (defun rmail-message-labels-p (msg labels) | |
1144 (save-excursion | |
1145 (save-restriction | |
1146 (widen) | |
1147 (goto-char (rmail-msgbeg msg)) | |
1148 (forward-char 3) | |
1149 (re-search-backward labels (prog1 (point) (end-of-line)) t)))) | |
1150 | |
1151 ;;;; *** Rmail Message Selection And Support *** | |
1152 | |
1153 (defun rmail-msgend (n) | |
1154 (marker-position (aref rmail-message-vector (1+ n)))) | |
1155 | |
1156 (defun rmail-msgbeg (n) | |
1157 (marker-position (aref rmail-message-vector n))) | |
1158 | |
1159 (defun rmail-widen-to-current-msgbeg (function) | |
1160 "Call FUNCTION with point at start of internal data of current message. | |
1161 Assumes that bounds were previously narrowed to display the message in Rmail. | |
1162 The bounds are widened enough to move point where desired, then narrowed | |
1163 again afterward. | |
1164 | |
1165 FUNCTION may not change the visible text of the message, but it may | |
1166 change the invisible header text." | |
1167 (save-excursion | |
344 | 1168 (let ((obeg (- (point-max) (point-min)))) |
270 | 1169 (unwind-protect |
1170 (progn | |
1171 (narrow-to-region (rmail-msgbeg rmail-current-message) | |
1172 (point-max)) | |
1173 (goto-char (point-min)) | |
1174 (funcall function)) | |
1175 ;; Note: we don't use save-restriction because that does not work right | |
1176 ;; if changes are made outside the saved restriction | |
1177 ;; before that restriction is restored. | |
1178 ;; Here we assume that changes made by FUNCTION | |
1179 ;; occur before the visible region of the message. | |
344 | 1180 (narrow-to-region (- (point-max) obeg) (point-max)))))) |
270 | 1181 |
1182 (defun rmail-forget-messages () | |
1183 (unwind-protect | |
1184 (if (vectorp rmail-message-vector) | |
1185 (let* ((i 0) | |
1186 (v rmail-message-vector) | |
1187 (n (length v))) | |
1188 (while (< i n) | |
1189 (move-marker (aref v i) nil) | |
1190 (setq i (1+ i))))) | |
1191 (setq rmail-message-vector nil) | |
1192 (setq rmail-deleted-vector nil))) | |
1193 | |
1194 (defun rmail-maybe-set-message-counters () | |
1195 (if (not (and rmail-deleted-vector | |
1196 rmail-message-vector | |
1197 rmail-current-message | |
1198 rmail-total-messages)) | |
1199 (rmail-set-message-counters))) | |
1200 | |
1201 (defun rmail-count-new-messages (&optional nomsg) | |
1202 (let* ((case-fold-search nil) | |
1203 (total-messages 0) | |
1204 (messages-head nil) | |
1205 (deleted-head nil)) | |
1206 (or nomsg (message "Counting new messages...")) | |
1207 (goto-char (point-max)) | |
1208 ;; Put at the end of messages-head | |
1209 ;; the entry for message N+1, which marks | |
1210 ;; the end of message N. (N = number of messages). | |
1211 (search-backward "\n\^_") | |
1212 (forward-char 1) | |
1213 (setq messages-head (list (point-marker))) | |
1214 (rmail-set-message-counters-counter (point-min)) | |
1215 (setq rmail-current-message (1+ rmail-total-messages)) | |
1216 (setq rmail-total-messages | |
1217 (+ rmail-total-messages total-messages)) | |
1218 (setq rmail-message-vector | |
1219 (vconcat rmail-message-vector (cdr messages-head))) | |
1220 (aset rmail-message-vector | |
1221 rmail-current-message (car messages-head)) | |
1222 (setq rmail-deleted-vector | |
1223 (concat rmail-deleted-vector deleted-head)) | |
1224 (setq rmail-summary-vector | |
1225 (vconcat rmail-summary-vector (make-vector total-messages nil))) | |
1226 (goto-char (point-min)) | |
1227 (or nomsg (message "Counting new messages...done (%d)" total-messages)))) | |
1228 | |
1229 (defun rmail-set-message-counters () | |
1230 (rmail-forget-messages) | |
1231 (save-excursion | |
1232 (save-restriction | |
1233 (widen) | |
1234 (let* ((point-save (point)) | |
1235 (total-messages 0) | |
1236 (messages-after-point) | |
1237 (case-fold-search nil) | |
1238 (messages-head nil) | |
1239 (deleted-head nil)) | |
1240 (message "Counting messages...") | |
1241 (goto-char (point-max)) | |
1242 ;; Put at the end of messages-head | |
1243 ;; the entry for message N+1, which marks | |
1244 ;; the end of message N. (N = number of messages). | |
1245 (search-backward "\n\^_") | |
1246 (forward-char 1) | |
1247 (setq messages-head (list (point-marker))) | |
1248 (rmail-set-message-counters-counter (min (point) point-save)) | |
1249 (setq messages-after-point total-messages) | |
1250 (rmail-set-message-counters-counter) | |
1251 (setq rmail-total-messages total-messages) | |
1252 (setq rmail-current-message | |
1253 (min total-messages | |
1254 (max 1 (- total-messages messages-after-point)))) | |
1255 (setq rmail-message-vector | |
1256 (apply 'vector (cons (point-min-marker) messages-head)) | |
1257 rmail-deleted-vector (concat "D" deleted-head) | |
1258 rmail-summary-vector (make-vector rmail-total-messages nil)) | |
1259 (message "Counting messages...done"))))) | |
1260 | |
1261 (defun rmail-set-message-counters-counter (&optional stop) | |
1262 (while (search-backward "\n\^_\^L\n" stop t) | |
1263 (forward-char 1) | |
1264 (setq messages-head (cons (point-marker) messages-head)) | |
1265 (save-excursion | |
1266 (setq deleted-head | |
1267 (cons (if (search-backward ", deleted," | |
1268 (prog1 (point) | |
1269 (forward-line 2)) | |
1270 t) | |
1271 ?D ?\ ) | |
1272 deleted-head))) | |
1273 (if (zerop (% (setq total-messages (1+ total-messages)) 20)) | |
1274 (message "Counting messages...%d" total-messages)))) | |
1275 | |
1276 (defun rmail-beginning-of-message () | |
1277 "Show current message starting from the beginning." | |
1278 (interactive) | |
1279 (rmail-show-message rmail-current-message)) | |
1280 | |
1281 (defun rmail-show-message (&optional n) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1282 "Show message number N (prefix argument), counting from start of file. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1283 If summary buffer is currently displayed, update current message there also." |
270 | 1284 (interactive "p") |
1285 (rmail-maybe-set-message-counters) | |
1286 (widen) | |
1287 (if (zerop rmail-total-messages) | |
1288 (progn (narrow-to-region (point-min) (1- (point-max))) | |
1289 (goto-char (point-min)) | |
1290 (setq mode-line-process nil)) | |
1291 (let (blurb) | |
1292 (if (not n) | |
1293 (setq n rmail-current-message) | |
1294 (cond ((<= n 0) | |
1295 (setq n 1 | |
1296 rmail-current-message 1 | |
1297 blurb "No previous message")) | |
1298 ((> n rmail-total-messages) | |
1299 (setq n rmail-total-messages | |
1300 rmail-current-message rmail-total-messages | |
1301 blurb "No following message")) | |
1302 (t | |
1303 (setq rmail-current-message n)))) | |
1304 (let ((beg (rmail-msgbeg n)) | |
1305 (end (rmail-msgend n))) | |
1306 (goto-char beg) | |
1307 (forward-line 1) | |
1308 (if (= (following-char) ?0) | |
1309 (progn | |
1310 (rmail-reformat-message beg end) | |
1311 (rmail-set-attribute "unseen" nil)) | |
1312 (search-forward "\n*** EOOH ***\n" end t) | |
1313 (narrow-to-region (point) end)) | |
1314 (goto-char (point-min)) | |
1315 (rmail-display-labels) | |
1316 (run-hooks 'rmail-show-message-hook) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1317 ;; If there is a summary buffer, try to move to this message |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1318 ;; in that buffer. But don't complain if this message |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1319 ;; is not mentioned in the summary. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1320 (if (rmail-summary-exists) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1321 (let ((curr-msg rmail-current-message)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1322 (rmail-select-summary |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1323 (rmail-summary-goto-msg curr-msg t t)))) |
270 | 1324 (if blurb |
1325 (message blurb)))))) | |
1326 | |
1327 (defun rmail-next-message (n) | |
1328 "Show following message whether deleted or not. | |
1329 With prefix arg N, moves forward N messages, or backward if N is negative." | |
1330 (interactive "p") | |
1331 (rmail-maybe-set-message-counters) | |
1332 (rmail-show-message (+ rmail-current-message n))) | |
1333 | |
1334 (defun rmail-previous-message (n) | |
1335 "Show previous message whether deleted or not. | |
1336 With prefix arg N, moves backward N messages, or forward if N is negative." | |
1337 (interactive "p") | |
1338 (rmail-next-message (- n))) | |
1339 | |
1340 (defun rmail-next-undeleted-message (n) | |
1341 "Show following non-deleted message. | |
1342 With prefix arg N, moves forward N non-deleted messages, | |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1343 or backward if N is negative. |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1344 |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1345 Returns t if a new message is being shown, nil otherwise." |
270 | 1346 (interactive "p") |
1347 (rmail-maybe-set-message-counters) | |
1348 (let ((lastwin rmail-current-message) | |
1349 (current rmail-current-message)) | |
1350 (while (and (> n 0) (< current rmail-total-messages)) | |
1351 (setq current (1+ current)) | |
1352 (if (not (rmail-message-deleted-p current)) | |
1353 (setq lastwin current n (1- n)))) | |
1354 (while (and (< n 0) (> current 1)) | |
1355 (setq current (1- current)) | |
1356 (if (not (rmail-message-deleted-p current)) | |
1357 (setq lastwin current n (1+ n)))) | |
1358 (if (/= lastwin rmail-current-message) | |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1359 (progn (rmail-show-message lastwin) |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1360 t) |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1361 (if (< n 0) |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1362 (message "No previous nondeleted message")) |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1363 (if (> n 0) |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1364 (message "No following nondeleted message")) |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1365 nil))) |
270 | 1366 |
1367 (defun rmail-previous-undeleted-message (n) | |
1368 "Show previous non-deleted message. | |
1369 With prefix argument N, moves backward N non-deleted messages, | |
1370 or forward if N is negative." | |
1371 (interactive "p") | |
1372 (rmail-next-undeleted-message (- n))) | |
1373 | |
1374 (defun rmail-first-message () | |
1375 "Show first message in file." | |
1376 (interactive) | |
1377 (rmail-maybe-set-message-counters) | |
1378 (rmail-show-message 1)) | |
1379 | |
1380 (defun rmail-last-message () | |
1381 "Show last message in file." | |
1382 (interactive) | |
1383 (rmail-maybe-set-message-counters) | |
1384 (rmail-show-message rmail-total-messages)) | |
1385 | |
1386 (defun rmail-what-message () | |
1387 (let ((where (point)) | |
1388 (low 1) | |
1389 (high rmail-total-messages) | |
1390 (mid (/ rmail-total-messages 2))) | |
1391 (while (> (- high low) 1) | |
1392 (if (>= where (rmail-msgbeg mid)) | |
1393 (setq low mid) | |
1394 (setq high mid)) | |
1395 (setq mid (+ low (/ (- high low) 2)))) | |
1396 (if (>= where (rmail-msgbeg high)) high low))) | |
1397 | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1398 (defun rmail-message-recipients-p (msg recipients &optional primary-only) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1399 (save-restriction |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1400 (goto-char (rmail-msgbeg msg)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1401 (search-forward "\n*** EOOH ***\n") |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1402 (narrow-to-region (point) (progn (search-forward "\n\n") (point))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1403 (or (string-match recipients (or (mail-fetch-field "To") "")) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1404 (string-match recipients (or (mail-fetch-field "From") "")) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1405 (if (not primary-only) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1406 (string-match recipients (or (mail-fetch-field "Cc") "")))))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1407 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1408 (defun rmail-message-regexp-p (msg regexp) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1409 "Return t, if for message number MSG, regexp REGEXP matches in the header." |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1410 (goto-char (rmail-msgbeg msg)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1411 (let ((end |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1412 (save-excursion |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1413 (search-forward "*** EOOH ***" (point-max)) (point)))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1414 (re-search-forward regexp end t))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1415 |
3863
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1416 (defun rmail-search-backward (regexp &optional n) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1417 "Show message containing next match for REGEXP. |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1418 Prefix argument gives repeat count; negative argument means search |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1419 backwards (through earlier messages). |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1420 Interactively, empty argument means use same regexp used last time." |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1421 (interactive |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1422 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1423 (prompt |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1424 (concat (if reversep "Reverse " "") "Rmail search (regexp): ")) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1425 regexp) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1426 (if rmail-search-last-regexp |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1427 (setq prompt (concat prompt |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1428 "(default " |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1429 rmail-search-last-regexp |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1430 ") "))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1431 (setq regexp (read-string prompt)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1432 (cond ((not (equal regexp "")) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1433 (setq rmail-search-last-regexp regexp)) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1434 ((not rmail-search-last-regexp) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1435 (error "No previous Rmail search string"))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1436 (list rmail-search-last-regexp |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1437 (prefix-numeric-value current-prefix-arg)))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1438 (rmail-search regexp (- n))) |
049283382a10
(rmail-mode-map): Add local menu bar bindings.
Richard M. Stallman <rms@gnu.org>
parents:
3631
diff
changeset
|
1439 |
270 | 1440 (defvar rmail-search-last-regexp nil) |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1441 (defun rmail-search (regexp &optional n) |
270 | 1442 "Show message containing next match for REGEXP. |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1443 Prefix argument gives repeat count; negative argument means search |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1444 backwards (through earlier messages). |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1445 Interactively, empty argument means use same regexp used last time." |
270 | 1446 (interactive |
1447 (let* ((reversep (< (prefix-numeric-value current-prefix-arg) 0)) | |
1448 (prompt | |
1449 (concat (if reversep "Reverse " "") "Rmail search (regexp): ")) | |
1450 regexp) | |
1451 (if rmail-search-last-regexp | |
1452 (setq prompt (concat prompt | |
1453 "(default " | |
1454 rmail-search-last-regexp | |
1455 ") "))) | |
1456 (setq regexp (read-string prompt)) | |
1457 (cond ((not (equal regexp "")) | |
1458 (setq rmail-search-last-regexp regexp)) | |
1459 ((not rmail-search-last-regexp) | |
1460 (error "No previous Rmail search string"))) | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1461 (list rmail-search-last-regexp |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1462 (prefix-numeric-value current-prefix-arg)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1463 (or n (setq n 1)) |
270 | 1464 (message "%sRmail search for %s..." |
937
0f082d63bfd6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
874
diff
changeset
|
1465 (if (< n 0) "Reverse " "") |
270 | 1466 regexp) |
1467 (rmail-maybe-set-message-counters) | |
1468 (let ((omin (point-min)) | |
1469 (omax (point-max)) | |
1470 (opoint (point)) | |
1471 win | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1472 (reversep (< n 0)) |
270 | 1473 (msg rmail-current-message)) |
1474 (unwind-protect | |
1475 (progn | |
1476 (widen) | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1477 (while (/= n 0) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1478 ;; 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
|
1479 ;; but searching forward through each message. |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1480 (if reversep |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1481 (while (and (null win) (> msg 1)) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1482 (goto-char (rmail-msgbeg (setq msg (1- msg)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1483 (setq win (re-search-forward |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1484 regexp (rmail-msgend msg) t))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1485 (while (and (null win) (< msg rmail-total-messages)) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1486 (goto-char (rmail-msgbeg (setq msg (1+ msg)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1487 (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
|
1488 (setq n (+ n (if reversep 1 -1))))) |
270 | 1489 (if win |
1490 (progn | |
1491 ;; If this is a reverse search and we found a message, | |
1492 ;; search backward thru this message to position point. | |
1493 (if reversep | |
1494 (progn | |
1495 (goto-char (rmail-msgend msg)) | |
1496 (re-search-backward | |
1497 regexp (rmail-msgbeg msg) t))) | |
1498 (setq win (point)) | |
1499 (rmail-show-message msg) | |
1500 (message "%sRmail search for %s...done" | |
1501 (if reversep "Reverse " "") | |
1502 regexp) | |
1503 (goto-char win)) | |
1504 (goto-char opoint) | |
1505 (narrow-to-region omin omax) | |
1506 (ding) | |
1507 (message "Search failed: %s" regexp))))) | |
1508 | |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1509 (defun rmail-search-backwards (regexp &optional n) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1510 "Show message containing previous match for REGEXP. |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1511 Prefix argument gives repeat count; negative argument means search |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1512 forward (through later messages). |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1513 Interactively, empty argument means use same regexp used last time." |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1514 (interactive |
937
0f082d63bfd6
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
874
diff
changeset
|
1515 (let* ((reversep (>= (prefix-numeric-value current-prefix-arg) 0)) |
874
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1516 (prompt |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1517 (concat (if reversep "Reverse " "") "Rmail search (regexp): ")) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1518 regexp) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1519 (if rmail-search-last-regexp |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1520 (setq prompt (concat prompt |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1521 "(default " |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1522 rmail-search-last-regexp |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1523 ") "))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1524 (setq regexp (read-string prompt)) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1525 (cond ((not (equal regexp "")) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1526 (setq rmail-search-last-regexp regexp)) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1527 ((not rmail-search-last-regexp) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1528 (error "No previous Rmail search string"))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1529 (list rmail-search-last-regexp |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1530 (prefix-numeric-value current-prefix-arg)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1531 (rmail-search regexp (- (or n -1)))) |
b945f592b94d
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
846
diff
changeset
|
1532 |
270 | 1533 ;; Show the first message which has the `unseen' attribute. |
1534 (defun rmail-first-unseen-message () | |
1360
9cb1a4b90b5c
Cleaned up rmail-first-unseen-message.
Joseph Arceneaux <jla@gnu.org>
parents:
1342
diff
changeset
|
1535 (rmail-maybe-set-message-counters) |
270 | 1536 (let ((current 1) |
1537 found) | |
1538 (save-restriction | |
1539 (widen) | |
1540 (while (and (not found) (< current rmail-total-messages)) | |
1541 (if (rmail-message-labels-p current ", ?\\(unseen\\),") | |
346 | 1542 (setq found current)) |
1543 (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
|
1544 ;; 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
|
1545 ;; (if found |
776d4c59f256
* rmail.el (rmail-first-unseen-message): Don't show the message,
Joseph Arceneaux <jla@gnu.org>
parents:
1267
diff
changeset
|
1546 ;; (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
|
1547 found)) |
270 | 1548 |
1549 ;;;; *** Rmail Message Deletion Commands *** | |
1550 | |
1551 (defun rmail-message-deleted-p (n) | |
1552 (= (aref rmail-deleted-vector n) ?D)) | |
1553 | |
1554 (defun rmail-set-message-deleted-p (n state) | |
1555 (aset rmail-deleted-vector n (if state ?D ?\ ))) | |
1556 | |
1557 (defun rmail-delete-message () | |
1558 "Delete this message and stay on it." | |
1559 (interactive) | |
1560 (rmail-set-attribute "deleted" t)) | |
1561 | |
1562 (defun rmail-undelete-previous-message () | |
1563 "Back up to deleted message, select it, and undelete it." | |
1564 (interactive) | |
1565 (let ((msg rmail-current-message)) | |
1566 (while (and (> msg 0) | |
1567 (not (rmail-message-deleted-p msg))) | |
1568 (setq msg (1- msg))) | |
1569 (if (= msg 0) | |
1570 (error "No previous deleted message") | |
1571 (if (/= msg rmail-current-message) | |
1572 (rmail-show-message msg)) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1573 (rmail-set-attribute "deleted" nil) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1574 (if (rmail-summary-exists) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1575 (save-excursion |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1576 (set-buffer rmail-summary-buffer) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1577 (rmail-summary-mark-undeleted msg))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1578 (rmail-maybe-display-summary)))) |
270 | 1579 |
1580 (defun rmail-delete-forward (&optional backward) | |
1581 "Delete this message and move to next nondeleted one. | |
1582 Deleted messages stay in the file until the \\[rmail-expunge] command is given. | |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1583 With prefix argument, delete and move backward. |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1584 |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1585 Returns t if a new message is displayed after the delete, or nil otherwise." |
270 | 1586 (interactive "P") |
1587 (rmail-set-attribute "deleted" t) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1588 (let ((del-msg rmail-current-message)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1589 (if (rmail-summary-exists) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1590 (save-excursion |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1591 (set-buffer rmail-summary-buffer) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1592 (rmail-summary-mark-deleted del-msg))) |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1593 (prog1 (rmail-next-undeleted-message (if backward -1 1)) |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1594 (rmail-maybe-display-summary)))) |
270 | 1595 |
1596 (defun rmail-delete-backward () | |
1597 "Delete this message and move to previous nondeleted one. | |
1598 Deleted messages stay in the file until the \\[rmail-expunge] command is given." | |
1599 (interactive) | |
1600 (rmail-delete-forward t)) | |
1601 | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1602 (defun rmail-only-expunge () |
270 | 1603 "Actually erase all deleted messages in the file." |
1604 (interactive) | |
1605 (message "Expunging deleted messages...") | |
1606 ;; Discard all undo records for this buffer. | |
1607 (or (eq buffer-undo-list t) | |
1608 (setq buffer-undo-list nil)) | |
1609 (rmail-maybe-set-message-counters) | |
1610 (let* ((omax (- (buffer-size) (point-max))) | |
1611 (omin (- (buffer-size) (point-min))) | |
1612 (opoint (if (and (> rmail-current-message 0) | |
1613 (= ?D (aref rmail-deleted-vector rmail-current-message))) | |
1614 0 (- (point) (point-min)))) | |
1615 (messages-head (cons (aref rmail-message-vector 0) nil)) | |
1616 (messages-tail messages-head) | |
1617 ;; Don't make any undo records for the expunging. | |
1618 (buffer-undo-list t) | |
1619 (win)) | |
1620 (unwind-protect | |
1621 (save-excursion | |
1622 (widen) | |
1623 (goto-char (point-min)) | |
1624 (let ((counter 0) | |
1625 (number 1) | |
1626 (total rmail-total-messages) | |
1627 (new-message-number rmail-current-message) | |
1628 (new-summary nil) | |
1629 (buffer-read-only nil) | |
1630 (messages rmail-message-vector) | |
1631 (deleted rmail-deleted-vector) | |
1632 (summary rmail-summary-vector)) | |
1633 (setq rmail-total-messages nil | |
1634 rmail-current-message nil | |
1635 rmail-message-vector nil | |
1636 rmail-deleted-vector nil | |
1637 rmail-summary-vector nil) | |
1638 (while (<= number total) | |
1639 (if (= (aref deleted number) ?D) | |
1640 (progn | |
1641 (delete-region | |
1642 (marker-position (aref messages number)) | |
1643 (marker-position (aref messages (1+ number)))) | |
1644 (move-marker (aref messages number) nil) | |
1645 (if (> new-message-number counter) | |
1646 (setq new-message-number (1- new-message-number)))) | |
1647 (setq counter (1+ counter)) | |
1648 (setq messages-tail | |
1649 (setcdr messages-tail | |
1650 (cons (aref messages number) nil))) | |
1651 (setq new-summary | |
1652 (cons (if (= counter number) (aref summary (1- number))) | |
1653 new-summary))) | |
1654 (if (zerop (% (setq number (1+ number)) 20)) | |
1655 (message "Expunging deleted messages...%d" number))) | |
1656 (setq messages-tail | |
1657 (setcdr messages-tail | |
1658 (cons (aref messages number) nil))) | |
1659 (setq rmail-current-message new-message-number | |
1660 rmail-total-messages counter | |
1661 rmail-message-vector (apply 'vector messages-head) | |
1662 rmail-deleted-vector (make-string (1+ counter) ?\ ) | |
1663 rmail-summary-vector (vconcat (nreverse new-summary)) | |
1664 win t))) | |
1665 (message "Expunging deleted messages...done") | |
1666 (if (not win) | |
1667 (narrow-to-region (- (buffer-size) omin) (- (buffer-size) omax))) | |
1668 (rmail-show-message | |
1669 (if (zerop rmail-current-message) 1 nil)) | |
1670 (forward-char opoint)))) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1671 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1672 (defun rmail-expunge () |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1673 "Erase deleted messages from Rmail file and summary buffer." |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1674 (interactive) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1675 (rmail-only-expunge) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1676 (if (rmail-summary-exists) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1677 (rmail-select-summary |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1678 (rmail-update-summary)))) |
270 | 1679 |
1680 ;;;; *** Rmail Mailing Commands *** | |
1681 | |
4108
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1682 (defun rmail-start-mail (&rest args) |
4969
af6f961194ce
(rmail-start-mail): Don't do other frame unless we have
Richard M. Stallman <rms@gnu.org>
parents:
4844
diff
changeset
|
1683 (if (and window-system rmail-mail-new-frame) |
4263
7c7fa71cfd6e
(rmail-last-rmail-file): Initialize to a file name.
Richard M. Stallman <rms@gnu.org>
parents:
4108
diff
changeset
|
1684 (prog1 |
4108
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1685 (apply 'mail-other-frame args) |
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1686 (modify-frame-parameters (selected-frame) |
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1687 '((dedicated . t)))) |
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1688 (apply 'mail-other-window args))) |
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1689 |
270 | 1690 (defun rmail-mail () |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1691 "Send mail in another window. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1692 While composing the message, use \\[mail-yank-original] to yank the |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1693 original message into it." |
270 | 1694 (interactive) |
4108
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1695 (rmail-start-mail nil nil nil nil nil (current-buffer))) |
270 | 1696 |
1697 (defun rmail-continue () | |
1698 "Continue composing outgoing message previously being composed." | |
1699 (interactive) | |
4108
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1700 (rmail-start-mail t)) |
270 | 1701 |
1702 (defun rmail-reply (just-sender) | |
1703 "Reply to the current message. | |
1704 Normally include CC: to all other recipients of original message; | |
1705 prefix argument means ignore them. While composing the reply, | |
1706 use \\[mail-yank-original] to yank the original message into it." | |
1707 (interactive "P") | |
1708 (let (from reply-to cc subject date to message-id resent-reply-to) | |
1709 (save-excursion | |
1710 (save-restriction | |
1711 (widen) | |
1712 (goto-char (rmail-msgbeg rmail-current-message)) | |
1713 (forward-line 1) | |
1714 (if (= (following-char) ?0) | |
1715 (narrow-to-region | |
1716 (progn (forward-line 2) | |
1717 (point)) | |
1718 (progn (search-forward "\n\n" (rmail-msgend rmail-current-message) | |
1719 'move) | |
1720 (point))) | |
1721 (narrow-to-region (point) | |
1722 (progn (search-forward "\n*** EOOH ***\n") | |
1723 (beginning-of-line) (point)))) | |
1724 (setq resent-reply-to (mail-fetch-field "resent-reply-to" t) | |
1725 from (mail-fetch-field "from") | |
1726 reply-to (or resent-reply-to | |
1727 (mail-fetch-field "reply-to" nil t) | |
1728 from) | |
1729 cc (cond (just-sender nil) | |
1730 (resent-reply-to (mail-fetch-field "resent-cc" t)) | |
1731 (t (mail-fetch-field "cc" nil t))) | |
1732 subject (or (and resent-reply-to | |
1733 (mail-fetch-field "resent-subject" t)) | |
1734 (mail-fetch-field "subject")) | |
1735 date (cond (resent-reply-to | |
1736 (mail-fetch-field "resent-date" t)) | |
1737 ((mail-fetch-field "date"))) | |
1738 to (cond (resent-reply-to | |
1739 (mail-fetch-field "resent-to" t)) | |
1740 ((mail-fetch-field "to" nil t)) | |
1741 ;((mail-fetch-field "apparently-to")) ack gag barf | |
1742 (t "")) | |
1743 message-id (cond (resent-reply-to | |
1744 (mail-fetch-field "resent-message-id" t)) | |
1745 ((mail-fetch-field "message-id")))))) | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1746 (and (stringp subject) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1747 (or (string-match (concat "\\`" (regexp-quote rmail-reply-prefix)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1748 subject) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1749 (setq subject (concat rmail-reply-prefix subject)))) |
4108
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1750 (rmail-start-mail nil |
270 | 1751 (mail-strip-quoted-names reply-to) |
1752 subject | |
1753 (rmail-make-in-reply-to-field from date message-id) | |
1754 (if just-sender | |
1755 nil | |
1756 (let* ((cc-list (rmail-dont-reply-to | |
1757 (mail-strip-quoted-names | |
1758 (if (null cc) to (concat to ", " cc)))))) | |
1759 (if (string= cc-list "") nil cc-list))) | |
1760 (current-buffer) | |
1761 (list (list '(lambda (buf msgnum) | |
1762 (save-excursion | |
1763 (set-buffer buf) | |
1764 (rmail-set-attribute "answered" t msgnum))) | |
1765 (current-buffer) rmail-current-message))))) | |
1766 | |
1767 (defun rmail-make-in-reply-to-field (from date message-id) | |
1768 (cond ((not from) | |
1769 (if message-id | |
1770 message-id | |
1771 nil)) | |
1772 (mail-use-rfc822 | |
1773 (require 'rfc822) | |
1774 (let ((tem (car (rfc822-addresses from)))) | |
1775 (if message-id | |
1776 (if (string-match | |
1777 (regexp-quote (if (string-match "@[^@]*\\'" tem) | |
1778 (substring tem 0 (match-beginning 0)) | |
1779 tem)) | |
1780 message-id) | |
1781 ;; Message-ID is sufficiently informative | |
1782 message-id | |
1783 (concat message-id " (" tem ")")) | |
1784 ;; Use prin1 to fake RFC822 quoting | |
1785 (let ((field (prin1-to-string tem))) | |
1786 (if date | |
1787 (concat field "'s message of " date) | |
1788 field))))) | |
1789 ((let* ((foo "[^][\000-\037\177-\377()<>@,;:\\\" ]+") | |
1790 (bar "[^][\000-\037\177-\377()<>@,;:\\\"]+")) | |
1791 ;; Can't use format because format loses on \000 (unix *^&%*^&%$!!) | |
1792 (or (string-match (concat "\\`[ \t]*\\(" bar | |
1793 "\\)\\(<" foo "@" foo ">\\)?[ \t]*\\'") | |
1794 ;; "Unix Loser <Foo@bar.edu>" => "Unix Loser" | |
1795 from) | |
1796 (string-match (concat "\\`[ \t]*<" foo "@" foo ">[ \t]*(\\(" | |
1797 bar "\\))[ \t]*\\'") | |
1798 ;; "<Bugs@bar.edu>" (Losing Unix) => "Losing Unix" | |
1799 from))) | |
1800 (let ((start (match-beginning 1)) | |
1801 (end (match-end 1))) | |
1802 ;; Trim whitespace which above regexp match allows | |
1803 (while (and (< start end) | |
1804 (memq (aref from start) '(?\t ?\ ))) | |
1805 (setq start (1+ start))) | |
1806 (while (and (< start end) | |
1807 (memq (aref from (1- end)) '(?\t ?\ ))) | |
1808 (setq end (1- end))) | |
1809 (let ((field (substring from start end))) | |
1810 (if date (setq field (concat "message from " field " on " date))) | |
1811 (if message-id | |
1812 ;; "<AA259@bar.edu> (message from Unix Loser on 1-Apr-89)" | |
1813 (concat message-id " (" field ")") | |
1814 field)))) | |
1815 (t | |
1816 ;; If we can't kludge it simply, do it correctly | |
1817 (let ((mail-use-rfc822 t)) | |
1818 (rmail-make-in-reply-to-field from date message-id))))) | |
1819 | |
2687
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1820 (defun rmail-forward (resend) |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1821 "Forward the current message to another user. |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1822 With prefix argument, \"resend\" the message instead of forwarding it; |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1823 see the documentation of `rmail-resend'." |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1824 (interactive "P") |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1825 (if resend |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1826 (call-interactively 'rmail-resend) |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1827 (let ((forward-buffer (current-buffer)) |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1828 (subject (concat "[" |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1829 (let ((from (or (mail-fetch-field "From") |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1830 (mail-fetch-field ">From")))) |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1831 (if from |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1832 (concat (mail-strip-quoted-names from) ": ") |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1833 "")) |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1834 (or (mail-fetch-field "Subject") "") |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1835 "]"))) |
4579
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1836 ;; If only one window, use it for the mail buffer. |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1837 ;; Otherwise, use another window for the mail buffer |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1838 ;; so that the Rmail buffer remains visible |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1839 ;; and sending the mail will get back to it. |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1840 (if (funcall (if (and (not rmail-mail-new-frame) (one-window-p t)) |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1841 (function mail) |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1842 (function rmail-start-mail)) |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1843 nil nil subject nil nil nil |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1844 (list (list (function (lambda (buf msgnum) |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1845 (save-excursion |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1846 (set-buffer buf) |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1847 (rmail-set-attribute |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1848 "forwarded" t msgnum)))) |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1849 (current-buffer) |
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1850 rmail-current-message))) |
4263
7c7fa71cfd6e
(rmail-last-rmail-file): Initialize to a file name.
Richard M. Stallman <rms@gnu.org>
parents:
4108
diff
changeset
|
1851 (save-excursion |
4724
04714985ce20
(rmail-forward): Insert the text right after the header separator.
Richard M. Stallman <rms@gnu.org>
parents:
4698
diff
changeset
|
1852 ;; Insert after header separator--before signature if any. |
4764
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
1853 (goto-char (point-min)) |
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
1854 (search-forward-regexp |
0e239209a6db
(rmail-convert-file): If the file is empty, don't convert it after
Brian Fox <bfox@gnu.org>
parents:
4724
diff
changeset
|
1855 (concat "^" (regexp-quote mail-header-separator))) |
4263
7c7fa71cfd6e
(rmail-last-rmail-file): Initialize to a file name.
Richard M. Stallman <rms@gnu.org>
parents:
4108
diff
changeset
|
1856 (forward-line 1) |
4579
131a3edbd49f
(rmail-forward): Don't bind mail-signature, mail-setup-hook.
Richard M. Stallman <rms@gnu.org>
parents:
4457
diff
changeset
|
1857 (insert-buffer forward-buffer)))))) |
270 | 1858 |
1859 (defun rmail-resend (address &optional from comment mail-alias-file) | |
1860 "Resend current message to ADDRESSES. | |
5274
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1861 ADDRESSES should be a single address, a string consisting of several |
270 | 1862 addresses separated by commas, or a list of addresses. |
1863 | |
1864 Optional FROM is the address to resend the message from, and | |
1865 defaults to the username of the person redistributing the message. | |
1866 Optional COMMENT is a string that will be inserted as a comment in the | |
1867 resent message. | |
1868 Optional ALIAS-FILE is alternate aliases file to be used by sendmail, | |
1869 typically for purposes of moderating a list." | |
1870 (interactive "sResend to: ") | |
3484
bd26679f0db5
(rmail-resend): Require sendmail and mailalias.
Richard M. Stallman <rms@gnu.org>
parents:
3462
diff
changeset
|
1871 (require 'sendmail) |
bd26679f0db5
(rmail-resend): Require sendmail and mailalias.
Richard M. Stallman <rms@gnu.org>
parents:
3462
diff
changeset
|
1872 (require 'mailalias) |
270 | 1873 (if (not from) (setq from (user-login-name))) |
1874 (let ((tembuf (generate-new-buffer " sendmail temp")) | |
1875 (mail-header-separator "") | |
1876 (case-fold-search nil) | |
1877 (mailbuf (current-buffer))) | |
1878 (unwind-protect | |
1879 (save-excursion | |
1880 ;;>> Copy message into temp buffer | |
1881 (set-buffer tembuf) | |
1882 (insert-buffer-substring mailbuf) | |
1883 (goto-char (point-min)) | |
4457
acb5dda629d7
(rmail-resend): Delete any Sender field.
Richard M. Stallman <rms@gnu.org>
parents:
4340
diff
changeset
|
1884 ;; Delete any Sender field, since that's not specifyable. |
5274
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1885 ; Only delete Sender fields in the actual header. |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1886 (re-search-forward "^$" nil 'move) |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1887 ; Using "while" here rather than "if" because some buggy mail |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1888 ; software may have inserted multiple Sender fields. |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1889 (while (re-search-backward "^Sender:" nil t) |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1890 (let (beg) |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1891 (setq beg (point)) |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1892 (forward-line 1) |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1893 (while (looking-at "[ \t]") |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1894 (forward-line 1)) |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1895 (delete-region beg (point)))) |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1896 ; Go back to the beginning of the buffer so the Resent- fields |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1897 ; are inserted there. |
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1898 (goto-char (point-min)) |
270 | 1899 ;;>> Insert resent-from: |
1900 (insert "Resent-From: " from "\n") | |
4020
a35cd533fda4
(rmail-resend): Use RFC 822 style date in Resent-Date: line.
Richard M. Stallman <rms@gnu.org>
parents:
4010
diff
changeset
|
1901 (insert "Resent-Date: " (mail-rfc822-date) "\n") |
270 | 1902 ;;>> Insert resent-to: and bcc if need be. |
1903 (let ((before (point))) | |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1904 (if mail-self-blind |
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1905 (insert "Resent-Bcc: " (user-login-name) "\n")) |
270 | 1906 (insert "Resent-To: " (if (stringp address) |
1907 address | |
1908 (mapconcat 'identity address ",\n\t")) | |
1909 "\n") | |
1910 (expand-mail-aliases before (point))) | |
1911 ;;>> Set up comment, if any. | |
1912 (if (and (sequencep comment) (not (zerop (length comment)))) | |
1913 (let ((before (point)) | |
1914 after) | |
1915 (insert comment) | |
1916 (or (eolp) (insert "\n")) | |
1917 (setq after (point)) | |
1918 (goto-char before) | |
1919 (while (< (point) after) | |
1920 (insert "Resent-Comment: ") | |
1921 (forward-line 1)))) | |
1922 ;; Don't expand aliases in the destination fields | |
1923 ;; of the original message. | |
1924 (let (mail-aliases) | |
1925 (sendmail-send-it))) | |
2687
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1926 (kill-buffer tembuf)) |
37cca1d50b6a
(rmail-resend): Add `resent' attribute.
Richard M. Stallman <rms@gnu.org>
parents:
2571
diff
changeset
|
1927 (rmail-set-attribute "resent" t rmail-current-message))) |
270 | 1928 |
1267
1e1a54ebb29b
(mail-unsent-separator): Add another alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1165
diff
changeset
|
1929 (defvar mail-unsent-separator |
1370
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1930 (concat "^ *---+ +Unsent message follows +---+ *$\\|" |
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1931 "^ *---+ +Returned message +---+ *$\\|" |
1372
e839dc00fc2e
(mail-unsent-separator): Handle "Message text follows".
Richard M. Stallman <rms@gnu.org>
parents:
1370
diff
changeset
|
1932 "^ *---+ +Original message +---+ *$\\|" |
1757
7e85913523ef
(mail-unsent-separator): Add `-- begin message --'.
Richard M. Stallman <rms@gnu.org>
parents:
1704
diff
changeset
|
1933 "^ *--+ +begin message +--+ *$\\|" |
4838
754b38c0e941
(rmail): Really don't get new mail if file name was given.
Richard M. Stallman <rms@gnu.org>
parents:
4819
diff
changeset
|
1934 "^ *---+ +Original message follows +---+ *$\\|" |
1372
e839dc00fc2e
(mail-unsent-separator): Handle "Message text follows".
Richard M. Stallman <rms@gnu.org>
parents:
1370
diff
changeset
|
1935 "^|? *---+ +Message text follows: +---+ *|?$")) |
270 | 1936 |
1937 (defun rmail-retry-failure () | |
1938 "Edit a mail message which is based on the contents of the current message. | |
1939 For a message rejected by the mail system, extract the interesting headers and | |
5274
89b71a85be3e
(rmail-quit): Expunge without updating summary.
Richard M. Stallman <rms@gnu.org>
parents:
5192
diff
changeset
|
1940 the body of the original message." |
270 | 1941 (interactive) |
1942 (require 'mail-utils) | |
1943 (let (to subj irp2 cc orig-message) | |
1944 (save-excursion | |
1945 ;; Narrow down to just the quoted original message | |
1946 (rmail-beginning-of-message) | |
1370
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1947 (let ((case-fold-search t)) |
c017b62c8073
(mail-unsent-separator): Allow "original message" as alternative.
Richard M. Stallman <rms@gnu.org>
parents:
1360
diff
changeset
|
1948 (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
|
1949 (error "Cannot parse this as a failure message"))) |
270 | 1950 (save-restriction |
1951 (narrow-to-region (point) (point-max)) | |
1952 ;; Now mail-fetch-field will get from headers of the original message, | |
1953 ;; not from the headers of the rejection. | |
1954 (setq to (mail-fetch-field "To") | |
1955 subj (mail-fetch-field "Subject") | |
1956 irp2 (mail-fetch-field "In-reply-to") | |
1957 cc (mail-fetch-field "Cc")) | |
1958 ;; Get the entire text (not headers) of the original message. | |
1959 (setq orig-message | |
1960 (buffer-substring | |
1961 (progn (search-forward "\n\n") (point)) | |
1962 (point-max))))) | |
1963 ;; 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
|
1964 ;; Turn off the usual actions for initializing the message body |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1965 ;; because we want to get only the text from the failure message. |
4844
25d94807689e
(rmail-retry-setup-hook): New hook variable.
Richard M. Stallman <rms@gnu.org>
parents:
4838
diff
changeset
|
1966 (let (mail-signature |
25d94807689e
(rmail-retry-setup-hook): New hook variable.
Richard M. Stallman <rms@gnu.org>
parents:
4838
diff
changeset
|
1967 (mail-setup-hook rmail-retry-setup-hook)) |
4108
e4fbcd480455
(rmail-mail-new-frame): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
4071
diff
changeset
|
1968 (if (rmail-start-mail nil to subj irp2 cc (current-buffer)) |
1135
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1969 ;; Insert original text as initial text of new draft message. |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1970 (progn |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1971 (goto-char (point-max)) |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1972 (insert orig-message) |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1973 (goto-char (point-min)) |
e33f6475229a
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
1112
diff
changeset
|
1974 (end-of-line)))))) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1975 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1976 (defun rmail-bury () |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1977 "Bury current Rmail buffer and its summary buffer." |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1978 (interactive) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1979 (let ((rmail-buffer (current-buffer))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1980 (if (rmail-summary-exists) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1981 (let (window) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1982 (while (setq window (get-buffer-window rmail-summary-buffer)) |
3083
59b8b6ac30e0
(rmail-bury): Fix call to set-window-buffer.
Richard M. Stallman <rms@gnu.org>
parents:
2700
diff
changeset
|
1983 (set-window-buffer window (other-buffer rmail-summary-buffer))) |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1984 (bury-buffer rmail-summary-buffer))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1985 (switch-to-buffer (other-buffer (current-buffer))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1986 (bury-buffer rmail-buffer))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1987 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1988 (defun rmail-summary-exists () |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1989 "Non-nil iff in an RMAIL buffer and an associated summary buffer exists. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1990 Non-nil value returned is the summary buffer." |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1991 (and rmail-summary-buffer (buffer-name rmail-summary-buffer) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1992 rmail-summary-buffer)) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1993 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1994 (defun rmail-summary-displayed () |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1995 "t iff in RMAIL buffer and an associated summary buffer is displayed." |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1996 (and rmail-summary-buffer (get-buffer-window rmail-summary-buffer))) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1997 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1998 (defvar rmail-redisplay-summary nil |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
1999 "*Non-nil means Rmail should show the summary when it changes. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2000 This has an effect only if a summary buffer exists.") |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2001 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2002 ;; Put the summary buffer back on the screen, if user wants that. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2003 (defun rmail-maybe-display-summary () |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2004 (and rmail-summary-buffer (buffer-name rmail-summary-buffer) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2005 rmail-redisplay-summary |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2006 (display-buffer rmail-summary-buffer))) |
270 | 2007 |
2008 ;;;; *** Rmail Specify Inbox Files *** | |
2009 | |
2010 (autoload 'set-rmail-inbox-list "rmailmsc" | |
2011 "Set the inbox list of the current RMAIL file to FILE-NAME. | |
2012 This may be a list of file names separated by commas. | |
2013 If FILE-NAME is empty, remove any inbox list." | |
2014 t) | |
2015 | |
2016 ;;;; *** Rmail Commands for Labels *** | |
2017 | |
2018 (autoload 'rmail-add-label "rmailkwd" | |
2019 "Add LABEL to labels associated with current RMAIL message. | |
2020 Completion is performed over known labels when reading." | |
2021 t) | |
2022 | |
2023 (autoload 'rmail-kill-label "rmailkwd" | |
2024 "Remove LABEL from labels associated with current RMAIL message. | |
2025 Completion is performed over known labels when reading." | |
2026 t) | |
2027 | |
2028 (autoload 'rmail-next-labeled-message "rmailkwd" | |
2029 "Show next message with LABEL. Defaults to last label used. | |
2030 With prefix argument N moves forward N messages with this label." | |
2031 t) | |
2032 | |
2033 (autoload 'rmail-previous-labeled-message "rmailkwd" | |
2034 "Show previous message with LABEL. Defaults to last label used. | |
2035 With prefix argument N moves backward N messages with this label." | |
2036 t) | |
2037 | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2038 (autoload 'rmail-read-label "rmailkwd" |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2039 "PROMPT and read with completion an Rmail message label." |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2040 t) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2041 |
270 | 2042 ;;;; *** Rmail Edit Mode *** |
2043 | |
2044 (autoload 'rmail-edit-current-message "rmailedit" | |
2045 "Edit the contents of the current message" | |
2046 t) | |
3877
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2047 |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2048 ;;;; *** Rmail Sorting *** |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2049 |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2050 (autoload 'rmail-sort-by-date "rmailsort" |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2051 "Sort messages of current Rmail file by date. |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2052 If prefix argument REVERSE is non-nil, sort them in reverse order." t) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2053 |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2054 (autoload 'rmail-sort-by-subject "rmailsort" |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2055 "Sort messages of current Rmail file by subject. |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2056 If prefix argument REVERSE is non-nil, sort them in reverse order." t) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2057 |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2058 (autoload 'rmail-sort-by-author "rmailsort" |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2059 "Sort messages of current Rmail file by author. |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2060 If prefix argument REVERSE is non-nil, sort them in reverse order." t) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2061 |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2062 (autoload 'rmail-sort-by-recipient "rmailsort" |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2063 "Sort messages of current Rmail file by recipient. |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2064 If prefix argument REVERSE is non-nil, sort them in reverse order." t) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2065 |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2066 (autoload 'rmail-sort-by-correspondent "rmailsort" |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2067 "Sort messages of current Rmail file by other correspondent. |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2068 If prefix argument REVERSE is non-nil, sort them in reverse order." t) |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2069 |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2070 (autoload 'rmail-sort-by-lines "rmailsort" |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2071 "Sort messages of current Rmail file by number of lines. |
da9b565f9878
Add autoloads for rmailsort commands.
Richard M. Stallman <rms@gnu.org>
parents:
3864
diff
changeset
|
2072 If prefix argument REVERSE is non-nil, sort them in reverse order." t) |
270 | 2073 |
2074 ;;;; *** Rmail Summary Mode *** | |
2075 | |
2076 (autoload 'rmail-summary "rmailsum" | |
2077 "Display a summary of all messages, one line per message." | |
2078 t) | |
2079 | |
2080 (autoload 'rmail-summary-by-labels "rmailsum" | |
2081 "Display a summary of all messages with one or more LABELS. | |
2082 LABELS should be a string containing the desired labels, separated by commas." | |
2083 t) | |
2084 | |
2085 (autoload 'rmail-summary-by-recipients "rmailsum" | |
2086 "Display a summary of all messages with the given RECIPIENTS. | |
2087 Normally checks the To, From and Cc fields of headers; but if PRIMARY-ONLY | |
2088 is non-nil (prefix arg given), only look in the To and From fields. | |
2076
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2089 RECIPIENTS is a string of regexps separated by commas." |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2090 t) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2091 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2092 (autoload 'rmail-summary-by-regexp "rmailsum" |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2093 "Display a summary of all messages according to regexp REGEXP. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2094 If the regular expression is found in the header of the message |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2095 \(including in the date and other lines, as well as the subject line), |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2096 Emacs will list the header line in the RMAIL-summary." |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2097 t) |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2098 |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2099 (autoload 'rmail-summary-by-topic "rmailsum" |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2100 "Display a summary of all messages with the given SUBJECT. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2101 Normally checks the Subject field of headers; |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2102 but if WHOLE-MESSAGE is non-nil (prefix arg given), |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2103 look in the whole message. |
5140299129c3
(rmail-delete-forward): Go to summary buf to change D mark.
Richard M. Stallman <rms@gnu.org>
parents:
2006
diff
changeset
|
2104 SUBJECT is a string of regexps separated by commas." |
270 | 2105 t) |
2106 | |
2107 ;;;; *** Rmail output messages to files *** | |
2108 | |
2109 (autoload 'rmail-output-to-rmail-file "rmailout" | |
2110 "Append the current message to an Rmail file named FILE-NAME. | |
2111 If the file does not exist, ask if it should be created. | |
2112 If file is being visited, the message is appended to the Emacs | |
2113 buffer visiting that file." | |
2114 t) | |
2115 | |
2116 (autoload 'rmail-output "rmailout" | |
2117 "Append this message to Unix mail file named FILE-NAME." | |
2118 t) | |
2119 | |
2120 ;;;; *** Rmail undigestification *** | |
2121 | |
2122 (autoload 'undigestify-rmail-message "undigest" | |
2123 "Break up a digest message into its constituent messages. | |
2124 Leaves original message, deleted, before the undigestified messages." | |
2125 t) | |
584 | 2126 |
2127 (provide 'rmail) | |
2128 | |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
621
diff
changeset
|
2129 ;;; rmail.el ends here |