Mercurial > emacs
annotate lisp/mail/uce.el @ 95677:737dc8db789e
Initial check-in.
author | Ulf Jasper <ulf.jasper@web.de> |
---|---|
date | Sun, 08 Jun 2008 15:35:57 +0000 |
parents | ef65fa4dca3b |
children | a9dc0e7c3f2b |
rev | line source |
---|---|
17450 | 1 ;;; uce.el --- facilitate reply to unsolicited commercial email |
2 | |
74509 | 3 ;; Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, |
79712 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
17450 | 5 |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
6 ;; Author: stanislav shalunov <shalunov@mccme.ru> |
17450 | 7 ;; Created: 10 Dec 1996 |
8 ;; Keywords: uce, unsolicited commercial email | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
94674
ef65fa4dca3b
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
38401 | 13 ;; it under the terms of the GNU General Public License as published by |
94674
ef65fa4dca3b
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ef65fa4dca3b
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
17450 | 16 |
38401 | 17 ;; GNU Emacs is distributed in the hope that it will be useful, |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
17450 | 21 |
22 ;; You should have received a copy of the GNU General Public License | |
94674
ef65fa4dca3b
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
17450 | 24 |
25 ;;; Commentary: | |
26 | |
27 ;; Code in this file provides semi-automatic means of replying to | |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
28 ;; UCE's you might get. It works currently only with Rmail and Gnus. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
29 ;; If you would like to make it work with other mail readers, |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
30 ;; Rmail-specific section is marked below. If you want to play with |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
31 ;; code, please let me know about your changes so I can incorporate |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
32 ;; them. I'd appreciate it. |
17450 | 33 |
34 ;; Function uce-reply-to-uce, if called when current message in RMAIL | |
35 ;; buffer is a UCE, will setup *mail* buffer in the following way: it | |
36 ;; scans full headers of message for 1) normal return address of | |
37 ;; sender (From, Reply-To lines); and puts these addresses into To: | |
38 ;; header, it also puts abuse@offenders.host address there 2) mailhub | |
39 ;; that first saw this message; and puts address of its postmaster | |
40 ;; into To: header 3) finally, it looks at Message-Id and adds | |
41 ;; posmaster of that host to the list of addresses. | |
42 | |
43 ;; Then, we add "Errors-To: nobody@localhost" header, so that if some | |
44 ;; of these addresses are not actually correct, we will never see | |
45 ;; bounced mail. Also, mail-self-blind and mail-archive-file-name | |
46 ;; take no effect: the ideology is that we don't want to save junk or | |
47 ;; replies to junk. | |
48 | |
49 ;; Then we put template into buffer (customizable message that | |
50 ;; explains what has happened), customizable signature, and the | |
51 ;; original message with full headers and envelope for postmasters. | |
52 ;; Then buffer is left for editing. | |
53 | |
54 ;; The reason that function uce-reply-to-uce is Rmail dependant is | |
55 ;; that we want full headers of the original message, nothing | |
56 ;; stripped. If we use normal means of inserting of the original | |
57 ;; message into *mail* buffer headers like Received: (not really | |
58 ;; headers, but envelope lines) will be stripped while they bear | |
59 ;; valuable for us and postmasters information. I do wish that there | |
60 ;; would be some way to write this function in some portable way, but | |
61 ;; I am not aware of any. | |
62 | |
63 ;;; Change log: | |
64 | |
65 ;; Dec 10, 1996 -- posted draft version to gnu.sources.emacs | |
66 | |
67 ;; Dec 11, 1996 -- fixed some typos, and Francesco Potorti` | |
68 ;; <F.Potorti@cnuce.cnr.it> pointed out that my use of defvar was | |
69 ;; weird, suggested fix, and added let form. | |
70 | |
71 ;; Dec 17, 1996 -- made scanning for host names little bit more clever | |
72 ;; (obviously bogus stuff like localhost is now ignored). | |
73 | |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
74 ;; Nov 11, 1997 -- incorporated changes from Mikael Djurfeldt |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
75 ;; <mdj@nada.kth.se> to make uce.el work with Gnus. Changed the text |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
76 ;; of message that is sent. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
77 |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
78 ;; Dec 3, 1997 -- changes from Gareth Jones <gdj1@gdjones.demon.co.uk> |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
79 ;; handling Received headers following some line like `From:'. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
80 |
31224
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
81 ;; Aug 16, 2000 -- changes from Detlev Zundel |
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
82 ;; <detlev.zundel@stud.uni-karlsruhe.de> to make uce.el work with the |
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
83 ;; latest Gnus. Lars told him it should work for all versions of Gnus |
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
84 ;; younger than three years. |
17450 | 85 |
31224
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
86 ;; Setup: |
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
87 |
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
88 ;; Add the following line to your ~/.emacs: |
17450 | 89 |
90 ;; (autoload 'uce-reply-to-uce "uce" "Reply to UCEs" t nil) | |
91 | |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
92 ;; If you want to use it with Gnus also use |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
93 |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
94 ;; (setq uce-mail-reader 'gnus) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
95 |
17450 | 96 ;; store this file (uce.el) somewhere in load-path and byte-compile it. |
97 | |
98 ;;; Variables: | |
99 | |
100 ;; uce-message-text is template that will be inserted into buffer. It | |
101 ;; has reasonable default. If you want to write some scarier one, | |
102 ;; please do so and send it to me. Please keep it polite. | |
103 | |
104 ;; uce-signature behaves just like mail-signature. If nil, nothing is | |
105 ;; inserted, if t, file ~/.signature is used, if a string, its | |
106 ;; contents are inserted into buffer. | |
107 | |
108 ;; uce-uce-separator is line that separates your message from the UCE | |
109 ;; that you enclose. | |
110 | |
111 ;; uce-subject-line will be used as subject of outgoing message. If | |
112 ;; nil, left blank. | |
113 | |
114 ;;; Code: | |
115 | |
65205
98f74806263a
(gnus-original-article-buffer, mail-reply-buffer, rmail-current-message):
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
116 (defvar gnus-original-article-buffer) |
98f74806263a
(gnus-original-article-buffer, mail-reply-buffer, rmail-current-message):
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
117 (defvar mail-reply-buffer) |
98f74806263a
(gnus-original-article-buffer, mail-reply-buffer, rmail-current-message):
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
118 (defvar rmail-current-message) |
98f74806263a
(gnus-original-article-buffer, mail-reply-buffer, rmail-current-message):
Juanma Barranquero <lekktu@gmail.com>
parents:
64754
diff
changeset
|
119 |
17450 | 120 (require 'sendmail) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
121 ;; Those sections of code which are dependent upon |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
122 ;; RMAIL are only evaluated if we have received a message with RMAIL... |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
123 ;;(require 'rmail) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
124 |
20962 | 125 (defgroup uce nil |
126 "Facilitate reply to unsolicited commercial email." | |
127 :prefix "uce-" | |
128 :group 'mail) | |
129 | |
22462
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
130 (defcustom uce-mail-reader 'rmail |
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
131 "A symbol indicating which mail reader you are using. |
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
132 Choose from: `gnus', `rmail'." |
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
133 :type '(choice (const gnus) (const rmail)) |
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
134 :version "20.3" |
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
135 :group 'uce) |
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
136 |
20962 | 137 (defcustom uce-setup-hook nil |
17450 | 138 "Hook to run after UCE rant message is composed. |
22462
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
139 This hook is run after `mail-setup-hook', which is run as well." |
20962 | 140 :type 'hook |
141 :group 'uce) | |
17450 | 142 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
143 (defcustom uce-message-text |
17450 | 144 "Recently, I have received an Unsolicited Commercial E-mail from you. |
145 I do not like UCE's and I would like to inform you that sending | |
146 unsolicited messages to someone while he or she may have to pay for | |
147 reading your message may be illegal. Anyway, it is highly annoying | |
148 and not welcome by anyone. It is rude, after all. | |
149 | |
150 If you think that this is a good way to advertise your products or | |
151 services you are mistaken. Spamming will only make people hate you, not | |
152 buy from you. | |
153 | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
154 If you have any list of people you send unsolicited commercial emails to, |
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
155 REMOVE me from such list immediately. I suggest that you make this list |
17450 | 156 just empty. |
157 | |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
158 ---------------------------------------------------- |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
159 |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
160 If you are not an administrator of any site and still have received |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
161 this message then your email address is being abused by some spammer. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
162 They fake your address in From: or Reply-To: header. In this case, |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
163 you might want to show this message to your system administrator, and |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
164 ask him/her to investigate this matter. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
165 |
17450 | 166 Note to the postmaster(s): I append the text of UCE in question to |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
167 this message; I would like to hear from you about action(s) taken. |
17450 | 168 This message has been sent to postmasters at the host that is |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
169 mentioned as original sender's host (I do realize that it may be |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
170 faked, but I think that if your domain name is being abused this way |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
171 you might want to learn about it, and take actions) and to the |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
172 postmaster whose host was used as mail relay for this message. If |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
173 message was sent not by your user, could you please compare time when |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
174 this message was sent (use time in Received: field of the envelope |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
175 rather than Date: field) with your sendmail logs and see what host was |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
176 using your sendmail at this moment of time. |
17450 | 177 |
178 Thank you." | |
179 | |
22462
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
180 "This is the text that `uce-reply-to-uce' command will put in reply buffer. |
17450 | 181 Some of spamming programs in use will be set up to read all incoming |
182 to spam address email, and will remove people who put the word `remove' | |
183 on beginning of some line from the spamming list. So, when you set it | |
184 up, it might be a good idea to actually use this feature. | |
185 | |
20962 | 186 Value nil means insert no text by default, lets you type it in." |
187 :type 'string | |
188 :group 'uce) | |
17450 | 189 |
20962 | 190 (defcustom uce-uce-separator |
17450 | 191 "----- original unsolicited commercial email follows -----" |
192 "Line that will begin quoting of the UCE. | |
20962 | 193 Value nil means use no separator." |
194 :type '(choice (const nil) string) | |
195 :group 'uce) | |
17450 | 196 |
20962 | 197 (defcustom uce-signature mail-signature |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
198 "Text to put as your signature after the note to UCE sender. |
22462
198054d3498c
Several fixes in doc string style.
Richard M. Stallman <rms@gnu.org>
parents:
22416
diff
changeset
|
199 Value nil means none, t means insert `~/.signature' file (if it happens |
17450 | 200 to exist), if this variable is a string this string will be inserted |
20962 | 201 as your signature." |
202 :type '(choice (const nil) (const t) string) | |
203 :group 'uce) | |
17450 | 204 |
20962 | 205 (defcustom uce-default-headers |
17450 | 206 "Errors-To: nobody@localhost\nPrecedence: bulk\n" |
207 "Additional headers to use when responding to a UCE with \\[uce-reply-to-uce]. | |
20962 | 208 These are mostly meant for headers that prevent delivery errors reporting." |
209 :type 'string | |
210 :group 'uce) | |
17450 | 211 |
20962 | 212 (defcustom uce-subject-line |
17450 | 213 "Spam alert: unsolicited commercial e-mail" |
20962 | 214 "Subject of the message that will be sent in response to a UCE." |
215 :type 'string | |
216 :group 'uce) | |
17450 | 217 |
86440
4aedd218aad1
* mail/mspools.el (rmail-get-new-mail):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78232
diff
changeset
|
218 (declare-function mail-strip-quoted-names "mail-utils" (address)) |
86503
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86440
diff
changeset
|
219 (declare-function rmail-msg-is-pruned "rmail" ()) |
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86440
diff
changeset
|
220 (declare-function rmail-maybe-set-message-counters "rmail" ()) |
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86440
diff
changeset
|
221 (declare-function rmail-msgbeg "rmail" (n)) |
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86440
diff
changeset
|
222 (declare-function rmail-msgend "rmail" (n)) |
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86440
diff
changeset
|
223 (declare-function rmail-toggle-header "rmail" (&optional arg)) |
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
86440
diff
changeset
|
224 |
86440
4aedd218aad1
* mail/mspools.el (rmail-get-new-mail):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78232
diff
changeset
|
225 |
17450 | 226 (defun uce-reply-to-uce (&optional ignored) |
227 "Send reply to UCE in Rmail. | |
228 UCE stands for unsolicited commercial email. Function will set up reply | |
229 buffer with default To: to the sender, his postmaster, his abuse@ | |
230 address, and postmaster of the mail relay used." | |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
231 (interactive) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
232 (let ((message-buffer |
31224
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
233 (cond ((eq uce-mail-reader 'gnus) gnus-original-article-buffer) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
234 ((eq uce-mail-reader 'rmail) "RMAIL") |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
235 (t (error |
43067
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
236 "Variable uce-mail-reader set to unrecognized value")))) |
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
237 (full-header-p (and (eq uce-mail-reader 'rmail) |
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
238 (not (rmail-msg-is-pruned))))) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
239 (or (get-buffer message-buffer) |
87169
ac7eee19fc7e
Improves calls to `error', per mail from RMS.
Deepak Goel <deego@gnufans.org>
parents:
87141
diff
changeset
|
240 (error "No buffer %s, cannot find UCE" message-buffer)) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
241 (switch-to-buffer message-buffer) |
43067
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
242 ;; We need the message with headers pruned. |
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
243 (if full-header-p |
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
244 (rmail-toggle-header 1)) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
245 (let ((to (mail-strip-quoted-names (mail-fetch-field "from" t))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
246 (reply-to (mail-fetch-field "reply-to")) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
247 temp) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
248 ;; Initial setting of the list of recipients of our message; that's |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
249 ;; what they are pretending to be. |
17450 | 250 (if to |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
251 (setq to (format "%s" (mail-strip-quoted-names to))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
252 (setq to "")) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
253 (if reply-to |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
254 (setq to (format "%s, %s" to (mail-strip-quoted-names reply-to)))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
255 (let (first-at-sign end-of-hostname sender-host) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
256 (setq first-at-sign (string-match "@" to) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
257 end-of-hostname (string-match "[ ,>]" to first-at-sign) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
258 sender-host (substring to first-at-sign end-of-hostname)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
259 (if (string-match "\\." sender-host) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
260 (setq to (format "%s, postmaster%s, abuse%s" |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
261 to sender-host sender-host)))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
262 (setq mail-send-actions nil) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
263 (setq mail-reply-buffer nil) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
264 (cond ((eq uce-mail-reader 'gnus) |
31224
fa7a79afcbf7
(uce-reply-to-uce): Remove hard-coded "*Article*" from
Gerd Moellmann <gerd@gnu.org>
parents:
23458
diff
changeset
|
265 (copy-region-as-kill (point-min) (point-max))) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
266 ((eq uce-mail-reader 'rmail) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
267 (save-excursion |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
268 (save-restriction |
43387
3a4e24e20c8d
(uce-reply-to-uce): Fix incorrect behavior when
Richard M. Stallman <rms@gnu.org>
parents:
43067
diff
changeset
|
269 (rmail-toggle-header 1) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
270 (widen) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
271 (rmail-maybe-set-message-counters) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
272 (copy-region-as-kill (rmail-msgbeg rmail-current-message) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
273 (rmail-msgend rmail-current-message)))))) |
43067
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
274 ;; Restore the pruned header state we found. |
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
275 (if full-header-p |
858e5cbf508c
(uce-reply-to-uce): Prune the headers before copying
Eli Zaretskii <eliz@gnu.org>
parents:
38401
diff
changeset
|
276 (rmail-toggle-header 0)) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
277 (switch-to-buffer "*mail*") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
278 (erase-buffer) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
279 (setq temp (point)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
280 (yank) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
281 (goto-char temp) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
282 (if (eq uce-mail-reader 'rmail) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
283 (progn |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
284 (forward-line 2) |
23458
f68b71f7b9fd
(uce-reply-to-uce): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents:
22462
diff
changeset
|
285 (let ((case-fold-search t)) |
f68b71f7b9fd
(uce-reply-to-uce): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents:
22462
diff
changeset
|
286 (while (looking-at "Summary-Line:\\|Mail-From:") |
f68b71f7b9fd
(uce-reply-to-uce): Bind case-fold-search.
Richard M. Stallman <rms@gnu.org>
parents:
22462
diff
changeset
|
287 (forward-line 1))) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
288 (delete-region temp (point)))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
289 ;; Now find the mail hub that first accepted this message. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
290 ;; This should try to find the last Received: header. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
291 ;; Sometimes there may be other headers inbetween Received: headers. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
292 (cond ((eq uce-mail-reader 'gnus) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
293 ;; Does Gnus always have Lines: in the end? |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
294 (re-search-forward "^Lines:") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
295 (beginning-of-line)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
296 ((eq uce-mail-reader 'rmail) |
64386
d24c0f192f20
(uce-reply-to-uce): Replace beginning-of-buffer and insert-file.
Richard M. Stallman <rms@gnu.org>
parents:
64085
diff
changeset
|
297 (goto-char (point-min)) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
298 (search-forward "*** EOOH ***\n") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
299 (beginning-of-line) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
300 (forward-line -1))) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
301 (re-search-backward "^Received:") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
302 (beginning-of-line) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
303 ;; Is this always good? It's the only thing I saw when I checked |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
304 ;; a few messages. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
305 (let ((eol (save-excursion (end-of-line) (point)))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
306 ;;(if (not (re-search-forward ": \\(from\\|by\\) " eol t)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
307 (if (not (re-search-forward "\\(from\\|by\\) " eol t)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
308 (progn |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
309 (goto-char eol) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
310 (if (looking-at "[ \t\n]+\\(from\\|by\\) ") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
311 (goto-char (match-end 0)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
312 (error "Failed to extract hub address"))))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
313 (setq temp (point)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
314 (search-forward " ") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
315 (forward-char -1) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
316 ;; And add its postmaster to the list of addresses. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
317 (if (string-match "\\." (buffer-substring temp (point))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
318 (setq to (format "%s, postmaster@%s" |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
319 to (buffer-substring temp (point))))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
320 ;; Also look at the message-id, it helps *very* often. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
321 (if (and (search-forward "\nMessage-Id: " nil t) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
322 ;; Not all Message-Id:'s have an `@' sign. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
323 (let ((bol (point)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
324 eol) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
325 (end-of-line) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
326 (setq eol (point)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
327 (goto-char bol) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
328 (search-forward "@" eol t))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
329 (progn |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
330 (setq temp (point)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
331 (search-forward ">") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
332 (forward-char -1) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
333 (if (string-match "\\." (buffer-substring temp (point))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
334 (setq to (format "%s, postmaster@%s" |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
335 to (buffer-substring temp (point))))))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
336 (cond ((eq uce-mail-reader 'gnus) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
337 ;; Does Gnus always have Lines: in the end? |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
338 (re-search-forward "^Lines:") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
339 (beginning-of-line)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
340 ((eq uce-mail-reader 'rmail) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
341 (search-forward "\n*** EOOH ***\n") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
342 (forward-line -1))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
343 (setq temp (point)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
344 (search-forward "\n\n" nil t) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
345 (if (eq uce-mail-reader 'gnus) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
346 (forward-line -1)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
347 (delete-region temp (point)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
348 ;; End of Rmail dependent section. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
349 (auto-save-mode auto-save-default) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
350 (mail-mode) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
351 (goto-char (point-min)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
352 (insert "To: ") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
353 (save-excursion |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
354 (if to |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
355 (let ((fill-prefix "\t") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
356 (address-start (point))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
357 (insert to "\n") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
358 (fill-region-as-paragraph address-start (point))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
359 (newline)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
360 (insert "Subject: " uce-subject-line "\n") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
361 (if uce-default-headers |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
362 (insert uce-default-headers)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
363 (if mail-default-headers |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
364 (insert mail-default-headers)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
365 (if mail-default-reply-to |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
366 (insert "Reply-to: " mail-default-reply-to "\n")) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
367 (insert mail-header-separator "\n") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
368 ;; Insert all our text. Then go back to the place where we started. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
369 (if to (setq to (point))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
370 ;; Text of ranting. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
371 (if uce-message-text |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
372 (insert uce-message-text)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
373 ;; Signature. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
374 (cond ((eq uce-signature t) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
375 (if (file-exists-p "~/.signature") |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
376 (progn |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
377 (insert "\n\n-- \n") |
64386
d24c0f192f20
(uce-reply-to-uce): Replace beginning-of-buffer and insert-file.
Richard M. Stallman <rms@gnu.org>
parents:
64085
diff
changeset
|
378 (forward-char (cadr (insert-file-contents "~/.signature")))))) |
22416
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
379 (uce-signature |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
380 (insert "\n\n-- \n" uce-signature))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
381 ;; And text of the original message. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
382 (if uce-uce-separator |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
383 (insert "\n\n" uce-uce-separator "\n")) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
384 ;; If message doesn't end with a newline, insert it. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
385 (goto-char (point-max)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
386 (or (bolp) (newline))) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
387 ;; And go back to the beginning of text. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
388 (if to (goto-char to)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
389 (or to (set-buffer-modified-p nil)) |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
390 ;; Run hooks before we leave buffer for editing. Reasonable usage |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
391 ;; might be to set up special key bindings, replace standart |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
392 ;; functions in mail-mode, etc. |
a517da228cb9
(uce-message-text): Change the text of message that is sent.
Richard M. Stallman <rms@gnu.org>
parents:
21918
diff
changeset
|
393 (run-hooks 'mail-setup-hook 'uce-setup-hook)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43387
diff
changeset
|
394 |
17450 | 395 (defun uce-insert-ranting (&optional ignored) |
396 "Insert text of the usual reply to UCE into current buffer." | |
397 (interactive "P") | |
398 (insert uce-message-text)) | |
399 | |
400 (provide 'uce) | |
401 | |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
402 ;; arch-tag: 44b68c87-9b29-47bd-822c-3feee3883221 |
17450 | 403 ;;; uce.el ends here |