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