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