Mercurial > emacs
annotate lisp/gnus/message.el @ 33025:9559a9aeff3c
(custom-add-to-group): Allow multiple entries for a given value OPTION,
as long as their widget types are different.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sun, 29 Oct 2000 14:49:58 +0000 |
parents | 7625203dacf3 |
children | e07128cd595f |
rev | line source |
---|---|
17493 | 1 ;;; message.el --- composing mail and news messages |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3 ;; Free Software Foundation, Inc. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6 ;; Maintainer: bugs@gnus.org |
17493 | 7 ;; Keywords: mail, news |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
25 | |
26 ;;; Commentary: | |
27 | |
28 ;; This mode provides mail-sending facilities from within Emacs. It | |
29 ;; consists mainly of large chunks of code from the sendmail.el, | |
30 ;; gnus-msg.el and rnewspost.el files. | |
31 | |
32 ;;; Code: | |
33 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
34 (eval-when-compile |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
35 (require 'cl) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
36 (defvar gnus-list-identifiers)) ; gnus-sum is required where necessary |
17493 | 37 (require 'mailheader) |
38 (require 'nnheader) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
39 ;; This is apparently necessary even though things are autoloaded: |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
40 (if (featurep 'xemacs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
41 (require 'mail-abbrevs)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
42 (require 'mail-parse) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
43 (require 'mml) |
17493 | 44 |
45 (defgroup message '((user-mail-address custom-variable) | |
46 (user-full-name custom-variable)) | |
47 "Mail and news message composing." | |
48 :link '(custom-manual "(message)Top") | |
49 :group 'mail | |
50 :group 'news) | |
51 | |
52 (put 'user-mail-address 'custom-type 'string) | |
53 (put 'user-full-name 'custom-type 'string) | |
54 | |
55 (defgroup message-various nil | |
56 "Various Message Variables" | |
57 :link '(custom-manual "(message)Various Message Variables") | |
58 :group 'message) | |
59 | |
60 (defgroup message-buffers nil | |
61 "Message Buffers" | |
62 :link '(custom-manual "(message)Message Buffers") | |
63 :group 'message) | |
64 | |
65 (defgroup message-sending nil | |
66 "Message Sending" | |
67 :link '(custom-manual "(message)Sending Variables") | |
68 :group 'message) | |
69 | |
70 (defgroup message-interface nil | |
71 "Message Interface" | |
72 :link '(custom-manual "(message)Interface") | |
73 :group 'message) | |
74 | |
75 (defgroup message-forwarding nil | |
76 "Message Forwarding" | |
77 :link '(custom-manual "(message)Forwarding") | |
78 :group 'message-interface) | |
79 | |
80 (defgroup message-insertion nil | |
81 "Message Insertion" | |
82 :link '(custom-manual "(message)Insertion") | |
83 :group 'message) | |
84 | |
85 (defgroup message-headers nil | |
86 "Message Headers" | |
87 :link '(custom-manual "(message)Message Headers") | |
88 :group 'message) | |
89 | |
90 (defgroup message-news nil | |
91 "Composing News Messages" | |
92 :group 'message) | |
93 | |
94 (defgroup message-mail nil | |
95 "Composing Mail Messages" | |
96 :group 'message) | |
97 | |
98 (defgroup message-faces nil | |
99 "Faces used for message composing." | |
100 :group 'message | |
101 :group 'faces) | |
102 | |
103 (defcustom message-directory "~/Mail/" | |
104 "*Directory from which all other mail file variables are derived." | |
105 :group 'message-various | |
106 :type 'directory) | |
107 | |
108 (defcustom message-max-buffers 10 | |
109 "*How many buffers to keep before starting to kill them off." | |
110 :group 'message-buffers | |
111 :type 'integer) | |
112 | |
113 (defcustom message-send-rename-function nil | |
114 "Function called to rename the buffer after sending it." | |
115 :group 'message-buffers | |
116 :type 'function) | |
117 | |
118 (defcustom message-fcc-handler-function 'message-output | |
119 "*A function called to save outgoing articles. | |
120 This function will be called with the name of the file to store the | |
121 article in. The default function is `message-output' which saves in Unix | |
122 mailbox format." | |
123 :type '(radio (function-item message-output) | |
124 (function :tag "Other")) | |
125 :group 'message-sending) | |
126 | |
127 (defcustom message-courtesy-message | |
128 "The following message is a courtesy copy of an article\nthat has been posted to %s as well.\n\n" | |
129 "*This is inserted at the start of a mailed copy of a posted message. | |
130 If the string contains the format spec \"%s\", the Newsgroups | |
131 the article has been posted to will be inserted there. | |
132 If this variable is nil, no such courtesy message will be added." | |
133 :group 'message-sending | |
134 :type 'string) | |
135 | |
136 (defcustom message-ignored-bounced-headers "^\\(Received\\|Return-Path\\):" | |
137 "*Regexp that matches headers to be removed in resent bounced mail." | |
138 :group 'message-interface | |
139 :type 'regexp) | |
140 | |
141 ;;;###autoload | |
142 (defcustom message-from-style 'default | |
143 "*Specifies how \"From\" headers look. | |
144 | |
145 If `nil', they contain just the return address like: | |
146 king@grassland.com | |
147 If `parens', they look like: | |
148 king@grassland.com (Elvis Parsley) | |
149 If `angles', they look like: | |
150 Elvis Parsley <king@grassland.com> | |
151 | |
152 Otherwise, most addresses look like `angles', but they look like | |
153 `parens' if `angles' would need quoting and `parens' would not." | |
154 :type '(choice (const :tag "simple" nil) | |
155 (const parens) | |
156 (const angles) | |
157 (const default)) | |
158 :group 'message-headers) | |
159 | |
160 (defcustom message-syntax-checks nil | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
161 ;; Guess this one shouldn't be easy to customize... |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
162 "*Controls what syntax checks should not be performed on outgoing posts. |
17493 | 163 To disable checking of long signatures, for instance, add |
164 `(signature . disabled)' to this list. | |
165 | |
166 Don't touch this variable unless you really know what you're doing. | |
167 | |
168 Checks include subject-cmsg multiple-headers sendsys message-id from | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
169 long-lines control-chars size new-text quoting-style |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
170 redirected-followup signature approved sender empty empty-headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
171 message-id from subject shorten-followup-to existing-newsgroups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
172 buffer-file-name unchanged newsgroups." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
173 :group 'message-news |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
174 :type '(repeat sexp)) |
17493 | 175 |
176 (defcustom message-required-news-headers | |
177 '(From Newsgroups Subject Date Message-ID | |
178 (optional . Organization) Lines | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
179 (optional . User-Agent)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
180 "*Headers to be generated or prompted for when posting an article. |
17493 | 181 RFC977 and RFC1036 require From, Date, Newsgroups, Subject, |
182 Message-ID. Organization, Lines, In-Reply-To, Expires, and | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
183 User-Agent are optional. If don't you want message to insert some |
17493 | 184 header, remove it from this list." |
185 :group 'message-news | |
186 :group 'message-headers | |
187 :type '(repeat sexp)) | |
188 | |
189 (defcustom message-required-mail-headers | |
190 '(From Subject Date (optional . In-Reply-To) Message-ID Lines | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
191 (optional . User-Agent)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
192 "*Headers to be generated or prompted for when mailing a message. |
17493 | 193 RFC822 required that From, Date, To, Subject and Message-ID be |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
194 included. Organization, Lines and User-Agent are optional." |
17493 | 195 :group 'message-mail |
196 :group 'message-headers | |
197 :type '(repeat sexp)) | |
198 | |
199 (defcustom message-deletable-headers '(Message-ID Date Lines) | |
200 "Headers to be deleted if they already exist and were generated by message previously." | |
201 :group 'message-headers | |
202 :type 'sexp) | |
203 | |
204 (defcustom message-ignored-news-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
205 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:" |
17493 | 206 "*Regexp of headers to be removed unconditionally before posting." |
207 :group 'message-news | |
208 :group 'message-headers | |
209 :type 'regexp) | |
210 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
211 (defcustom message-ignored-mail-headers "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:" |
17493 | 212 "*Regexp of headers to be removed unconditionally before mailing." |
213 :group 'message-mail | |
214 :group 'message-headers | |
215 :type 'regexp) | |
216 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
217 (defcustom message-ignored-supersedes-headers "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|^X-Trace:\\|^X-Complaints-To:\\|Return-Path:\\|^Supersedes:\\|^NNTP-Posting-Date:\\|^X-Trace:\\|^X-Complaints-To:" |
17493 | 218 "*Header lines matching this regexp will be deleted before posting. |
219 It's best to delete old Path and Date headers before posting to avoid | |
220 any confusion." | |
221 :group 'message-interface | |
222 :type 'regexp) | |
223 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
224 (defcustom message-subject-re-regexp "^[ \t]*\\([Rr][Ee]:[ \t]*\\)*[ \t]*" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
225 "*Regexp matching \"Re: \" in the subject line." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
226 :group 'message-various |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
227 :type 'regexp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
228 |
17493 | 229 ;;;###autoload |
230 (defcustom message-signature-separator "^-- *$" | |
231 "Regexp matching the signature separator." | |
232 :type 'regexp | |
233 :group 'message-various) | |
234 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
235 (defcustom message-elide-ellipsis "\n[...]\n\n" |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
236 "*The string which is inserted for elided text." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
237 :type 'string |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
238 :group 'message-various) |
17493 | 239 |
240 (defcustom message-interactive nil | |
241 "Non-nil means when sending a message wait for and display errors. | |
242 nil means let mailer mail back a message to report errors." | |
243 :group 'message-sending | |
244 :group 'message-mail | |
245 :type 'boolean) | |
246 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
247 (defcustom message-generate-new-buffers 'unique |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
248 "*Non-nil means that a new message buffer will be created whenever `message-setup' is called. |
17493 | 249 If this is a function, call that function with three parameters: The type, |
250 the to address and the group name. (Any of these may be nil.) The function | |
251 should return the new buffer name." | |
252 :group 'message-buffers | |
253 :type '(choice (const :tag "off" nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
254 (const :tag "unique" unique) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
255 (const :tag "unsent" unsent) |
17493 | 256 (function fun))) |
257 | |
258 (defcustom message-kill-buffer-on-exit nil | |
259 "*Non-nil means that the message buffer will be killed after sending a message." | |
260 :group 'message-buffers | |
261 :type 'boolean) | |
262 | |
263 (defvar gnus-local-organization) | |
264 (defcustom message-user-organization | |
265 (or (and (boundp 'gnus-local-organization) | |
266 (stringp gnus-local-organization) | |
267 gnus-local-organization) | |
268 (getenv "ORGANIZATION") | |
269 t) | |
270 "*String to be used as an Organization header. | |
271 If t, use `message-user-organization-file'." | |
272 :group 'message-headers | |
273 :type '(choice string | |
274 (const :tag "consult file" t))) | |
275 | |
276 ;;;###autoload | |
277 (defcustom message-user-organization-file "/usr/lib/news/organization" | |
278 "*Local news organization file." | |
279 :type 'file | |
280 :group 'message-headers) | |
281 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
282 (defcustom message-make-forward-subject-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
283 'message-forward-subject-author-subject |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
284 "*A list of functions that are called to generate a subject header for forwarded messages. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
285 The subject generated by the previous function is passed into each |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
286 successive function. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
287 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
288 The provided functions are: |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
289 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
290 * message-forward-subject-author-subject (Source of article (author or |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
291 newsgroup)), in brackets followed by the subject |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
292 * message-forward-subject-fwd (Subject of article with 'Fwd:' prepended |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
293 to it." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
294 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
295 :type '(radio (function-item message-forward-subject-author-subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
296 (function-item message-forward-subject-fwd))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
297 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
298 (defcustom message-forward-as-mime t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
299 "*If non-nil, forward messages as an inline/rfc822 MIME section. Otherwise, directly inline the old message in the forwarded message." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
300 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
301 :type 'boolean) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
302 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
303 (defcustom message-forward-show-mml t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
304 "*If non-nil, forward messages are shown as mml. Otherwise, forward messages are unchanged." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
305 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
306 :type 'boolean) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
307 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
308 (defcustom message-forward-before-signature t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
309 "*If non-nil, put forwarded message before signature, else after." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
310 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
311 :type 'boolean) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
312 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
313 (defcustom message-wash-forwarded-subjects nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
314 "*If non-nil, try to remove as much old cruft as possible from the subject of messages before generating the new subject of a forward." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
315 :group 'message-forwarding |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
316 :type 'boolean) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
317 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
318 (defcustom message-ignored-resent-headers "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:" |
17493 | 319 "*All headers that match this regexp will be deleted when resending a message." |
320 :group 'message-interface | |
321 :type 'regexp) | |
322 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
323 (defcustom message-forward-ignored-headers "^Content-Transfer-Encoding:\\|^X-Gnus" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
324 "*All headers that match this regexp will be deleted when forwarding a message." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
325 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
326 :type '(choice (const :tag "None" nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
327 regexp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
328 |
17493 | 329 (defcustom message-ignored-cited-headers "." |
330 "*Delete these headers from the messages you yank." | |
331 :group 'message-insertion | |
332 :type 'regexp) | |
333 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
334 (defcustom message-cancel-message "I am canceling my own article.\n" |
17493 | 335 "Message to be inserted in the cancel message." |
336 :group 'message-interface | |
337 :type 'string) | |
338 | |
339 ;; Useful to set in site-init.el | |
340 ;;;###autoload | |
341 (defcustom message-send-mail-function 'message-send-mail-with-sendmail | |
342 "Function to call to send the current buffer as mail. | |
343 The headers should be delimited by a line whose contents match the | |
344 variable `mail-header-separator'. | |
345 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
346 Valid values include `message-send-mail-with-sendmail' (the default), |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
347 `message-send-mail-with-mh', `message-send-mail-with-qmail' and |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
348 `smtpmail-send-it'." |
17493 | 349 :type '(radio (function-item message-send-mail-with-sendmail) |
350 (function-item message-send-mail-with-mh) | |
351 (function-item message-send-mail-with-qmail) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
352 (function-item smtpmail-send-it) |
17493 | 353 (function :tag "Other")) |
354 :group 'message-sending | |
355 :group 'message-mail) | |
356 | |
357 (defcustom message-send-news-function 'message-send-news | |
358 "Function to call to send the current buffer as news. | |
359 The headers should be delimited by a line whose contents match the | |
360 variable `mail-header-separator'." | |
361 :group 'message-sending | |
362 :group 'message-news | |
363 :type 'function) | |
364 | |
365 (defcustom message-reply-to-function nil | |
366 "Function that should return a list of headers. | |
367 This function should pick out addresses from the To, Cc, and From headers | |
368 and respond with new To and Cc headers." | |
369 :group 'message-interface | |
370 :type 'function) | |
371 | |
372 (defcustom message-wide-reply-to-function nil | |
373 "Function that should return a list of headers. | |
374 This function should pick out addresses from the To, Cc, and From headers | |
375 and respond with new To and Cc headers." | |
376 :group 'message-interface | |
377 :type 'function) | |
378 | |
379 (defcustom message-followup-to-function nil | |
380 "Function that should return a list of headers. | |
381 This function should pick out addresses from the To, Cc, and From headers | |
382 and respond with new To and Cc headers." | |
383 :group 'message-interface | |
384 :type 'function) | |
385 | |
386 (defcustom message-use-followup-to 'ask | |
387 "*Specifies what to do with Followup-To header. | |
388 If nil, always ignore the header. If it is t, use its value, but | |
389 query before using the \"poster\" value. If it is the symbol `ask', | |
390 always query the user whether to use the value. If it is the symbol | |
391 `use', always use the value." | |
392 :group 'message-interface | |
393 :type '(choice (const :tag "ignore" nil) | |
394 (const use) | |
395 (const ask))) | |
396 | |
397 (defcustom message-sendmail-f-is-evil nil | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
398 "*Non-nil means that \"-f username\" should not be added to the sendmail command line. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
399 Doing so would be even more evil than leaving it out." |
17493 | 400 :group 'message-sending |
401 :type 'boolean) | |
402 | |
403 ;; qmail-related stuff | |
404 (defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject" | |
405 "Location of the qmail-inject program." | |
406 :group 'message-sending | |
407 :type 'file) | |
408 | |
409 (defcustom message-qmail-inject-args nil | |
410 "Arguments passed to qmail-inject programs. | |
411 This should be a list of strings, one string for each argument. | |
412 | |
413 For e.g., if you wish to set the envelope sender address so that bounces | |
414 go to the right place or to deal with listserv's usage of that address, you | |
415 might set this variable to '(\"-f\" \"you@some.where\")." | |
416 :group 'message-sending | |
417 :type '(repeat string)) | |
418 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
419 (defvar message-cater-to-broken-inn t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
420 "Non-nil means Gnus should not fold the `References' header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
421 Folding `References' makes ancient versions of INN create incorrect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
422 NOV lines.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
423 |
17493 | 424 (defvar gnus-post-method) |
425 (defvar gnus-select-method) | |
426 (defcustom message-post-method | |
427 (cond ((and (boundp 'gnus-post-method) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
428 (listp gnus-post-method) |
17493 | 429 gnus-post-method) |
430 gnus-post-method) | |
431 ((boundp 'gnus-select-method) | |
432 gnus-select-method) | |
433 (t '(nnspool ""))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
434 "*Method used to post news. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
435 Note that when posting from inside Gnus, for instance, this |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
436 variable isn't used." |
17493 | 437 :group 'message-news |
438 :group 'message-sending | |
439 ;; This should be the `gnus-select-method' widget, but that might | |
440 ;; create a dependence to `gnus.el'. | |
441 :type 'sexp) | |
442 | |
443 (defcustom message-generate-headers-first nil | |
444 "*If non-nil, generate all possible headers before composing." | |
445 :group 'message-headers | |
446 :type 'boolean) | |
447 | |
448 (defcustom message-setup-hook nil | |
449 "Normal hook, run each time a new outgoing message is initialized. | |
450 The function `message-setup' runs this hook." | |
451 :group 'message-various | |
452 :type 'hook) | |
453 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
454 (defcustom message-cancel-hook nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
455 "Hook run when cancelling articles." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
456 :group 'message-various |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
457 :type 'hook) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
458 |
17493 | 459 (defcustom message-signature-setup-hook nil |
460 "Normal hook, run each time a new outgoing message is initialized. | |
461 It is run after the headers have been inserted and before | |
462 the signature is inserted." | |
463 :group 'message-various | |
464 :type 'hook) | |
465 | |
466 (defcustom message-mode-hook nil | |
467 "Hook run in message mode buffers." | |
468 :group 'message-various | |
469 :type 'hook) | |
470 | |
471 (defcustom message-header-hook nil | |
472 "Hook run in a message mode buffer narrowed to the headers." | |
473 :group 'message-various | |
474 :type 'hook) | |
475 | |
476 (defcustom message-header-setup-hook nil | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
477 "Hook called narrowed to the headers when setting up a message buffer." |
17493 | 478 :group 'message-various |
479 :type 'hook) | |
480 | |
481 ;;;###autoload | |
482 (defcustom message-citation-line-function 'message-insert-citation-line | |
483 "*Function called to insert the \"Whomever writes:\" line." | |
484 :type 'function | |
485 :group 'message-insertion) | |
486 | |
487 ;;;###autoload | |
488 (defcustom message-yank-prefix "> " | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
489 "*Prefix inserted on the lines of yanked messages." |
17493 | 490 :type 'string |
491 :group 'message-insertion) | |
492 | |
493 (defcustom message-indentation-spaces 3 | |
494 "*Number of spaces to insert at the beginning of each cited line. | |
495 Used by `message-yank-original' via `message-yank-cite'." | |
496 :group 'message-insertion | |
497 :type 'integer) | |
498 | |
499 ;;;###autoload | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
500 (defcustom message-cite-function 'message-cite-original |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
501 "*Function for citing an original message. |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
502 Predefined functions include `message-cite-original' and |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
503 `message-cite-original-without-signature'. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
504 Note that `message-cite-original' uses `mail-citation-hook' if that is non-nil." |
17493 | 505 :type '(radio (function-item message-cite-original) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
506 (function-item message-cite-original-without-signature) |
17493 | 507 (function-item sc-cite-original) |
508 (function :tag "Other")) | |
509 :group 'message-insertion) | |
510 | |
511 ;;;###autoload | |
512 (defcustom message-indent-citation-function 'message-indent-citation | |
513 "*Function for modifying a citation just inserted in the mail buffer. | |
514 This can also be a list of functions. Each function can find the | |
515 citation between (point) and (mark t). And each function should leave | |
516 point and mark around the citation text as modified." | |
517 :type 'function | |
518 :group 'message-insertion) | |
519 | |
520 (defvar message-abbrevs-loaded nil) | |
521 | |
522 ;;;###autoload | |
523 (defcustom message-signature t | |
524 "*String to be inserted at the end of the message buffer. | |
525 If t, the `message-signature-file' file will be inserted instead. | |
526 If a function, the result from the function will be used instead. | |
527 If a form, the result from the form will be used instead." | |
528 :type 'sexp | |
529 :group 'message-insertion) | |
530 | |
531 ;;;###autoload | |
532 (defcustom message-signature-file "~/.signature" | |
533 "*File containing the text inserted at end of message buffer." | |
534 :type 'file | |
535 :group 'message-insertion) | |
536 | |
537 (defcustom message-distribution-function nil | |
538 "*Function called to return a Distribution header." | |
539 :group 'message-news | |
540 :group 'message-headers | |
541 :type 'function) | |
542 | |
543 (defcustom message-expires 14 | |
544 "Number of days before your article expires." | |
545 :group 'message-news | |
546 :group 'message-headers | |
547 :link '(custom-manual "(message)News Headers") | |
548 :type 'integer) | |
549 | |
550 (defcustom message-user-path nil | |
551 "If nil, use the NNTP server name in the Path header. | |
552 If stringp, use this; if non-nil, use no host name (user name only)." | |
553 :group 'message-news | |
554 :group 'message-headers | |
555 :link '(custom-manual "(message)News Headers") | |
556 :type '(choice (const :tag "nntp" nil) | |
557 (string :tag "name") | |
558 (sexp :tag "none" :format "%t" t))) | |
559 | |
560 (defvar message-reply-buffer nil) | |
561 (defvar message-reply-headers nil) | |
562 (defvar message-newsreader nil) | |
563 (defvar message-mailer nil) | |
564 (defvar message-sent-message-via nil) | |
565 (defvar message-checksum nil) | |
566 (defvar message-send-actions nil | |
567 "A list of actions to be performed upon successful sending of a message.") | |
568 (defvar message-exit-actions nil | |
569 "A list of actions to be performed upon exiting after sending a message.") | |
570 (defvar message-kill-actions nil | |
571 "A list of actions to be performed before killing a message buffer.") | |
572 (defvar message-postpone-actions nil | |
573 "A list of actions to be performed after postponing a message.") | |
574 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
575 (define-widget 'message-header-lines 'text |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
576 "All header lines must be LFD terminated." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
577 :format "%t:%n%v" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
578 :valid-regexp "^\\'" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
579 :error "All header lines must be newline terminated") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
580 |
17493 | 581 (defcustom message-default-headers "" |
582 "*A string containing header lines to be inserted in outgoing messages. | |
583 It is inserted before you edit the message, so you can edit or delete | |
584 these lines." | |
585 :group 'message-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
586 :type 'message-header-lines) |
17493 | 587 |
588 (defcustom message-default-mail-headers "" | |
589 "*A string of header lines to be inserted in outgoing mails." | |
590 :group 'message-headers | |
591 :group 'message-mail | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
592 :type 'message-header-lines) |
17493 | 593 |
594 (defcustom message-default-news-headers "" | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
595 "*A string of header lines to be inserted in outgoing news articles." |
17493 | 596 :group 'message-headers |
597 :group 'message-news | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
598 :type 'message-header-lines) |
17493 | 599 |
600 ;; Note: could use /usr/ucb/mail instead of sendmail; | |
601 ;; options -t, and -v if not interactive. | |
602 (defcustom message-mailer-swallows-blank-line | |
603 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)" | |
604 system-configuration) | |
605 (file-readable-p "/etc/sendmail.cf") | |
606 (let ((buffer (get-buffer-create " *temp*"))) | |
607 (unwind-protect | |
608 (save-excursion | |
609 (set-buffer buffer) | |
610 (insert-file-contents "/etc/sendmail.cf") | |
611 (goto-char (point-min)) | |
612 (let ((case-fold-search nil)) | |
613 (re-search-forward "^OR\\>" nil t))) | |
614 (kill-buffer buffer)))) | |
615 ;; According to RFC822, "The field-name must be composed of printable | |
616 ;; ASCII characters (i. e., characters that have decimal values between | |
617 ;; 33 and 126, except colon)", i. e., any chars except ctl chars, | |
618 ;; space, or colon. | |
619 '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>?@A-Z\\\\^_`a-z{|}~]+:")) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
620 "*Set this non-nil if the system's mailer runs the header and body together. |
17493 | 621 \(This problem exists on Sunos 4 when sendmail is run in remote mode.) |
622 The value should be an expression to test whether the problem will | |
623 actually occur." | |
624 :group 'message-sending | |
625 :type 'sexp) | |
626 | |
19481
4d492290e085
(message-user-agent): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
627 ;;;###autoload |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
628 (define-mail-user-agent 'message-user-agent |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
629 'message-mail 'message-send-and-exit |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
630 'message-kill-buffer 'message-send-hook) |
17493 | 631 |
632 (defvar message-mh-deletable-headers '(Message-ID Date Lines Sender) | |
633 "If non-nil, delete the deletable headers before feeding to mh.") | |
634 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
635 (defvar message-send-method-alist |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
636 '((news message-news-p message-send-via-news) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
637 (mail message-mail-p message-send-via-mail)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
638 "Alist of ways to send outgoing messages. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
639 Each element has the form |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
640 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
641 \(TYPE PREDICATE FUNCTION) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
642 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
643 where TYPE is a symbol that names the method; PREDICATE is a function |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
644 called without any parameters to determine whether the message is |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
645 a message of type TYPE; and FUNCTION is a function to be called if |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
646 PREDICATE returns non-nil. FUNCTION is called with one parameter -- |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
647 the prefix.") |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
648 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
649 (defvar message-mail-alias-type 'abbrev |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
650 "*What alias expansion type to use in Message buffers. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
651 The default is `abbrev', which uses mailabbrev. nil switches |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
652 mail aliases off.") |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
653 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
654 (defcustom message-auto-save-directory |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
655 (nnheader-concat message-directory "drafts/") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
656 "*Directory where Message auto-saves buffers if Gnus isn't running. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
657 If nil, Message won't auto-save." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
658 :group 'message-buffers |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
659 :type 'directory) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
660 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
661 (defcustom message-buffer-naming-style 'unique |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
662 "*The way new message buffers are named. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
663 Valid valued are `unique' and `unsent'." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
664 :group 'message-buffers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
665 :type '(choice (const :tag "unique" unique) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
666 (const :tag "unsent" unsent))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
667 |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
668 (defcustom message-default-charset |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
669 (and (not (mm-multibyte-p)) 'iso-8859-1) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
670 "Default charset used in non-MULE Emacsen. |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
671 If nil, you might be asked to input the charset." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
672 :group 'message |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
673 :type 'symbol) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
674 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
675 (defcustom message-dont-reply-to-names |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
676 (and (boundp 'rmail-dont-reply-to-names) rmail-dont-reply-to-names) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
677 "*A regexp specifying names to prune when doing wide replies. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
678 A value of nil means exclude your own name only." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
679 :group 'message |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
680 :type '(choice (const :tag "Yourself" nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
681 regexp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
682 |
17493 | 683 ;;; Internal variables. |
684 ;;; Well, not really internal. | |
685 | |
686 (defvar message-mode-syntax-table | |
687 (let ((table (copy-syntax-table text-mode-syntax-table))) | |
688 (modify-syntax-entry ?% ". " table) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
689 (modify-syntax-entry ?> ". " table) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
690 (modify-syntax-entry ?< ". " table) |
17493 | 691 table) |
692 "Syntax table used while in Message mode.") | |
693 | |
694 (defvar message-mode-abbrev-table text-mode-abbrev-table | |
695 "Abbrev table used in Message mode buffers. | |
696 Defaults to `text-mode-abbrev-table'.") | |
697 (defgroup message-headers nil | |
698 "Message headers." | |
699 :link '(custom-manual "(message)Variables") | |
700 :group 'message) | |
701 | |
702 (defface message-header-to-face | |
703 '((((class color) | |
704 (background dark)) | |
705 (:foreground "green2" :bold t)) | |
706 (((class color) | |
707 (background light)) | |
708 (:foreground "MidnightBlue" :bold t)) | |
709 (t | |
710 (:bold t :italic t))) | |
711 "Face used for displaying From headers." | |
712 :group 'message-faces) | |
713 | |
714 (defface message-header-cc-face | |
715 '((((class color) | |
716 (background dark)) | |
717 (:foreground "green4" :bold t)) | |
718 (((class color) | |
719 (background light)) | |
720 (:foreground "MidnightBlue")) | |
721 (t | |
722 (:bold t))) | |
723 "Face used for displaying Cc headers." | |
724 :group 'message-faces) | |
725 | |
726 (defface message-header-subject-face | |
727 '((((class color) | |
728 (background dark)) | |
729 (:foreground "green3")) | |
730 (((class color) | |
731 (background light)) | |
732 (:foreground "navy blue" :bold t)) | |
733 (t | |
734 (:bold t))) | |
735 "Face used for displaying subject headers." | |
736 :group 'message-faces) | |
737 | |
738 (defface message-header-newsgroups-face | |
739 '((((class color) | |
740 (background dark)) | |
741 (:foreground "yellow" :bold t :italic t)) | |
742 (((class color) | |
743 (background light)) | |
744 (:foreground "blue4" :bold t :italic t)) | |
745 (t | |
746 (:bold t :italic t))) | |
747 "Face used for displaying newsgroups headers." | |
748 :group 'message-faces) | |
749 | |
750 (defface message-header-other-face | |
751 '((((class color) | |
752 (background dark)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
753 (:foreground "#b00000")) |
17493 | 754 (((class color) |
755 (background light)) | |
756 (:foreground "steel blue")) | |
757 (t | |
758 (:bold t :italic t))) | |
759 "Face used for displaying newsgroups headers." | |
760 :group 'message-faces) | |
761 | |
762 (defface message-header-name-face | |
763 '((((class color) | |
764 (background dark)) | |
765 (:foreground "DarkGreen")) | |
766 (((class color) | |
767 (background light)) | |
768 (:foreground "cornflower blue")) | |
769 (t | |
770 (:bold t))) | |
771 "Face used for displaying header names." | |
772 :group 'message-faces) | |
773 | |
774 (defface message-header-xheader-face | |
775 '((((class color) | |
776 (background dark)) | |
777 (:foreground "blue")) | |
778 (((class color) | |
779 (background light)) | |
780 (:foreground "blue")) | |
781 (t | |
782 (:bold t))) | |
783 "Face used for displaying X-Header headers." | |
784 :group 'message-faces) | |
785 | |
786 (defface message-separator-face | |
787 '((((class color) | |
788 (background dark)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
789 (:foreground "blue3")) |
17493 | 790 (((class color) |
791 (background light)) | |
792 (:foreground "brown")) | |
793 (t | |
794 (:bold t))) | |
795 "Face used for displaying the separator." | |
796 :group 'message-faces) | |
797 | |
798 (defface message-cited-text-face | |
799 '((((class color) | |
800 (background dark)) | |
801 (:foreground "red")) | |
802 (((class color) | |
803 (background light)) | |
804 (:foreground "red")) | |
805 (t | |
806 (:bold t))) | |
807 "Face used for displaying cited text names." | |
808 :group 'message-faces) | |
809 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
810 (defface message-mml-face |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
811 '((((class color) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
812 (background dark)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
813 (:foreground "ForestGreen")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
814 (((class color) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
815 (background light)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
816 (:foreground "ForestGreen")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
817 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
818 (:bold t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
819 "Face used for displaying MML." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
820 :group 'message-faces) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
821 |
17493 | 822 (defvar message-font-lock-keywords |
823 (let* ((cite-prefix "A-Za-z") | |
824 (cite-suffix (concat cite-prefix "0-9_.@-")) | |
825 (content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)")) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
826 `((,(concat "^\\([Tt]o:\\)" content) |
17493 | 827 (1 'message-header-name-face) |
828 (2 'message-header-to-face nil t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
829 (,(concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content) |
17493 | 830 (1 'message-header-name-face) |
831 (2 'message-header-cc-face nil t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
832 (,(concat "^\\([Ss]ubject:\\)" content) |
17493 | 833 (1 'message-header-name-face) |
834 (2 'message-header-subject-face nil t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
835 (,(concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content) |
17493 | 836 (1 'message-header-name-face) |
837 (2 'message-header-newsgroups-face nil t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
838 (,(concat "^\\([A-Z][^: \n\t]+:\\)" content) |
17493 | 839 (1 'message-header-name-face) |
840 (2 'message-header-other-face nil t)) | |
841 (,(concat "^\\(X-[A-Za-z0-9-]+\\|In-Reply-To\\):" content) | |
842 (1 'message-header-name-face) | |
843 (2 'message-header-name-face)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
844 ,@(if (and mail-header-separator |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
845 (not (equal mail-header-separator ""))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
846 `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
847 1 'message-separator-face)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
848 nil) |
17493 | 849 (,(concat "^[ \t]*" |
850 "\\([" cite-prefix "]+[" cite-suffix "]*\\)?" | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
851 "[:>|}].*") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
852 (0 'message-cited-text-face)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
853 ("<#/?\\(multipart\\|part\\|external\\|mml\\).*>" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
854 (0 'message-mml-face)))) |
17493 | 855 "Additional expressions to highlight in Message mode.") |
856 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
857 ;; XEmacs does it like this. For Emacs, we have to set the |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
858 ;; `font-lock-defaults' buffer-local variable. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
859 (put 'message-mode 'font-lock-defaults '(message-font-lock-keywords t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
860 |
17493 | 861 (defvar message-face-alist |
862 '((bold . bold-region) | |
863 (underline . underline-region) | |
864 (default . (lambda (b e) | |
865 (unbold-region b e) | |
866 (ununderline-region b e)))) | |
867 "Alist of mail and news faces for facemenu. | |
868 The cdr of ech entry is a function for applying the face to a region.") | |
869 | |
870 (defcustom message-send-hook nil | |
871 "Hook run before sending messages." | |
872 :group 'message-various | |
873 :options '(ispell-message) | |
874 :type 'hook) | |
875 | |
876 (defcustom message-send-mail-hook nil | |
877 "Hook run before sending mail messages." | |
878 :group 'message-various | |
879 :type 'hook) | |
880 | |
881 (defcustom message-send-news-hook nil | |
882 "Hook run before sending news messages." | |
883 :group 'message-various | |
884 :type 'hook) | |
885 | |
886 (defcustom message-sent-hook nil | |
887 "Hook run after sending messages." | |
888 :group 'message-various | |
889 :type 'hook) | |
890 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
891 (defvar message-send-coding-system 'binary |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
892 "Coding system to encode outgoing mail.") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
893 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
894 (defvar message-draft-coding-system |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
895 mm-auto-save-coding-system |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
896 "Coding system to compose mail.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
897 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
898 (defcustom message-send-mail-partially-limit 1000000 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
899 "The limitation of messages sent as message/partial. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
900 The lower bound of message size in characters, beyond which the message |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
901 should be sent in several parts. If it is nil, the size is unlimited." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
902 :group 'message-buffers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
903 :type '(choice (const :tag "unlimited" nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
904 (integer 1000000))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
905 |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
906 (defcustom message-alternative-emails nil |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
907 "A regexp to match the alternative email addresses. |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
908 The first matched address (not primary one) is used in the From field." |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
909 :group 'message-headers |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
910 :type '(choice (const :tag "Always use primary" nil) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
911 regexp)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
912 |
17493 | 913 ;;; Internal variables. |
914 | |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
915 (defvar message-sending-message "Sending...") |
17493 | 916 (defvar message-buffer-list nil) |
917 (defvar message-this-is-news nil) | |
918 (defvar message-this-is-mail nil) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
919 (defvar message-draft-article nil) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
920 (defvar message-mime-part nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
921 (defvar message-posting-charset nil) |
17493 | 922 |
923 ;; Byte-compiler warning | |
924 (defvar gnus-active-hashtb) | |
925 (defvar gnus-read-active-file) | |
926 | |
927 ;;; Regexp matching the delimiter of messages in UNIX mail format | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
928 ;;; (UNIX From lines), minus the initial ^. It should be a copy |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
929 ;;; of rmail.el's rmail-unix-mail-delimiter. |
17493 | 930 (defvar message-unix-mail-delimiter |
931 (let ((time-zone-regexp | |
932 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?" | |
933 "\\|[-+]?[0-9][0-9][0-9][0-9]" | |
934 "\\|" | |
935 "\\) *"))) | |
936 (concat | |
937 "From " | |
938 | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
939 ;; Many things can happen to an RFC 822 mailbox before it is put into |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
940 ;; a `From' line. The leading phrase can be stripped, e.g. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
941 ;; `Joe <@w.x:joe@y.z>' -> `<@w.x:joe@y.z>'. The <> can be stripped, e.g. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
942 ;; `<@x.y:joe@y.z>' -> `@x.y:joe@y.z'. Everything starting with a CRLF |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
943 ;; can be removed, e.g. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
944 ;; From: joe@y.z (Joe K |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
945 ;; User) |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
946 ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
947 ;; From: Joe User |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
948 ;; <joe@y.z> |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
949 ;; can yield `From Joe User Fri Mar 22 08:11:15 1996'. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
950 ;; The mailbox can be removed or be replaced by white space, e.g. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
951 ;; From: "Joe User"{space}{tab} |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
952 ;; <joe@y.z> |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
953 ;; can yield `From {space}{tab} Fri Mar 22 08:11:15 1996', |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
954 ;; where {space} and {tab} represent the Ascii space and tab characters. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
955 ;; We want to match the results of any of these manglings. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
956 ;; The following regexp rejects names whose first characters are |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
957 ;; obviously bogus, but after that anything goes. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
958 "\\([^\0-\b\n-\r\^?].*\\)? " |
17493 | 959 |
960 ;; The time the message was sent. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
961 "\\([^\0-\r \^?]+\\) +" ; day of the week |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
962 "\\([^\0-\r \^?]+\\) +" ; month |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
963 "\\([0-3]?[0-9]\\) +" ; day of month |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
964 "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day |
17493 | 965 |
966 ;; Perhaps a time zone, specified by an abbreviation, or by a | |
967 ;; numeric offset. | |
968 time-zone-regexp | |
969 | |
970 ;; The year. | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
971 " \\([0-9][0-9]+\\) *" |
17493 | 972 |
973 ;; On some systems the time zone can appear after the year, too. | |
974 time-zone-regexp | |
975 | |
976 ;; Old uucp cruft. | |
977 "\\(remote from .*\\)?" | |
978 | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
979 "\n")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
980 "Regexp matching the delimiter of messages in UNIX mail format.") |
17493 | 981 |
982 (defvar message-unsent-separator | |
983 (concat "^ *---+ +Unsent message follows +---+ *$\\|" | |
984 "^ *---+ +Returned message +---+ *$\\|" | |
985 "^Start of returned message$\\|" | |
986 "^ *---+ +Original message +---+ *$\\|" | |
987 "^ *--+ +begin message +--+ *$\\|" | |
988 "^ *---+ +Original message follows +---+ *$\\|" | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
989 "^ *---+ +Undelivered message follows +---+ *$\\|" |
17493 | 990 "^|? *---+ +Message text follows: +---+ *|?$") |
991 "A regexp that matches the separator before the text of a failed message.") | |
992 | |
993 (defvar message-header-format-alist | |
994 `((Newsgroups) | |
995 (To . message-fill-address) | |
996 (Cc . message-fill-address) | |
997 (Subject) | |
998 (In-Reply-To) | |
999 (Fcc) | |
1000 (Bcc) | |
1001 (Date) | |
1002 (Organization) | |
1003 (Distribution) | |
1004 (Lines) | |
1005 (Expires) | |
1006 (Message-ID) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1007 (References . message-shorten-references) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1008 (User-Agent)) |
17493 | 1009 "Alist used for formatting headers.") |
1010 | |
1011 (eval-and-compile | |
1012 (autoload 'message-setup-toolbar "messagexmas") | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1013 (autoload 'mh-new-draft-name "mh-comp") |
17493 | 1014 (autoload 'mh-send-letter "mh-comp") |
1015 (autoload 'gnus-point-at-eol "gnus-util") | |
1016 (autoload 'gnus-point-at-bol "gnus-util") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1017 (autoload 'gnus-output-to-rmail "gnus-util") |
17493 | 1018 (autoload 'gnus-output-to-mail "gnus-util") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1019 (autoload 'mail-abbrev-in-expansion-header-p "mailabbrev") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1020 (autoload 'nndraft-request-associate-buffer "nndraft") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1021 (autoload 'nndraft-request-expire-articles "nndraft") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1022 (autoload 'gnus-open-server "gnus-int") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1023 (autoload 'gnus-request-post "gnus-int") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1024 (autoload 'gnus-alive-p "gnus-util") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1025 (autoload 'gnus-group-name-charset "gnus-group") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1026 (autoload 'rmail-output "rmail")) |
17493 | 1027 |
1028 | |
1029 | |
1030 ;;; | |
1031 ;;; Utility functions. | |
1032 ;;; | |
1033 | |
1034 (defmacro message-y-or-n-p (question show &rest text) | |
1035 "Ask QUESTION, displaying the rest of the arguments in a temp. buffer if SHOW" | |
1036 `(message-talkative-question 'y-or-n-p ,question ,show ,@text)) | |
1037 | |
1038 ;; Delete the current line (and the next N lines.); | |
1039 (defmacro message-delete-line (&optional n) | |
1040 `(delete-region (progn (beginning-of-line) (point)) | |
1041 (progn (forward-line ,(or n 1)) (point)))) | |
1042 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1043 (defun message-unquote-tokens (elems) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1044 "Remove double quotes (\") from strings in list." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1045 (mapcar (lambda (item) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1046 (while (string-match "^\\(.*\\)\"\\(.*\\)$" item) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1047 (setq item (concat (match-string 1 item) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1048 (match-string 2 item)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1049 item) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1050 elems)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1051 |
17493 | 1052 (defun message-tokenize-header (header &optional separator) |
1053 "Split HEADER into a list of header elements. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1054 SEPARATOR is a string of characters to be used as separators. \",\" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1055 is used by default." |
17493 | 1056 (if (not header) |
1057 nil | |
1058 (let ((regexp (format "[%s]+" (or separator ","))) | |
1059 (beg 1) | |
1060 (first t) | |
1061 quoted elems paren) | |
1062 (save-excursion | |
1063 (message-set-work-buffer) | |
1064 (insert header) | |
1065 (goto-char (point-min)) | |
1066 (while (not (eobp)) | |
1067 (if first | |
1068 (setq first nil) | |
1069 (forward-char 1)) | |
1070 (cond ((and (> (point) beg) | |
1071 (or (eobp) | |
1072 (and (looking-at regexp) | |
1073 (not quoted) | |
1074 (not paren)))) | |
1075 (push (buffer-substring beg (point)) elems) | |
1076 (setq beg (match-end 0))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1077 ((eq (char-after) ?\") |
17493 | 1078 (setq quoted (not quoted))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1079 ((and (eq (char-after) ?\() |
17493 | 1080 (not quoted)) |
1081 (setq paren t)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1082 ((and (eq (char-after) ?\)) |
17493 | 1083 (not quoted)) |
1084 (setq paren nil)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1085 (nreverse elems))))) |
17493 | 1086 |
1087 (defun message-mail-file-mbox-p (file) | |
1088 "Say whether FILE looks like a Unix mbox file." | |
1089 (when (and (file-exists-p file) | |
1090 (file-readable-p file) | |
1091 (file-regular-p file)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1092 (with-temp-buffer |
17493 | 1093 (nnheader-insert-file-contents file) |
1094 (goto-char (point-min)) | |
1095 (looking-at message-unix-mail-delimiter)))) | |
1096 | |
1097 (defun message-fetch-field (header &optional not-all) | |
1098 "The same as `mail-fetch-field', only remove all newlines." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1099 (let* ((inhibit-point-motion-hooks t) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1100 (case-fold-search t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1101 (value (mail-fetch-field header nil (not not-all)))) |
17493 | 1102 (when value |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1103 (while (string-match "\n[\t ]+" value) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1104 (setq value (replace-match " " t t value))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1105 (set-text-properties 0 (length value) nil value) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1106 value))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1107 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1108 (defun message-narrow-to-field () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1109 "Narrow the buffer to the header on the current line." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1110 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1111 (narrow-to-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1112 (point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1113 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1114 (forward-line 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1115 (if (re-search-forward "^[^ \n\t]" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1116 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1117 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1118 (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1119 (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1120 (goto-char (point-min))) |
17493 | 1121 |
1122 (defun message-add-header (&rest headers) | |
1123 "Add the HEADERS to the message header, skipping those already present." | |
1124 (while headers | |
1125 (let (hclean) | |
1126 (unless (string-match "^\\([^:]+\\):[ \t]*[^ \t]" (car headers)) | |
1127 (error "Invalid header `%s'" (car headers))) | |
1128 (setq hclean (match-string 1 (car headers))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1129 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1130 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1131 (unless (re-search-forward (concat "^" (regexp-quote hclean) ":") nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1132 (insert (car headers) ?\n)))) |
17493 | 1133 (setq headers (cdr headers)))) |
1134 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1135 |
17493 | 1136 (defun message-fetch-reply-field (header) |
1137 "Fetch FIELD from the message we're replying to." | |
1138 (when (and message-reply-buffer | |
1139 (buffer-name message-reply-buffer)) | |
1140 (save-excursion | |
1141 (set-buffer message-reply-buffer) | |
1142 (message-fetch-field header)))) | |
1143 | |
1144 (defun message-set-work-buffer () | |
1145 (if (get-buffer " *message work*") | |
1146 (progn | |
1147 (set-buffer " *message work*") | |
1148 (erase-buffer)) | |
1149 (set-buffer (get-buffer-create " *message work*")) | |
1150 (kill-all-local-variables) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1151 (mm-enable-multibyte))) |
17493 | 1152 |
1153 (defun message-functionp (form) | |
1154 "Return non-nil if FORM is funcallable." | |
1155 (or (and (symbolp form) (fboundp form)) | |
1156 (and (listp form) (eq (car form) 'lambda)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1157 (byte-code-function-p form))) |
17493 | 1158 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1159 (defun message-strip-list-identifiers (subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1160 "Remove list identifiers in `gnus-list-identifiers'." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1161 (require 'gnus-sum) ; for gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1162 (let ((regexp (if (stringp gnus-list-identifiers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1163 gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1164 (mapconcat 'identity gnus-list-identifiers " *\\|")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1165 (if (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1166 " *\\)\\)+\\(Re: +\\)?\\)") subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1167 (concat (substring subject 0 (match-beginning 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1168 (or (match-string 3 subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1169 (match-string 5 subject)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1170 (substring subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1171 (match-end 1))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1172 subject))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1173 |
17493 | 1174 (defun message-strip-subject-re (subject) |
1175 "Remove \"Re:\" from subject lines." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1176 (if (string-match message-subject-re-regexp subject) |
17493 | 1177 (substring subject (match-end 0)) |
1178 subject)) | |
1179 | |
1180 (defun message-remove-header (header &optional is-regexp first reverse) | |
1181 "Remove HEADER in the narrowed buffer. | |
1182 If REGEXP, HEADER is a regular expression. | |
1183 If FIRST, only remove the first instance of the header. | |
1184 Return the number of headers removed." | |
1185 (goto-char (point-min)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1186 (let ((regexp (if is-regexp header (concat "^" (regexp-quote header) ":"))) |
17493 | 1187 (number 0) |
1188 (case-fold-search t) | |
1189 last) | |
1190 (while (and (not (eobp)) | |
1191 (not last)) | |
1192 (if (if reverse | |
1193 (not (looking-at regexp)) | |
1194 (looking-at regexp)) | |
1195 (progn | |
1196 (incf number) | |
1197 (when first | |
1198 (setq last t)) | |
1199 (delete-region | |
1200 (point) | |
1201 ;; There might be a continuation header, so we have to search | |
1202 ;; until we find a new non-continuation line. | |
1203 (progn | |
1204 (forward-line 1) | |
1205 (if (re-search-forward "^[^ \t]" nil t) | |
1206 (goto-char (match-beginning 0)) | |
1207 (point-max))))) | |
1208 (forward-line 1) | |
1209 (if (re-search-forward "^[^ \t]" nil t) | |
1210 (goto-char (match-beginning 0)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1211 (goto-char (point-max))))) |
17493 | 1212 number)) |
1213 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1214 (defun message-remove-first-header (header) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1215 "Remove the first instance of HEADER if there is more than one." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1216 (let ((count 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1217 (regexp (concat "^" (regexp-quote header) ":"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1218 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1219 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1220 (while (re-search-forward regexp nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1221 (incf count))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1222 (while (> count 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1223 (message-remove-header header nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1224 (decf count)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1225 |
17493 | 1226 (defun message-narrow-to-headers () |
1227 "Narrow the buffer to the head of the message." | |
1228 (widen) | |
1229 (narrow-to-region | |
1230 (goto-char (point-min)) | |
1231 (if (re-search-forward | |
1232 (concat "^" (regexp-quote mail-header-separator) "\n") nil t) | |
1233 (match-beginning 0) | |
1234 (point-max))) | |
1235 (goto-char (point-min))) | |
1236 | |
1237 (defun message-narrow-to-head () | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1238 "Narrow the buffer to the head of the message. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1239 Point is left at the beginning of the narrowed-to region." |
17493 | 1240 (widen) |
1241 (narrow-to-region | |
1242 (goto-char (point-min)) | |
1243 (if (search-forward "\n\n" nil 1) | |
1244 (1- (point)) | |
1245 (point-max))) | |
1246 (goto-char (point-min))) | |
1247 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1248 (defun message-narrow-to-headers-or-head () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1249 "Narrow the buffer to the head of the message." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1250 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1251 (narrow-to-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1252 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1253 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1254 ((re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1255 (concat "^" (regexp-quote mail-header-separator) "\n") nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1256 (match-beginning 0)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1257 ((search-forward "\n\n" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1258 (1- (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1259 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1260 (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1261 (goto-char (point-min))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1262 |
17493 | 1263 (defun message-news-p () |
1264 "Say whether the current buffer contains a news message." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1265 (and (not message-this-is-mail) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1266 (or message-this-is-news |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1267 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1268 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1269 (message-narrow-to-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1270 (and (message-fetch-field "newsgroups") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1271 (not (message-fetch-field "posted-to")))))))) |
17493 | 1272 |
1273 (defun message-mail-p () | |
1274 "Say whether the current buffer contains a mail message." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1275 (and (not message-this-is-news) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1276 (or message-this-is-mail |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1277 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1278 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1279 (message-narrow-to-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1280 (or (message-fetch-field "to") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1281 (message-fetch-field "cc") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1282 (message-fetch-field "bcc"))))))) |
17493 | 1283 |
1284 (defun message-next-header () | |
1285 "Go to the beginning of the next header." | |
1286 (beginning-of-line) | |
1287 (or (eobp) (forward-char 1)) | |
1288 (not (if (re-search-forward "^[^ \t]" nil t) | |
1289 (beginning-of-line) | |
1290 (goto-char (point-max))))) | |
1291 | |
1292 (defun message-sort-headers-1 () | |
1293 "Sort the buffer as headers using `message-rank' text props." | |
1294 (goto-char (point-min)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1295 (require 'sort) |
17493 | 1296 (sort-subr |
1297 nil 'message-next-header | |
1298 (lambda () | |
1299 (message-next-header) | |
1300 (unless (bobp) | |
1301 (forward-char -1))) | |
1302 (lambda () | |
1303 (or (get-text-property (point) 'message-rank) | |
1304 10000)))) | |
1305 | |
1306 (defun message-sort-headers () | |
1307 "Sort the headers of the current message according to `message-header-format-alist'." | |
1308 (interactive) | |
1309 (save-excursion | |
1310 (save-restriction | |
1311 (let ((max (1+ (length message-header-format-alist))) | |
1312 rank) | |
1313 (message-narrow-to-headers) | |
1314 (while (re-search-forward "^[^ \n]+:" nil t) | |
1315 (put-text-property | |
1316 (match-beginning 0) (1+ (match-beginning 0)) | |
1317 'message-rank | |
1318 (if (setq rank (length (memq (assq (intern (buffer-substring | |
1319 (match-beginning 0) | |
1320 (1- (match-end 0)))) | |
1321 message-header-format-alist) | |
1322 message-header-format-alist))) | |
1323 (- max rank) | |
1324 (1+ max))))) | |
1325 (message-sort-headers-1)))) | |
1326 | |
1327 | |
1328 | |
1329 ;;; | |
1330 ;;; Message mode | |
1331 ;;; | |
1332 | |
1333 ;;; Set up keymap. | |
1334 | |
1335 (defvar message-mode-map nil) | |
1336 | |
1337 (unless message-mode-map | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1338 (setq message-mode-map (make-keymap)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1339 (set-keymap-parent message-mode-map text-mode-map) |
17493 | 1340 (define-key message-mode-map "\C-c?" 'describe-mode) |
1341 | |
1342 (define-key message-mode-map "\C-c\C-f\C-t" 'message-goto-to) | |
1343 (define-key message-mode-map "\C-c\C-f\C-b" 'message-goto-bcc) | |
1344 (define-key message-mode-map "\C-c\C-f\C-w" 'message-goto-fcc) | |
1345 (define-key message-mode-map "\C-c\C-f\C-c" 'message-goto-cc) | |
1346 (define-key message-mode-map "\C-c\C-f\C-s" 'message-goto-subject) | |
1347 (define-key message-mode-map "\C-c\C-f\C-r" 'message-goto-reply-to) | |
1348 (define-key message-mode-map "\C-c\C-f\C-n" 'message-goto-newsgroups) | |
1349 (define-key message-mode-map "\C-c\C-f\C-d" 'message-goto-distribution) | |
1350 (define-key message-mode-map "\C-c\C-f\C-f" 'message-goto-followup-to) | |
1351 (define-key message-mode-map "\C-c\C-f\C-k" 'message-goto-keywords) | |
1352 (define-key message-mode-map "\C-c\C-f\C-u" 'message-goto-summary) | |
1353 (define-key message-mode-map "\C-c\C-b" 'message-goto-body) | |
1354 (define-key message-mode-map "\C-c\C-i" 'message-goto-signature) | |
1355 | |
1356 (define-key message-mode-map "\C-c\C-t" 'message-insert-to) | |
1357 (define-key message-mode-map "\C-c\C-n" 'message-insert-newsgroups) | |
1358 | |
1359 (define-key message-mode-map "\C-c\C-y" 'message-yank-original) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1360 (define-key message-mode-map "\C-c\M-\C-y" 'message-yank-buffer) |
17493 | 1361 (define-key message-mode-map "\C-c\C-q" 'message-fill-yanked-message) |
1362 (define-key message-mode-map "\C-c\C-w" 'message-insert-signature) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1363 (define-key message-mode-map "\C-c\M-h" 'message-insert-headers) |
17493 | 1364 (define-key message-mode-map "\C-c\C-r" 'message-caesar-buffer-body) |
1365 (define-key message-mode-map "\C-c\C-o" 'message-sort-headers) | |
1366 (define-key message-mode-map "\C-c\M-r" 'message-rename-buffer) | |
1367 | |
1368 (define-key message-mode-map "\C-c\C-c" 'message-send-and-exit) | |
1369 (define-key message-mode-map "\C-c\C-s" 'message-send) | |
1370 (define-key message-mode-map "\C-c\C-k" 'message-kill-buffer) | |
1371 (define-key message-mode-map "\C-c\C-d" 'message-dont-send) | |
1372 | |
1373 (define-key message-mode-map "\C-c\C-e" 'message-elide-region) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1374 (define-key message-mode-map "\C-c\C-v" 'message-delete-not-region) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1375 (define-key message-mode-map "\C-c\C-z" 'message-kill-to-signature) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1376 (define-key message-mode-map "\M-\r" 'message-newline-and-reformat) |
17493 | 1377 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1378 (define-key message-mode-map "\C-c\C-a" 'mml-attach-file) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1379 |
17493 | 1380 (define-key message-mode-map "\t" 'message-tab)) |
1381 | |
1382 (easy-menu-define | |
1383 message-mode-menu message-mode-map "Message Menu." | |
1384 '("Message" | |
1385 ["Sort Headers" message-sort-headers t] | |
1386 ["Yank Original" message-yank-original t] | |
1387 ["Fill Yanked Message" message-fill-yanked-message t] | |
1388 ["Insert Signature" message-insert-signature t] | |
1389 ["Caesar (rot13) Message" message-caesar-buffer-body t] | |
1390 ["Caesar (rot13) Region" message-caesar-region (mark t)] | |
1391 ["Elide Region" message-elide-region (mark t)] | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1392 ["Delete Outside Region" message-delete-not-region (mark t)] |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1393 ["Kill To Signature" message-kill-to-signature t] |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1394 ["Newline and Reformat" message-newline-and-reformat t] |
17493 | 1395 ["Rename buffer" message-rename-buffer t] |
32964
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1396 ["Spellcheck" ispell-message |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1397 :help "Spellcheck this message"] |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1398 ["Attach file as MIME" mml-attach-file |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1399 :help "Attach a file at point"] |
17493 | 1400 "----" |
32964
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1401 ["Send Message" message-send-and-exit |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1402 :help "Send this message"] |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1403 ["Abort Message" message-dont-send |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1404 :help "File this draft message and exit"] |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1405 ["Kill Message" message-kill-buffer |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1406 :help "Delete this message without sending"])) |
17493 | 1407 |
1408 (easy-menu-define | |
1409 message-mode-field-menu message-mode-map "" | |
1410 '("Field" | |
1411 ["Fetch To" message-insert-to t] | |
1412 ["Fetch Newsgroups" message-insert-newsgroups t] | |
1413 "----" | |
1414 ["To" message-goto-to t] | |
1415 ["Subject" message-goto-subject t] | |
1416 ["Cc" message-goto-cc t] | |
1417 ["Reply-To" message-goto-reply-to t] | |
1418 ["Summary" message-goto-summary t] | |
1419 ["Keywords" message-goto-keywords t] | |
1420 ["Newsgroups" message-goto-newsgroups t] | |
1421 ["Followup-To" message-goto-followup-to t] | |
1422 ["Distribution" message-goto-distribution t] | |
1423 ["Body" message-goto-body t] | |
1424 ["Signature" message-goto-signature t])) | |
1425 | |
1426 (defvar facemenu-add-face-function) | |
1427 (defvar facemenu-remove-face-function) | |
1428 | |
1429 ;;;###autoload | |
1430 (defun message-mode () | |
1431 "Major mode for editing mail and news to be sent. | |
1432 Like Text Mode but with these additional commands: | |
1433 C-c C-s message-send (send the message) C-c C-c message-send-and-exit | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1434 C-c C-d Pospone sending the message C-c C-k Kill the message |
17493 | 1435 C-c C-f move to a header field (and create it if there isn't): |
1436 C-c C-f C-t move to To C-c C-f C-s move to Subject | |
1437 C-c C-f C-c move to Cc C-c C-f C-b move to Bcc | |
1438 C-c C-f C-w move to Fcc C-c C-f C-r move to Reply-To | |
1439 C-c C-f C-u move to Summary C-c C-f C-n move to Newsgroups | |
1440 C-c C-f C-k move to Keywords C-c C-f C-d move to Distribution | |
1441 C-c C-f C-f move to Followup-To | |
1442 C-c C-t message-insert-to (add a To header to a news followup) | |
1443 C-c C-n message-insert-newsgroups (add a Newsgroup header to a news reply) | |
1444 C-c C-b message-goto-body (move to beginning of message text). | |
1445 C-c C-i message-goto-signature (move to the beginning of the signature). | |
1446 C-c C-w message-insert-signature (insert `message-signature-file' file). | |
1447 C-c C-y message-yank-original (insert current message, if any). | |
1448 C-c C-q message-fill-yanked-message (fill what was yanked). | |
1449 C-c C-e message-elide-region (elide the text between point and mark). | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1450 C-c C-v message-delete-not-region (remove the text outside the region). |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1451 C-c C-z message-kill-to-signature (kill the text up to the signature). |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1452 C-c C-r message-caesar-buffer-body (rot13 the message body). |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1453 C-c C-a mml-attach-file (attach a file as MIME). |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1454 M-RET message-newline-and-reformat (break the line and reformat)." |
17493 | 1455 (interactive) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1456 (if (local-variable-p 'mml-buffer-list (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1457 (mml-destroy-buffers)) |
17493 | 1458 (kill-all-local-variables) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1459 (set (make-local-variable 'message-reply-buffer) nil) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1460 (make-local-variable 'message-send-actions) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1461 (make-local-variable 'message-exit-actions) |
17493 | 1462 (make-local-variable 'message-kill-actions) |
1463 (make-local-variable 'message-postpone-actions) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1464 (make-local-variable 'message-draft-article) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1465 (make-local-hook 'kill-buffer-hook) |
17493 | 1466 (set-syntax-table message-mode-syntax-table) |
1467 (use-local-map message-mode-map) | |
1468 (setq local-abbrev-table message-mode-abbrev-table) | |
1469 (setq major-mode 'message-mode) | |
1470 (setq mode-name "Message") | |
1471 (setq buffer-offer-save t) | |
1472 (make-local-variable 'facemenu-add-face-function) | |
1473 (make-local-variable 'facemenu-remove-face-function) | |
1474 (setq facemenu-add-face-function | |
1475 (lambda (face end) | |
1476 (let ((face-fun (cdr (assq face message-face-alist)))) | |
1477 (if face-fun | |
1478 (funcall face-fun (point) end) | |
1479 (error "Face %s not configured for %s mode" face mode-name))) | |
1480 "") | |
1481 facemenu-remove-face-function t) | |
1482 (make-local-variable 'paragraph-separate) | |
1483 (make-local-variable 'paragraph-start) | |
22378
18a60ded5193
(message-mode): Set paragraph-start and
Richard M. Stallman <rms@gnu.org>
parents:
22145
diff
changeset
|
1484 ;; `-- ' precedes the signature. `-----' appears at the start of the |
18a60ded5193
(message-mode): Set paragraph-start and
Richard M. Stallman <rms@gnu.org>
parents:
22145
diff
changeset
|
1485 ;; lines that delimit forwarded messages. |
18a60ded5193
(message-mode): Set paragraph-start and
Richard M. Stallman <rms@gnu.org>
parents:
22145
diff
changeset
|
1486 ;; Lines containing just >= 3 dashes, perhaps after whitespace, |
18a60ded5193
(message-mode): Set paragraph-start and
Richard M. Stallman <rms@gnu.org>
parents:
22145
diff
changeset
|
1487 ;; are also sometimes used and should be separators. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1488 (setq paragraph-start |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1489 (concat (regexp-quote mail-header-separator) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1490 "$\\|[ \t]*[a-z0-9A-Z]*>+[ \t]*$\\|[ \t]*$\\|" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1491 "-- $\\|---+$\\|" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1492 page-delimiter |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1493 ;;!!! Uhm... shurely this can't be right? |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1494 "[> " (regexp-quote message-yank-prefix) "]+$")) |
22378
18a60ded5193
(message-mode): Set paragraph-start and
Richard M. Stallman <rms@gnu.org>
parents:
22145
diff
changeset
|
1495 (setq paragraph-separate paragraph-start) |
17493 | 1496 (make-local-variable 'message-reply-headers) |
1497 (setq message-reply-headers nil) | |
1498 (make-local-variable 'message-newsreader) | |
1499 (make-local-variable 'message-mailer) | |
1500 (make-local-variable 'message-post-method) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1501 (set (make-local-variable 'message-sent-message-via) nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1502 (set (make-local-variable 'message-checksum) nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1503 (set (make-local-variable 'message-mime-part) 0) |
17493 | 1504 ;;(when (fboundp 'mail-hist-define-keys) |
1505 ;; (mail-hist-define-keys)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1506 (if (featurep 'xemacs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1507 (message-setup-toolbar) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1508 (set (make-local-variable 'font-lock-defaults) |
32964
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1509 '(message-font-lock-keywords t)) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1510 (if (boundp 'message-tool-bar-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1511 (set (make-local-variable 'tool-bar-map) message-tool-bar-map))) |
17493 | 1512 (easy-menu-add message-mode-menu message-mode-map) |
1513 (easy-menu-add message-mode-field-menu message-mode-map) | |
1514 ;; Allow mail alias things. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1515 (when (eq message-mail-alias-type 'abbrev) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1516 (if (fboundp 'mail-abbrevs-setup) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1517 (mail-abbrevs-setup) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1518 (mail-aliases-setup))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1519 (message-set-auto-save-file-name) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1520 (make-local-variable 'adaptive-fill-regexp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1521 (setq adaptive-fill-regexp |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1522 (concat "[ \t]*[-a-z0-9A-Z]*\\(>[ \t]*\\)+[ \t]*\\|" adaptive-fill-regexp)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1523 (unless (boundp 'adaptive-fill-first-line-regexp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1524 (setq adaptive-fill-first-line-regexp nil)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1525 (make-local-variable 'adaptive-fill-first-line-regexp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1526 (setq adaptive-fill-first-line-regexp |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1527 (concat "[ \t]*[-a-z0-9A-Z]*\\(>[ \t]*\\)+[ \t]*\\|" |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1528 adaptive-fill-first-line-regexp)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1529 (make-local-variable 'auto-fill-inhibit-regexp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1530 (setq auto-fill-inhibit-regexp "^[A-Z][^: \n\t]+:") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1531 (mm-enable-multibyte) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1532 (make-local-variable 'indent-tabs-mode) ;Turn off tabs for indentation. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1533 (setq indent-tabs-mode nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1534 (mml-mode) |
17493 | 1535 (run-hooks 'text-mode-hook 'message-mode-hook)) |
1536 | |
1537 | |
1538 | |
1539 ;;; | |
1540 ;;; Message mode commands | |
1541 ;;; | |
1542 | |
1543 ;;; Movement commands | |
1544 | |
1545 (defun message-goto-to () | |
1546 "Move point to the To header." | |
1547 (interactive) | |
1548 (message-position-on-field "To")) | |
1549 | |
1550 (defun message-goto-subject () | |
1551 "Move point to the Subject header." | |
1552 (interactive) | |
1553 (message-position-on-field "Subject")) | |
1554 | |
1555 (defun message-goto-cc () | |
1556 "Move point to the Cc header." | |
1557 (interactive) | |
1558 (message-position-on-field "Cc" "To")) | |
1559 | |
1560 (defun message-goto-bcc () | |
1561 "Move point to the Bcc header." | |
1562 (interactive) | |
1563 (message-position-on-field "Bcc" "Cc" "To")) | |
1564 | |
1565 (defun message-goto-fcc () | |
1566 "Move point to the Fcc header." | |
1567 (interactive) | |
1568 (message-position-on-field "Fcc" "To" "Newsgroups")) | |
1569 | |
1570 (defun message-goto-reply-to () | |
1571 "Move point to the Reply-To header." | |
1572 (interactive) | |
1573 (message-position-on-field "Reply-To" "Subject")) | |
1574 | |
1575 (defun message-goto-newsgroups () | |
1576 "Move point to the Newsgroups header." | |
1577 (interactive) | |
1578 (message-position-on-field "Newsgroups")) | |
1579 | |
1580 (defun message-goto-distribution () | |
1581 "Move point to the Distribution header." | |
1582 (interactive) | |
1583 (message-position-on-field "Distribution")) | |
1584 | |
1585 (defun message-goto-followup-to () | |
1586 "Move point to the Followup-To header." | |
1587 (interactive) | |
1588 (message-position-on-field "Followup-To" "Newsgroups")) | |
1589 | |
1590 (defun message-goto-keywords () | |
1591 "Move point to the Keywords header." | |
1592 (interactive) | |
1593 (message-position-on-field "Keywords" "Subject")) | |
1594 | |
1595 (defun message-goto-summary () | |
1596 "Move point to the Summary header." | |
1597 (interactive) | |
1598 (message-position-on-field "Summary" "Subject")) | |
1599 | |
1600 (defun message-goto-body () | |
1601 "Move point to the beginning of the message body." | |
1602 (interactive) | |
1603 (if (looking-at "[ \t]*\n") (expand-abbrev)) | |
1604 (goto-char (point-min)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1605 (or (search-forward (concat "\n" mail-header-separator "\n") nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1606 (search-forward "\n\n" nil t))) |
17493 | 1607 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1608 (defun message-goto-eoh () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1609 "Move point to the end of the headers." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1610 (interactive) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1611 (message-goto-body) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1612 (forward-line -1)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1613 |
17493 | 1614 (defun message-goto-signature () |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1615 "Move point to the beginning of the message signature. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1616 If there is no signature in the article, go to the end and |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1617 return nil." |
17493 | 1618 (interactive) |
1619 (goto-char (point-min)) | |
1620 (if (re-search-forward message-signature-separator nil t) | |
1621 (forward-line 1) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1622 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1623 nil)) |
17493 | 1624 |
1625 | |
1626 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1627 (defun message-insert-to (&optional force) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1628 "Insert a To header that points to the author of the article being replied to. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1629 If the original author requested not to be sent mail, the function signals |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1630 an error. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1631 With the prefix argument FORCE, insert the header anyway." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1632 (interactive "P") |
17493 | 1633 (let ((co (message-fetch-reply-field "mail-copies-to"))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1634 (when (and (null force) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1635 co |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1636 (or (equal (downcase co) "never") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1637 (equal (downcase co) "nobody"))) |
17493 | 1638 (error "The user has requested not to have copies sent via mail"))) |
1639 (when (and (message-position-on-field "To") | |
1640 (mail-fetch-field "to") | |
1641 (not (string-match "\\` *\\'" (mail-fetch-field "to")))) | |
1642 (insert ", ")) | |
1643 (insert (or (message-fetch-reply-field "reply-to") | |
1644 (message-fetch-reply-field "from") ""))) | |
1645 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1646 (defun message-widen-reply () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1647 "Widen the reply to include maximum recipients." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1648 (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1649 (let ((follow-to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1650 (and message-reply-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1651 (buffer-name message-reply-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1652 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1653 (set-buffer message-reply-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1654 (message-get-reply-headers t))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1655 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1656 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1657 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1658 (dolist (elem follow-to) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1659 (message-remove-header (symbol-name (car elem))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1660 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1661 (insert (symbol-name (car elem)) ": " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1662 (cdr elem) "\n")))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1663 |
17493 | 1664 (defun message-insert-newsgroups () |
1665 "Insert the Newsgroups header from the article being replied to." | |
1666 (interactive) | |
1667 (when (and (message-position-on-field "Newsgroups") | |
1668 (mail-fetch-field "newsgroups") | |
1669 (not (string-match "\\` *\\'" (mail-fetch-field "newsgroups")))) | |
1670 (insert ",")) | |
1671 (insert (or (message-fetch-reply-field "newsgroups") ""))) | |
1672 | |
1673 | |
1674 | |
1675 ;;; Various commands | |
1676 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1677 (defun message-delete-not-region (beg end) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1678 "Delete everything in the body of the current message that is outside of the region." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1679 (interactive "r") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1680 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1681 (goto-char end) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1682 (delete-region (point) (if (not (message-goto-signature)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1683 (point) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1684 (forward-line -2) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1685 (point))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1686 (insert "\n") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1687 (goto-char beg) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1688 (delete-region beg (progn (message-goto-body) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1689 (forward-line 2) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1690 (point)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1691 (when (message-goto-signature) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1692 (forward-line -2))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1693 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1694 (defun message-kill-to-signature () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1695 "Deletes all text up to the signature." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1696 (interactive) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1697 (let ((point (point))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1698 (message-goto-signature) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1699 (unless (eobp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1700 (forward-line -2)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1701 (kill-region point (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1702 (unless (bolp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1703 (insert "\n")))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1704 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1705 (defun message-newline-and-reformat () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1706 "Insert four newlines, and then reformat if inside quoted text." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1707 (interactive) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1708 (let ((prefix "[]>»|:}+ \t]*") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1709 (supercite-thing "[-._a-zA-Z0-9]*[>]+[ \t]*") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1710 quoted point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1711 (unless (bolp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1712 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1713 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1714 (when (looking-at (concat prefix |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1715 supercite-thing)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1716 (setq quoted (match-string 0)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1717 (insert "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1718 (setq point (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1719 (insert "\n\n\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1720 (delete-region (point) (re-search-forward "[ \t]*")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1721 (when quoted |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1722 (insert quoted)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1723 (fill-paragraph nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1724 (goto-char point) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1725 (forward-line 1))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1726 |
17493 | 1727 (defun message-insert-signature (&optional force) |
1728 "Insert a signature. See documentation for the `message-signature' variable." | |
1729 (interactive (list 0)) | |
1730 (let* ((signature | |
1731 (cond | |
1732 ((and (null message-signature) | |
1733 (eq force 0)) | |
1734 (save-excursion | |
1735 (goto-char (point-max)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1736 (not (re-search-backward message-signature-separator nil t)))) |
17493 | 1737 ((and (null message-signature) |
1738 force) | |
1739 t) | |
1740 ((message-functionp message-signature) | |
1741 (funcall message-signature)) | |
1742 ((listp message-signature) | |
1743 (eval message-signature)) | |
1744 (t message-signature))) | |
1745 (signature | |
1746 (cond ((stringp signature) | |
1747 signature) | |
1748 ((and (eq t signature) | |
1749 message-signature-file | |
1750 (file-exists-p message-signature-file)) | |
1751 signature)))) | |
1752 (when signature | |
1753 (goto-char (point-max)) | |
1754 ;; Insert the signature. | |
1755 (unless (bolp) | |
1756 (insert "\n")) | |
1757 (insert "\n-- \n") | |
1758 (if (eq signature t) | |
1759 (insert-file-contents message-signature-file) | |
1760 (insert signature)) | |
1761 (goto-char (point-max)) | |
1762 (or (bolp) (insert "\n"))))) | |
1763 | |
1764 (defun message-elide-region (b e) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1765 "Elide the text between point and mark. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1766 An ellipsis (from `message-elide-ellipsis') will be inserted where the |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1767 text was killed." |
17493 | 1768 (interactive "r") |
1769 (kill-region b e) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1770 (insert message-elide-ellipsis)) |
17493 | 1771 |
1772 (defvar message-caesar-translation-table nil) | |
1773 | |
1774 (defun message-caesar-region (b e &optional n) | |
1775 "Caesar rotation of region by N, default 13, for decrypting netnews." | |
1776 (interactive | |
1777 (list | |
1778 (min (point) (or (mark t) (point))) | |
1779 (max (point) (or (mark t) (point))) | |
1780 (when current-prefix-arg | |
1781 (prefix-numeric-value current-prefix-arg)))) | |
1782 | |
1783 (setq n (if (numberp n) (mod n 26) 13)) ;canonize N | |
1784 (unless (or (zerop n) ; no action needed for a rot of 0 | |
1785 (= b e)) ; no region to rotate | |
1786 ;; We build the table, if necessary. | |
1787 (when (or (not message-caesar-translation-table) | |
1788 (/= (aref message-caesar-translation-table ?a) (+ ?a n))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1789 (setq message-caesar-translation-table |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1790 (message-make-caesar-translation-table n))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1791 (translate-region b e message-caesar-translation-table))) |
17493 | 1792 |
1793 (defun message-make-caesar-translation-table (n) | |
1794 "Create a rot table with offset N." | |
1795 (let ((i -1) | |
1796 (table (make-string 256 0))) | |
1797 (while (< (incf i) 256) | |
1798 (aset table i i)) | |
1799 (concat | |
1800 (substring table 0 ?A) | |
1801 (substring table (+ ?A n) (+ ?A n (- 26 n))) | |
1802 (substring table ?A (+ ?A n)) | |
1803 (substring table (+ ?A 26) ?a) | |
1804 (substring table (+ ?a n) (+ ?a n (- 26 n))) | |
1805 (substring table ?a (+ ?a n)) | |
1806 (substring table (+ ?a 26) 255)))) | |
1807 | |
1808 (defun message-caesar-buffer-body (&optional rotnum) | |
1809 "Caesar rotates all letters in the current buffer by 13 places. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1810 Used to encode/decode possiblyun offensive messages (commonly in net.jokes). |
17493 | 1811 With prefix arg, specifies the number of places to rotate each letter forward. |
1812 Mail and USENET news headers are not rotated." | |
1813 (interactive (if current-prefix-arg | |
1814 (list (prefix-numeric-value current-prefix-arg)) | |
1815 (list nil))) | |
1816 (save-excursion | |
1817 (save-restriction | |
1818 (when (message-goto-body) | |
1819 (narrow-to-region (point) (point-max))) | |
1820 (message-caesar-region (point-min) (point-max) rotnum)))) | |
1821 | |
1822 (defun message-pipe-buffer-body (program) | |
1823 "Pipe the message body in the current buffer through PROGRAM." | |
1824 (save-excursion | |
1825 (save-restriction | |
1826 (when (message-goto-body) | |
1827 (narrow-to-region (point) (point-max))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1828 (shell-command-on-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1829 (point-min) (point-max) program nil t)))) |
17493 | 1830 |
1831 (defun message-rename-buffer (&optional enter-string) | |
1832 "Rename the *message* buffer to \"*message* RECIPIENT\". | |
1833 If the function is run with a prefix, it will ask for a new buffer | |
1834 name, rather than giving an automatic name." | |
1835 (interactive "Pbuffer name: ") | |
1836 (save-excursion | |
1837 (save-restriction | |
1838 (goto-char (point-min)) | |
1839 (narrow-to-region (point) | |
1840 (search-forward mail-header-separator nil 'end)) | |
1841 (let* ((mail-to (or | |
1842 (if (message-news-p) (message-fetch-field "Newsgroups") | |
1843 (message-fetch-field "To")) | |
1844 "")) | |
1845 (mail-trimmed-to | |
1846 (if (string-match "," mail-to) | |
1847 (concat (substring mail-to 0 (match-beginning 0)) ", ...") | |
1848 mail-to)) | |
1849 (name-default (concat "*message* " mail-trimmed-to)) | |
1850 (name (if enter-string | |
1851 (read-string "New buffer name: " name-default) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1852 name-default))) |
17493 | 1853 (rename-buffer name t))))) |
1854 | |
1855 (defun message-fill-yanked-message (&optional justifyp) | |
1856 "Fill the paragraphs of a message yanked into this one. | |
1857 Numeric argument means justify as well." | |
1858 (interactive "P") | |
1859 (save-excursion | |
1860 (goto-char (point-min)) | |
1861 (search-forward (concat "\n" mail-header-separator "\n") nil t) | |
1862 (let ((fill-prefix message-yank-prefix)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1863 (fill-individual-paragraphs (point) (point-max) justifyp)))) |
17493 | 1864 |
1865 (defun message-indent-citation () | |
1866 "Modify text just inserted from a message to be cited. | |
1867 The inserted text should be the region. | |
1868 When this function returns, the region is again around the modified text. | |
1869 | |
1870 Normally, indent each nonblank line `message-indentation-spaces' spaces. | |
1871 However, if `message-yank-prefix' is non-nil, insert that prefix on each line." | |
1872 (let ((start (point))) | |
1873 ;; Remove unwanted headers. | |
1874 (when message-ignored-cited-headers | |
1875 (let (all-removed) | |
1876 (save-restriction | |
1877 (narrow-to-region | |
1878 (goto-char start) | |
1879 (if (search-forward "\n\n" nil t) | |
1880 (1- (point)) | |
1881 (point))) | |
1882 (message-remove-header message-ignored-cited-headers t) | |
1883 (when (= (point-min) (point-max)) | |
1884 (setq all-removed t)) | |
1885 (goto-char (point-max))) | |
1886 (if all-removed | |
1887 (goto-char start) | |
1888 (forward-line 1)))) | |
1889 ;; Delete blank lines at the start of the buffer. | |
1890 (while (and (point-min) | |
1891 (eolp) | |
1892 (not (eobp))) | |
1893 (message-delete-line)) | |
1894 ;; Delete blank lines at the end of the buffer. | |
1895 (goto-char (point-max)) | |
1896 (unless (eolp) | |
1897 (insert "\n")) | |
1898 (while (and (zerop (forward-line -1)) | |
1899 (looking-at "$")) | |
1900 (message-delete-line)) | |
1901 ;; Do the indentation. | |
1902 (if (null message-yank-prefix) | |
1903 (indent-rigidly start (mark t) message-indentation-spaces) | |
1904 (save-excursion | |
1905 (goto-char start) | |
1906 (while (< (point) (mark t)) | |
1907 (insert message-yank-prefix) | |
1908 (forward-line 1)))) | |
1909 (goto-char start))) | |
1910 | |
1911 (defun message-yank-original (&optional arg) | |
1912 "Insert the message being replied to, if any. | |
1913 Puts point before the text and mark after. | |
1914 Normally indents each nonblank line ARG spaces (default 3). However, | |
1915 if `message-yank-prefix' is non-nil, insert that prefix on each line. | |
1916 | |
1917 This function uses `message-cite-function' to do the actual citing. | |
1918 | |
1919 Just \\[universal-argument] as argument means don't indent, insert no | |
1920 prefix, and don't delete any headers." | |
1921 (interactive "P") | |
1922 (let ((modified (buffer-modified-p))) | |
1923 (when (and message-reply-buffer | |
1924 message-cite-function) | |
1925 (delete-windows-on message-reply-buffer t) | |
1926 (insert-buffer message-reply-buffer) | |
1927 (funcall message-cite-function) | |
1928 (message-exchange-point-and-mark) | |
1929 (unless (bolp) | |
1930 (insert ?\n)) | |
1931 (unless modified | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1932 (setq message-checksum (message-checksum)))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1933 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1934 (defun message-yank-buffer (buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1935 "Insert BUFFER into the current buffer and quote it." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1936 (interactive "bYank buffer: ") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1937 (let ((message-reply-buffer buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1938 (save-window-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1939 (message-yank-original)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1940 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1941 (defun message-buffers () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1942 "Return a list of active message buffers." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1943 (let (buffers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1944 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1945 (dolist (buffer (buffer-list t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1946 (set-buffer buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1947 (when (and (eq major-mode 'message-mode) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1948 (null message-sent-message-via)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1949 (push (buffer-name buffer) buffers)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1950 (nreverse buffers))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1951 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1952 (defun message-cite-original-without-signature () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1953 "Cite function in the standard Message manner." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1954 (let ((start (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1955 (end (mark t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1956 (functions |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1957 (when message-indent-citation-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1958 (if (listp message-indent-citation-function) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1959 message-indent-citation-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1960 (list message-indent-citation-function))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1961 (mml-quote-region start end) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1962 ;; Allow undoing. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1963 (undo-boundary) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1964 (goto-char end) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1965 (when (re-search-backward message-signature-separator start t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1966 ;; Also peel off any blank lines before the signature. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1967 (forward-line -1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1968 (while (looking-at "^[ \t]*$") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1969 (forward-line -1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1970 (forward-line 1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1971 (delete-region (point) end)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1972 (goto-char start) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1973 (while functions |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1974 (funcall (pop functions))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1975 (when message-citation-line-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1976 (unless (bolp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1977 (insert "\n")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1978 (funcall message-citation-line-function)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1979 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1980 (defvar mail-citation-hook) ;Compiler directive |
17493 | 1981 (defun message-cite-original () |
1982 "Cite function in the standard Message manner." | |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
1983 (if (and (boundp 'mail-citation-hook) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1984 mail-citation-hook) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
1985 (run-hooks 'mail-citation-hook) |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
1986 (let ((start (point)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1987 (end (mark t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1988 (functions |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1989 (when message-indent-citation-function |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1990 (if (listp message-indent-citation-function) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1991 message-indent-citation-function |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1992 (list message-indent-citation-function))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1993 (mml-quote-region start end) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
1994 (goto-char start) |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
1995 (while functions |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1996 (funcall (pop functions))) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
1997 (when message-citation-line-function |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1998 (unless (bolp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1999 (insert "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2000 (funcall message-citation-line-function))))) |
17493 | 2001 |
2002 (defun message-insert-citation-line () | |
2003 "Function that inserts a simple citation line." | |
2004 (when message-reply-headers | |
2005 (insert (mail-header-from message-reply-headers) " writes:\n\n"))) | |
2006 | |
2007 (defun message-position-on-field (header &rest afters) | |
2008 (let ((case-fold-search t)) | |
2009 (save-restriction | |
2010 (narrow-to-region | |
2011 (goto-char (point-min)) | |
2012 (progn | |
2013 (re-search-forward | |
2014 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2015 (match-beginning 0))) | |
2016 (goto-char (point-min)) | |
2017 (if (re-search-forward (concat "^" (regexp-quote header) ":") nil t) | |
2018 (progn | |
2019 (re-search-forward "^[^ \t]" nil 'move) | |
2020 (beginning-of-line) | |
2021 (skip-chars-backward "\n") | |
2022 t) | |
2023 (while (and afters | |
2024 (not (re-search-forward | |
2025 (concat "^" (regexp-quote (car afters)) ":") | |
2026 nil t))) | |
2027 (pop afters)) | |
2028 (when afters | |
2029 (re-search-forward "^[^ \t]" nil 'move) | |
2030 (beginning-of-line)) | |
2031 (insert header ": \n") | |
2032 (forward-char -1) | |
2033 nil)))) | |
2034 | |
2035 (defun message-remove-signature () | |
2036 "Remove the signature from the text between point and mark. | |
2037 The text will also be indented the normal way." | |
2038 (save-excursion | |
2039 (let ((start (point)) | |
2040 mark) | |
2041 (if (not (re-search-forward message-signature-separator (mark t) t)) | |
2042 ;; No signature here, so we just indent the cited text. | |
2043 (message-indent-citation) | |
2044 ;; Find the last non-empty line. | |
2045 (forward-line -1) | |
2046 (while (looking-at "[ \t]*$") | |
2047 (forward-line -1)) | |
2048 (forward-line 1) | |
2049 (setq mark (set-marker (make-marker) (point))) | |
2050 (goto-char start) | |
2051 (message-indent-citation) | |
2052 ;; Enable undoing the deletion. | |
2053 (undo-boundary) | |
2054 (delete-region mark (mark t)) | |
2055 (set-marker mark nil))))) | |
2056 | |
2057 | |
2058 | |
2059 ;;; | |
2060 ;;; Sending messages | |
2061 ;;; | |
2062 | |
2063 (defun message-send-and-exit (&optional arg) | |
2064 "Send message like `message-send', then, if no errors, exit from mail buffer." | |
2065 (interactive "P") | |
2066 (let ((buf (current-buffer)) | |
2067 (actions message-exit-actions)) | |
2068 (when (and (message-send arg) | |
2069 (buffer-name buf)) | |
2070 (if message-kill-buffer-on-exit | |
2071 (kill-buffer buf) | |
2072 (bury-buffer buf) | |
2073 (when (eq buf (current-buffer)) | |
2074 (message-bury buf))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2075 (message-do-actions actions) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2076 t))) |
17493 | 2077 |
2078 (defun message-dont-send () | |
2079 "Don't send the message you have been editing." | |
2080 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2081 (set-buffer-modified-p t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2082 (save-buffer) |
17493 | 2083 (let ((actions message-postpone-actions)) |
2084 (message-bury (current-buffer)) | |
2085 (message-do-actions actions))) | |
2086 | |
2087 (defun message-kill-buffer () | |
2088 "Kill the current buffer." | |
2089 (interactive) | |
2090 (when (or (not (buffer-modified-p)) | |
2091 (yes-or-no-p "Message modified; kill anyway? ")) | |
2092 (let ((actions message-kill-actions)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2093 (setq buffer-file-name nil) |
17493 | 2094 (kill-buffer (current-buffer)) |
2095 (message-do-actions actions)))) | |
2096 | |
2097 (defun message-bury (buffer) | |
2098 "Bury this mail buffer." | |
2099 (let ((newbuf (other-buffer buffer))) | |
2100 (bury-buffer buffer) | |
2101 (if (and (fboundp 'frame-parameters) | |
2102 (cdr (assq 'dedicated (frame-parameters))) | |
2103 (not (null (delq (selected-frame) (visible-frame-list))))) | |
2104 (delete-frame (selected-frame)) | |
2105 (switch-to-buffer newbuf)))) | |
2106 | |
2107 (defun message-send (&optional arg) | |
2108 "Send the message in the current buffer. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2109 If `message-interactive' is non-nil, wait for success indication or |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2110 error messages, and inform user. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2111 Otherwise any failure is reported in a message back to the user from |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2112 the mailer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2113 The usage of ARG is defined by the instance that called Message. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2114 It should typically alter the sending method in some way or other." |
17493 | 2115 (interactive "P") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2116 ;; Make it possible to undo the coming changes. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2117 (undo-boundary) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2118 (let ((inhibit-read-only t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2119 (put-text-property (point-min) (point-max) 'read-only nil)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2120 (message-fix-before-sending) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2121 (run-hooks 'message-send-hook) |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2122 (message message-sending-message) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2123 (let ((alist message-send-method-alist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2124 (success t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2125 elem sent) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2126 (while (and success |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2127 (setq elem (pop alist))) |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2128 (when (funcall (cadr elem)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2129 (when (and (or (not (memq (car elem) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2130 message-sent-message-via)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2131 (y-or-n-p |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2132 (format |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2133 "Already sent message via %s; resend? " |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2134 (car elem)))) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2135 (setq success (funcall (caddr elem) arg))) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2136 (setq sent t)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2137 (unless (or sent (not success)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2138 (error "No methods specified to send by")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2139 (when (and success sent) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2140 (message-do-fcc) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2141 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2142 (run-hooks 'message-sent-hook)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2143 (message "Sending...done") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2144 ;; Mark the buffer as unmodified and delete auto-save. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2145 (set-buffer-modified-p nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2146 (delete-auto-save-file-if-necessary t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2147 (message-disassociate-draft) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2148 ;; Delete other mail buffers and stuff. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2149 (message-do-send-housekeeping) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2150 (message-do-actions message-send-actions) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2151 ;; Return success. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2152 t))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2153 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2154 (defun message-send-via-mail (arg) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2155 "Send the current message via mail." |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2156 (message-send-mail arg)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2157 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2158 (defun message-send-via-news (arg) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2159 "Send the current message via news." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2160 (funcall message-send-news-function arg)) |
17493 | 2161 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2162 (defmacro message-check (type &rest forms) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2163 "Eval FORMS if TYPE is to be checked." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2164 `(or (message-check-element ,type) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2165 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2166 ,@forms))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2167 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2168 (put 'message-check 'lisp-indent-function 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2169 (put 'message-check 'edebug-form-spec '(form body)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2170 |
17493 | 2171 (defun message-fix-before-sending () |
2172 "Do various things to make the message nice before sending it." | |
2173 ;; Make sure there's a newline at the end of the message. | |
2174 (goto-char (point-max)) | |
2175 (unless (bolp) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2176 (insert "\n")) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2177 ;; Delete all invisible text. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2178 (message-check 'invisible-text |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2179 (when (text-property-any (point-min) (point-max) 'invisible t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2180 (put-text-property (point-min) (point-max) 'invisible nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2181 (unless (yes-or-no-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2182 "Invisible text found and made visible; continue posting? ") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2183 (error "Invisible text found and made visible"))))) |
17493 | 2184 |
2185 (defun message-add-action (action &rest types) | |
2186 "Add ACTION to be performed when doing an exit of type TYPES." | |
2187 (let (var) | |
2188 (while types | |
2189 (set (setq var (intern (format "message-%s-actions" (pop types)))) | |
2190 (nconc (symbol-value var) (list action)))))) | |
2191 | |
2192 (defun message-do-actions (actions) | |
2193 "Perform all actions in ACTIONS." | |
2194 ;; Now perform actions on successful sending. | |
2195 (while actions | |
2196 (ignore-errors | |
2197 (cond | |
2198 ;; A simple function. | |
2199 ((message-functionp (car actions)) | |
2200 (funcall (car actions))) | |
2201 ;; Something to be evaled. | |
2202 (t | |
2203 (eval (car actions))))) | |
2204 (pop actions))) | |
2205 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2206 (defun message-send-mail-partially () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2207 "Sendmail as message/partial." |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2208 ;; replace the header delimiter with a blank line |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2209 (goto-char (point-min)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2210 (re-search-forward |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2211 (concat "^" (regexp-quote mail-header-separator) "\n")) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2212 (replace-match "\n") |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2213 (run-hooks 'message-send-mail-hook) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2214 (let ((p (goto-char (point-min))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2215 (tembuf (message-generate-new-buffer-clone-locals " message temp")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2216 (curbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2217 (id (message-make-message-id)) (n 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2218 plist total header required-mail-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2219 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2220 (if (< (point-max) (+ p message-send-mail-partially-limit)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2221 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2222 (goto-char (+ p message-send-mail-partially-limit)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2223 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2224 (if (<= (point) p) (forward-line 1))) ;; In case of bad message. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2225 (push p plist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2226 (setq p (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2227 (setq total (length plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2228 (push (point-max) plist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2229 (setq plist (nreverse plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2230 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2231 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2232 (setq p (pop plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2233 (while plist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2234 (set-buffer curbuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2235 (copy-to-buffer tembuf p (car plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2236 (set-buffer tembuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2237 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2238 (if header |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2239 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2240 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2241 (narrow-to-region (point) (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2242 (insert header)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2243 (message-goto-eoh) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2244 (setq header (buffer-substring (point-min) (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2245 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2246 (narrow-to-region (point) (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2247 (insert header) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2248 (message-remove-header "Mime-Version") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2249 (message-remove-header "Content-Type") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2250 (message-remove-header "Content-Transfer-Encoding") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2251 (message-remove-header "Message-ID") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2252 (message-remove-header "Lines") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2253 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2254 (insert "Mime-Version: 1.0\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2255 (setq header (buffer-substring (point-min) (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2256 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2257 (insert (format "Content-Type: message/partial; id=\"%s\"; number=%d; total=%d\n" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2258 id n total)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2259 (let ((mail-header-separator "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2260 (when (memq 'Message-ID message-required-mail-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2261 (insert "Message-ID: " (message-make-message-id) "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2262 (when (memq 'Lines message-required-mail-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2263 (let ((mail-header-separator "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2264 (insert "Lines: " (message-make-lines) "\n"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2265 (message-goto-subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2266 (end-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2267 (insert (format " (%d/%d)" n total)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2268 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2269 (insert "\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2270 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2271 (mm-with-unibyte-current-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2272 (funcall message-send-mail-function))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2273 (setq n (+ n 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2274 (setq p (pop plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2275 (erase-buffer))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2276 (kill-buffer tembuf)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2277 |
17493 | 2278 (defun message-send-mail (&optional arg) |
2279 (require 'mail-utils) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2280 (let* ((tembuf (message-generate-new-buffer-clone-locals " message temp")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2281 (case-fold-search nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2282 (news (message-news-p)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2283 (mailbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2284 (message-this-is-mail t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2285 (message-posting-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2286 (if (fboundp 'gnus-setup-posting-charset) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2287 (gnus-setup-posting-charset nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2288 message-posting-charset))) |
17493 | 2289 (save-restriction |
2290 (message-narrow-to-headers) | |
2291 ;; Insert some headers. | |
2292 (let ((message-deletable-headers | |
2293 (if news nil message-deletable-headers))) | |
2294 (message-generate-headers message-required-mail-headers)) | |
2295 ;; Let the user do all of the above. | |
2296 (run-hooks 'message-header-hook)) | |
2297 (unwind-protect | |
2298 (save-excursion | |
2299 (set-buffer tembuf) | |
2300 (erase-buffer) | |
2301 ;; Avoid copying text props. | |
2302 (insert (format | |
2303 "%s" (save-excursion | |
2304 (set-buffer mailbuf) | |
2305 (buffer-string)))) | |
2306 ;; Remove some headers. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2307 (message-encode-message-body) |
17493 | 2308 (save-restriction |
2309 (message-narrow-to-headers) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2310 ;; We (re)generate the Lines header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2311 (when (memq 'Lines message-required-mail-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2312 (message-generate-headers '(Lines))) |
17493 | 2313 ;; Remove some headers. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2314 (message-remove-header message-ignored-mail-headers t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2315 (let ((mail-parse-charset message-default-charset)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2316 (mail-encode-encoded-word-buffer))) |
17493 | 2317 (goto-char (point-max)) |
2318 ;; require one newline at the end. | |
2319 (or (= (preceding-char) ?\n) | |
2320 (insert ?\n)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2321 (when |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2322 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2323 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2324 (and news |
17493 | 2325 (or (message-fetch-field "cc") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2326 (message-fetch-field "to")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2327 (string= "text/plain" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2328 (car |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2329 (mail-header-parse-content-type |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2330 (message-fetch-field "content-type")))))) |
17493 | 2331 (message-insert-courtesy-copy)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2332 (if (or (not message-send-mail-partially-limit) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2333 (< (point-max) message-send-mail-partially-limit) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2334 (not (y-or-n-p "The message size is too large, should it be sent partially?"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2335 (mm-with-unibyte-current-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2336 (funcall message-send-mail-function)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2337 (message-send-mail-partially))) |
17493 | 2338 (kill-buffer tembuf)) |
2339 (set-buffer mailbuf) | |
2340 (push 'mail message-sent-message-via))) | |
2341 | |
2342 (defun message-send-mail-with-sendmail () | |
2343 "Send off the prepared buffer with sendmail." | |
2344 (let ((errbuf (if message-interactive | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2345 (message-generate-new-buffer-clone-locals |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2346 " sendmail errors") |
17493 | 2347 0)) |
2348 resend-to-addresses delimline) | |
2349 (let ((case-fold-search t)) | |
2350 (save-restriction | |
2351 (message-narrow-to-headers) | |
2352 (setq resend-to-addresses (message-fetch-field "resent-to"))) | |
2353 ;; Change header-delimiter to be what sendmail expects. | |
2354 (goto-char (point-min)) | |
2355 (re-search-forward | |
2356 (concat "^" (regexp-quote mail-header-separator) "\n")) | |
2357 (replace-match "\n") | |
2358 (backward-char 1) | |
2359 (setq delimline (point-marker)) | |
2360 (run-hooks 'message-send-mail-hook) | |
2361 ;; Insert an extra newline if we need it to work around | |
2362 ;; Sun's bug that swallows newlines. | |
2363 (goto-char (1+ delimline)) | |
2364 (when (eval message-mailer-swallows-blank-line) | |
2365 (newline)) | |
2366 (when message-interactive | |
2367 (save-excursion | |
2368 (set-buffer errbuf) | |
2369 (erase-buffer)))) | |
23096
e4419c63d4d7
(message-send-mail-with-sendmail): Bind
Kenichi Handa <handa@m17n.org>
parents:
22952
diff
changeset
|
2370 (let ((default-directory "/") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2371 (coding-system-for-write message-send-coding-system)) |
17493 | 2372 (apply 'call-process-region |
2373 (append (list (point-min) (point-max) | |
2374 (if (boundp 'sendmail-program) | |
2375 sendmail-program | |
2376 "/usr/lib/sendmail") | |
2377 nil errbuf nil "-oi") | |
2378 ;; Always specify who from, | |
2379 ;; since some systems have broken sendmails. | |
2380 ;; But some systems are more broken with -f, so | |
2381 ;; we'll let users override this. | |
2382 (if (null message-sendmail-f-is-evil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2383 (list "-f" (message-make-address))) |
17493 | 2384 ;; These mean "report errors by mail" |
2385 ;; and "deliver in background". | |
2386 (if (null message-interactive) '("-oem" "-odb")) | |
2387 ;; Get the addresses from the message | |
2388 ;; unless this is a resend. | |
2389 ;; We must not do that for a resend | |
2390 ;; because we would find the original addresses. | |
2391 ;; For a resend, include the specific addresses. | |
2392 (if resend-to-addresses | |
2393 (list resend-to-addresses) | |
2394 '("-t"))))) | |
2395 (when message-interactive | |
2396 (save-excursion | |
2397 (set-buffer errbuf) | |
2398 (goto-char (point-min)) | |
2399 (while (re-search-forward "\n\n* *" nil t) | |
2400 (replace-match "; ")) | |
2401 (if (not (zerop (buffer-size))) | |
2402 (error "Sending...failed to %s" | |
2403 (buffer-substring (point-min) (point-max))))) | |
2404 (when (bufferp errbuf) | |
2405 (kill-buffer errbuf))))) | |
2406 | |
2407 (defun message-send-mail-with-qmail () | |
2408 "Pass the prepared message buffer to qmail-inject. | |
2409 Refer to the documentation for the variable `message-send-mail-function' | |
2410 to find out how to use this." | |
2411 ;; replace the header delimiter with a blank line | |
2412 (goto-char (point-min)) | |
2413 (re-search-forward | |
2414 (concat "^" (regexp-quote mail-header-separator) "\n")) | |
2415 (replace-match "\n") | |
2416 (run-hooks 'message-send-mail-hook) | |
2417 ;; send the message | |
2418 (case | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2419 (let ((coding-system-for-write message-send-coding-system)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2420 (apply |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2421 'call-process-region 1 (point-max) message-qmail-inject-program |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2422 nil nil nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2423 ;; qmail-inject's default behaviour is to look for addresses on the |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2424 ;; command line; if there're none, it scans the headers. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2425 ;; yes, it does The Right Thing w.r.t. Resent-To and it's kin. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2426 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2427 ;; in general, ALL of qmail-inject's defaults are perfect for simply |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2428 ;; reading a formatted (i. e., at least a To: or Resent-To header) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2429 ;; message from stdin. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2430 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2431 ;; qmail also has the advantage of not having been raped by |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2432 ;; various vendors, so we don't have to allow for that, either -- |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2433 ;; compare this with message-send-mail-with-sendmail and weep |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2434 ;; for sendmail's lost innocence. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2435 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2436 ;; all this is way cool coz it lets us keep the arguments entirely |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2437 ;; free for -inject-arguments -- a big win for the user and for us |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2438 ;; since we don't have to play that double-guessing game and the user |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2439 ;; gets full control (no gestapo'ish -f's, for instance). --sj |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2440 message-qmail-inject-args)) |
17493 | 2441 ;; qmail-inject doesn't say anything on it's stdout/stderr, |
2442 ;; we have to look at the retval instead | |
2443 (0 nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2444 (1 (error "qmail-inject reported permanent failure")) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2445 (111 (error "qmail-inject reported transient failure")) |
17493 | 2446 ;; should never happen |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2447 (t (error "qmail-inject reported unknown failure")))) |
17493 | 2448 |
2449 (defun message-send-mail-with-mh () | |
2450 "Send the prepared message buffer with mh." | |
2451 (let ((mh-previous-window-config nil) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2452 (name (mh-new-draft-name))) |
17493 | 2453 (setq buffer-file-name name) |
2454 ;; MH wants to generate these headers itself. | |
2455 (when message-mh-deletable-headers | |
2456 (let ((headers message-mh-deletable-headers)) | |
2457 (while headers | |
2458 (goto-char (point-min)) | |
2459 (and (re-search-forward | |
2460 (concat "^" (symbol-name (car headers)) ": *") nil t) | |
2461 (message-delete-line)) | |
2462 (pop headers)))) | |
2463 (run-hooks 'message-send-mail-hook) | |
2464 ;; Pass it on to mh. | |
2465 (mh-send-letter))) | |
2466 | |
2467 (defun message-send-news (&optional arg) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2468 (let* ((tembuf (message-generate-new-buffer-clone-locals " *message temp*")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2469 (case-fold-search nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2470 (method (if (message-functionp message-post-method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2471 (funcall message-post-method arg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2472 message-post-method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2473 (group-name-charset (gnus-group-name-charset method "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2474 (rfc2047-header-encoding-alist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2475 (if group-name-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2476 (cons (cons "Newsgroups" group-name-charset) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2477 rfc2047-header-encoding-alist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2478 rfc2047-header-encoding-alist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2479 (messbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2480 (message-syntax-checks |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2481 (if arg |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2482 (cons '(existing-newsgroups . disabled) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2483 message-syntax-checks) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2484 message-syntax-checks)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2485 (message-this-is-news t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2486 (message-posting-charset (gnus-setup-posting-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2487 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2488 (message-narrow-to-headers-or-head) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2489 (message-fetch-field "Newsgroups")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2490 result) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2491 (if (not (message-check-news-body-syntax)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2492 nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2493 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2494 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2495 ;; Insert some headers. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2496 (message-generate-headers message-required-news-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2497 ;; Let the user do all of the above. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2498 (run-hooks 'message-header-hook)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2499 (if group-name-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2500 (setq message-syntax-checks |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2501 (cons '(valid-newsgroups . disabled) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2502 message-syntax-checks))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2503 (message-cleanup-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2504 (if (not (message-check-news-syntax)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2505 nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2506 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2507 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2508 (set-buffer tembuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2509 (buffer-disable-undo) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2510 (erase-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2511 ;; Avoid copying text props. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2512 (insert (format |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2513 "%s" (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2514 (set-buffer messbuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2515 (buffer-string)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2516 (message-encode-message-body) |
17493 | 2517 ;; Remove some headers. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2518 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2519 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2520 ;; We (re)generate the Lines header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2521 (when (memq 'Lines message-required-mail-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2522 (message-generate-headers '(Lines))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2523 ;; Remove some headers. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2524 (message-remove-header message-ignored-news-headers t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2525 (let ((mail-parse-charset message-default-charset)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2526 (mail-encode-encoded-word-buffer))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2527 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2528 ;; require one newline at the end. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2529 (or (= (preceding-char) ?\n) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2530 (insert ?\n)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2531 (let ((case-fold-search t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2532 ;; Remove the delimiter. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2533 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2534 (re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2535 (concat "^" (regexp-quote mail-header-separator) "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2536 (replace-match "\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2537 (backward-char 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2538 (run-hooks 'message-send-news-hook) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2539 (gnus-open-server method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2540 (setq result (let ((mail-header-separator "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2541 (gnus-request-post method)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2542 (kill-buffer tembuf)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2543 (set-buffer messbuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2544 (if result |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2545 (push 'news message-sent-message-via) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2546 (message "Couldn't send message via news: %s" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2547 (nnheader-get-report (car method))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2548 nil))))) |
17493 | 2549 |
2550 ;;; | |
2551 ;;; Header generation & syntax checking. | |
2552 ;;; | |
2553 | |
2554 (defun message-check-element (type) | |
2555 "Returns non-nil if this type is not to be checked." | |
2556 (if (eq message-syntax-checks 'dont-check-for-anything-just-trust-me) | |
2557 t | |
2558 (let ((able (assq type message-syntax-checks))) | |
2559 (and (consp able) | |
2560 (eq (cdr able) 'disabled))))) | |
2561 | |
2562 (defun message-check-news-syntax () | |
2563 "Check the syntax of the message." | |
2564 (save-excursion | |
2565 (save-restriction | |
2566 (widen) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2567 ;; We narrow to the headers and check them first. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2568 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2569 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2570 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2571 (message-check-news-header-syntax)))))) |
17493 | 2572 |
2573 (defun message-check-news-header-syntax () | |
2574 (and | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2575 ;; Check Newsgroups header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2576 (message-check 'newsgroups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2577 (let ((group (message-fetch-field "newsgroups"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2578 (or |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2579 (and group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2580 (not (string-match "\\`[ \t]*\\'" group))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2581 (ignore |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2582 (message |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2583 "The newsgroups field is empty or missing. Posting is denied."))))) |
17493 | 2584 ;; Check the Subject header. |
2585 (message-check 'subject | |
2586 (let* ((case-fold-search t) | |
2587 (subject (message-fetch-field "subject"))) | |
2588 (or | |
2589 (and subject | |
2590 (not (string-match "\\`[ \t]*\\'" subject))) | |
2591 (ignore | |
2592 (message | |
2593 "The subject field is empty or missing. Posting is denied."))))) | |
2594 ;; Check for commands in Subject. | |
2595 (message-check 'subject-cmsg | |
2596 (if (string-match "^cmsg " (message-fetch-field "subject")) | |
2597 (y-or-n-p | |
2598 "The control code \"cmsg\" is in the subject. Really post? ") | |
2599 t)) | |
2600 ;; Check for multiple identical headers. | |
2601 (message-check 'multiple-headers | |
2602 (let (found) | |
2603 (while (and (not found) | |
2604 (re-search-forward "^[^ \t:]+: " nil t)) | |
2605 (save-excursion | |
2606 (or (re-search-forward | |
2607 (concat "^" | |
2608 (regexp-quote | |
2609 (setq found | |
2610 (buffer-substring | |
2611 (match-beginning 0) (- (match-end 0) 2)))) | |
2612 ":") | |
2613 nil t) | |
2614 (setq found nil)))) | |
2615 (if found | |
2616 (y-or-n-p (format "Multiple %s headers. Really post? " found)) | |
2617 t))) | |
2618 ;; Check for Version and Sendsys. | |
2619 (message-check 'sendsys | |
2620 (if (re-search-forward "^Sendsys:\\|^Version:" nil t) | |
2621 (y-or-n-p | |
2622 (format "The article contains a %s command. Really post? " | |
2623 (buffer-substring (match-beginning 0) | |
2624 (1- (match-end 0))))) | |
2625 t)) | |
2626 ;; See whether we can shorten Followup-To. | |
2627 (message-check 'shorten-followup-to | |
2628 (let ((newsgroups (message-fetch-field "newsgroups")) | |
2629 (followup-to (message-fetch-field "followup-to")) | |
2630 to) | |
2631 (when (and newsgroups | |
2632 (string-match "," newsgroups) | |
2633 (not followup-to) | |
2634 (not | |
2635 (zerop | |
2636 (length | |
2637 (setq to (completing-read | |
2638 "Followups to: (default all groups) " | |
2639 (mapcar (lambda (g) (list g)) | |
2640 (cons "poster" | |
2641 (message-tokenize-header | |
2642 newsgroups))))))))) | |
2643 (goto-char (point-min)) | |
2644 (insert "Followup-To: " to "\n")) | |
2645 t)) | |
2646 ;; Check "Shoot me". | |
2647 (message-check 'shoot | |
2648 (if (re-search-forward | |
2649 "Message-ID.*.i-did-not-set--mail-host-address--so-shoot-me" nil t) | |
2650 (y-or-n-p "You appear to have a misconfigured system. Really post? ") | |
2651 t)) | |
2652 ;; Check for Approved. | |
2653 (message-check 'approved | |
2654 (if (re-search-forward "^Approved:" nil t) | |
2655 (y-or-n-p "The article contains an Approved header. Really post? ") | |
2656 t)) | |
2657 ;; Check the Message-ID header. | |
2658 (message-check 'message-id | |
2659 (let* ((case-fold-search t) | |
2660 (message-id (message-fetch-field "message-id" t))) | |
2661 (or (not message-id) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2662 ;; Is there an @ in the ID? |
17493 | 2663 (and (string-match "@" message-id) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2664 ;; Is there a dot in the ID? |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2665 (string-match "@[^.]*\\." message-id) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2666 ;; Does the ID end with a dot? |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2667 (not (string-match "\\.>" message-id))) |
17493 | 2668 (y-or-n-p |
2669 (format "The Message-ID looks strange: \"%s\". Really post? " | |
2670 message-id))))) | |
2671 ;; Check the Newsgroups & Followup-To headers. | |
2672 (message-check 'existing-newsgroups | |
2673 (let* ((case-fold-search t) | |
2674 (newsgroups (message-fetch-field "newsgroups")) | |
2675 (followup-to (message-fetch-field "followup-to")) | |
2676 (groups (message-tokenize-header | |
2677 (if followup-to | |
2678 (concat newsgroups "," followup-to) | |
2679 newsgroups))) | |
2680 (hashtb (and (boundp 'gnus-active-hashtb) | |
2681 gnus-active-hashtb)) | |
2682 errors) | |
2683 (if (or (not hashtb) | |
2684 (not (boundp 'gnus-read-active-file)) | |
2685 (not gnus-read-active-file) | |
2686 (eq gnus-read-active-file 'some)) | |
2687 t | |
2688 (while groups | |
2689 (when (and (not (boundp (intern (car groups) hashtb))) | |
2690 (not (equal (car groups) "poster"))) | |
2691 (push (car groups) errors)) | |
2692 (pop groups)) | |
2693 (if (not errors) | |
2694 t | |
2695 (y-or-n-p | |
2696 (format | |
2697 "Really post to %s unknown group%s: %s " | |
2698 (if (= (length errors) 1) "this" "these") | |
2699 (if (= (length errors) 1) "" "s") | |
2700 (mapconcat 'identity errors ", "))))))) | |
2701 ;; Check the Newsgroups & Followup-To headers for syntax errors. | |
2702 (message-check 'valid-newsgroups | |
2703 (let ((case-fold-search t) | |
2704 (headers '("Newsgroups" "Followup-To")) | |
2705 header error) | |
2706 (while (and headers (not error)) | |
2707 (when (setq header (mail-fetch-field (car headers))) | |
2708 (if (or | |
2709 (not | |
2710 (string-match | |
2711 "\\`\\([-+_&.a-zA-Z0-9]+\\)?\\(,[-+_&.a-zA-Z0-9]+\\)*\\'" | |
2712 header)) | |
2713 (memq | |
2714 nil (mapcar | |
2715 (lambda (g) | |
2716 (not (string-match "\\.\\'\\|\\.\\." g))) | |
2717 (message-tokenize-header header ",")))) | |
2718 (setq error t))) | |
2719 (unless error | |
2720 (pop headers))) | |
2721 (if (not error) | |
2722 t | |
2723 (y-or-n-p | |
2724 (format "The %s header looks odd: \"%s\". Really post? " | |
2725 (car headers) header))))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2726 (message-check 'repeated-newsgroups |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2727 (let ((case-fold-search t) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2728 (headers '("Newsgroups" "Followup-To")) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2729 header error groups group) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2730 (while (and headers |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2731 (not error)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2732 (when (setq header (mail-fetch-field (pop headers))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2733 (setq groups (message-tokenize-header header ",")) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2734 (while (setq group (pop groups)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2735 (when (member group groups) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2736 (setq error group |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2737 groups nil))))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2738 (if (not error) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2739 t |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2740 (y-or-n-p |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2741 (format "Group %s is repeated in headers. Really post? " error))))) |
17493 | 2742 ;; Check the From header. |
2743 (message-check 'from | |
2744 (let* ((case-fold-search t) | |
2745 (from (message-fetch-field "from")) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2746 ad) |
17493 | 2747 (cond |
2748 ((not from) | |
2749 (message "There is no From line. Posting is denied.") | |
2750 nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2751 ((or (not (string-match |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2752 "@[^\\.]*\\." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2753 (setq ad (nth 1 (mail-extract-address-components |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2754 from))))) ;larsi@ifi |
17493 | 2755 (string-match "\\.\\." ad) ;larsi@ifi..uio |
2756 (string-match "@\\." ad) ;larsi@.ifi.uio | |
2757 (string-match "\\.$" ad) ;larsi@ifi.uio. | |
2758 (not (string-match "^[^@]+@[^@]+$" ad)) ;larsi.ifi.uio | |
2759 (string-match "(.*).*(.*)" from)) ;(lars) (lars) | |
2760 (message | |
2761 "Denied posting -- the From looks strange: \"%s\"." from) | |
2762 nil) | |
2763 (t t)))))) | |
2764 | |
2765 (defun message-check-news-body-syntax () | |
2766 (and | |
2767 ;; Check for long lines. | |
2768 (message-check 'long-lines | |
2769 (goto-char (point-min)) | |
2770 (re-search-forward | |
2771 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2772 (while (and | |
2773 (progn | |
2774 (end-of-line) | |
2775 (< (current-column) 80)) | |
2776 (zerop (forward-line 1)))) | |
2777 (or (bolp) | |
2778 (eobp) | |
2779 (y-or-n-p | |
2780 "You have lines longer than 79 characters. Really post? "))) | |
2781 ;; Check whether the article is empty. | |
2782 (message-check 'empty | |
2783 (goto-char (point-min)) | |
2784 (re-search-forward | |
2785 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2786 (forward-line 1) | |
2787 (let ((b (point))) | |
2788 (goto-char (point-max)) | |
2789 (re-search-backward message-signature-separator nil t) | |
2790 (beginning-of-line) | |
2791 (or (re-search-backward "[^ \n\t]" b t) | |
2792 (y-or-n-p "Empty article. Really post? ")))) | |
2793 ;; Check for control characters. | |
2794 (message-check 'control-chars | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2795 (if (re-search-forward "[\000-\007\013\015-\032\034-\037\200-\237]" nil t) |
17493 | 2796 (y-or-n-p |
2797 "The article contains control characters. Really post? ") | |
2798 t)) | |
2799 ;; Check excessive size. | |
2800 (message-check 'size | |
2801 (if (> (buffer-size) 60000) | |
2802 (y-or-n-p | |
2803 (format "The article is %d octets long. Really post? " | |
2804 (buffer-size))) | |
2805 t)) | |
2806 ;; Check whether any new text has been added. | |
2807 (message-check 'new-text | |
2808 (or | |
2809 (not message-checksum) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2810 (not (eq (message-checksum) message-checksum)) |
17493 | 2811 (y-or-n-p |
2812 "It looks like no new text has been added. Really post? "))) | |
2813 ;; Check the length of the signature. | |
2814 (message-check 'signature | |
2815 (goto-char (point-max)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2816 (if (> (count-lines (point) (point-max)) 5) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2817 (y-or-n-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2818 (format |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2819 "Your .sig is %d lines; it should be max 4. Really post? " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2820 (1- (count-lines (point) (point-max))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2821 t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2822 ;; Ensure that text follows last quoted portion. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2823 (message-check 'quoting-style |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2824 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2825 (let ((no-problem t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2826 (when (search-backward-regexp "^>[^\n]*\n>" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2827 (setq no-problem nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2828 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2829 (when (and (not (eolp)) (looking-at "[^> \t]")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2830 (setq no-problem t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2831 (forward-line))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2832 (if no-problem |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2833 t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2834 (y-or-n-p "Your text should follow quoted text. Really post? ")))))) |
17493 | 2835 |
2836 (defun message-checksum () | |
2837 "Return a \"checksum\" for the current buffer." | |
2838 (let ((sum 0)) | |
2839 (save-excursion | |
2840 (goto-char (point-min)) | |
2841 (re-search-forward | |
2842 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2843 (while (not (eobp)) | |
2844 (when (not (looking-at "[ \t\n]")) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2845 (setq sum (logxor (ash sum 1) (if (natnump sum) 0 1) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2846 (char-after)))) |
17493 | 2847 (forward-char 1))) |
2848 sum)) | |
2849 | |
2850 (defun message-do-fcc () | |
2851 "Process Fcc headers in the current buffer." | |
2852 (let ((case-fold-search t) | |
2853 (buf (current-buffer)) | |
2854 list file) | |
2855 (save-excursion | |
2856 (set-buffer (get-buffer-create " *message temp*")) | |
2857 (erase-buffer) | |
2858 (insert-buffer-substring buf) | |
2859 (save-restriction | |
2860 (message-narrow-to-headers) | |
2861 (while (setq file (message-fetch-field "fcc")) | |
2862 (push file list) | |
2863 (message-remove-header "fcc" nil t))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2864 (message-encode-message-body) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2865 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2866 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2867 (let ((mail-parse-charset message-default-charset) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2868 (rfc2047-header-encoding-alist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2869 (cons '("Newsgroups" . default) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2870 rfc2047-header-encoding-alist))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2871 (mail-encode-encoded-word-buffer))) |
17493 | 2872 (goto-char (point-min)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2873 (when (re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2874 (concat "^" (regexp-quote mail-header-separator) "$") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2875 nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2876 (replace-match "" t t )) |
17493 | 2877 ;; Process FCC operations. |
2878 (while list | |
2879 (setq file (pop list)) | |
2880 (if (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" file) | |
2881 ;; Pipe the article to the program in question. | |
2882 (call-process-region (point-min) (point-max) shell-file-name | |
2883 nil nil nil shell-command-switch | |
2884 (match-string 1 file)) | |
2885 ;; Save the article. | |
2886 (setq file (expand-file-name file)) | |
2887 (unless (file-exists-p (file-name-directory file)) | |
2888 (make-directory (file-name-directory file) t)) | |
2889 (if (and message-fcc-handler-function | |
2890 (not (eq message-fcc-handler-function 'rmail-output))) | |
2891 (funcall message-fcc-handler-function file) | |
2892 (if (and (file-readable-p file) (mail-file-babyl-p file)) | |
2893 (rmail-output file 1 nil t) | |
2894 (let ((mail-use-rfc822 t)) | |
2895 (rmail-output file 1 t t)))))) | |
2896 (kill-buffer (current-buffer))))) | |
2897 | |
2898 (defun message-output (filename) | |
2899 "Append this article to Unix/babyl mail file.." | |
2900 (if (and (file-readable-p filename) | |
2901 (mail-file-babyl-p filename)) | |
2902 (gnus-output-to-rmail filename t) | |
2903 (gnus-output-to-mail filename t))) | |
2904 | |
2905 (defun message-cleanup-headers () | |
2906 "Do various automatic cleanups of the headers." | |
2907 ;; Remove empty lines in the header. | |
2908 (save-restriction | |
2909 (message-narrow-to-headers) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2910 ;; Remove blank lines. |
17493 | 2911 (while (re-search-forward "^[ \t]*\n" nil t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2912 (replace-match "" t t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2913 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2914 ;; Correct Newsgroups and Followup-To headers: Change sequence of |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2915 ;; spaces to comma and eliminate spaces around commas. Eliminate |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2916 ;; embedded line breaks. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2917 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2918 (while (re-search-forward "^\\(Newsgroups\\|Followup-To\\): +" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2919 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2920 (narrow-to-region |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2921 (point) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2922 (if (re-search-forward "^[^ \t]" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2923 (match-beginning 0) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2924 (forward-line 1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2925 (point))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2926 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2927 (while (re-search-forward "\n[ \t]+" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2928 (replace-match " " t t)) ;No line breaks (too confusing) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2929 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2930 (while (re-search-forward "[ \t\n]*,[ \t\n]*\\|[ \t]+" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2931 (replace-match "," t t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2932 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2933 ;; Remove trailing commas. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2934 (when (re-search-forward ",+$" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2935 (replace-match "" t t)))))) |
17493 | 2936 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2937 (defun message-make-date (&optional now) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2938 "Make a valid data header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2939 If NOW, use that time instead." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2940 (let* ((now (or now (current-time))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2941 (zone (nth 8 (decode-time now))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2942 (sign "+")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2943 (when (< zone 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2944 (setq sign "-") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2945 (setq zone (- zone))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2946 (concat |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2947 (format-time-string "%d" now) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2948 ;; The month name of the %b spec is locale-specific. Pfff. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2949 (format " %s " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2950 (capitalize (car (rassoc (nth 4 (decode-time now)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2951 parse-time-months)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2952 (format-time-string "%Y %H:%M:%S " now) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2953 ;; We do all of this because XEmacs doesn't have the %z spec. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2954 (format "%s%02d%02d" sign (/ zone 3600) (/ (% zone 3600) 60))))) |
17493 | 2955 |
2956 (defun message-make-message-id () | |
2957 "Make a unique Message-ID." | |
2958 (concat "<" (message-unique-id) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2959 (let ((psubject (save-excursion (message-fetch-field "subject"))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2960 (psupersedes |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2961 (save-excursion (message-fetch-field "supersedes")))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2962 (if (or |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2963 (and message-reply-headers |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2964 (mail-header-references message-reply-headers) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2965 (mail-header-subject message-reply-headers) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2966 psubject |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2967 (mail-header-subject message-reply-headers) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2968 (not (string= |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2969 (message-strip-subject-re |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2970 (mail-header-subject message-reply-headers)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2971 (message-strip-subject-re psubject)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2972 (and psupersedes |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2973 (string-match "_-_@" psupersedes))) |
17493 | 2974 "_-_" "")) |
2975 "@" (message-make-fqdn) ">")) | |
2976 | |
2977 (defvar message-unique-id-char nil) | |
2978 | |
2979 ;; If you ever change this function, make sure the new version | |
2980 ;; cannot generate IDs that the old version could. | |
2981 ;; You might for example insert a "." somewhere (not next to another dot | |
2982 ;; or string boundary), or modify the "fsf" string. | |
2983 (defun message-unique-id () | |
2984 ;; Don't use microseconds from (current-time), they may be unsupported. | |
2985 ;; Instead we use this randomly inited counter. | |
2986 (setq message-unique-id-char | |
2987 (% (1+ (or message-unique-id-char (logand (random t) (1- (lsh 1 20))))) | |
2988 ;; (current-time) returns 16-bit ints, | |
2989 ;; and 2^16*25 just fits into 4 digits i base 36. | |
2990 (* 25 25))) | |
2991 (let ((tm (current-time))) | |
2992 (concat | |
2993 (if (memq system-type '(ms-dos emx vax-vms)) | |
2994 (let ((user (downcase (user-login-name)))) | |
2995 (while (string-match "[^a-z0-9_]" user) | |
2996 (aset user (match-beginning 0) ?_)) | |
2997 user) | |
2998 (message-number-base36 (user-uid) -1)) | |
2999 (message-number-base36 (+ (car tm) | |
3000 (lsh (% message-unique-id-char 25) 16)) 4) | |
3001 (message-number-base36 (+ (nth 1 tm) | |
3002 (lsh (/ message-unique-id-char 25) 16)) 4) | |
3003 ;; Append the newsreader name, because while the generated | |
3004 ;; ID is unique to this newsreader, other newsreaders might | |
3005 ;; otherwise generate the same ID via another algorithm. | |
3006 ".fsf"))) | |
3007 | |
3008 (defun message-number-base36 (num len) | |
3009 (if (if (< len 0) | |
3010 (<= num 0) | |
3011 (= len 0)) | |
3012 "" | |
3013 (concat (message-number-base36 (/ num 36) (1- len)) | |
3014 (char-to-string (aref "zyxwvutsrqponmlkjihgfedcba9876543210" | |
3015 (% num 36)))))) | |
3016 | |
3017 (defun message-make-organization () | |
3018 "Make an Organization header." | |
3019 (let* ((organization | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3020 (when message-user-organization |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3021 (if (message-functionp message-user-organization) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3022 (funcall message-user-organization) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3023 message-user-organization)))) |
17493 | 3024 (save-excursion |
3025 (message-set-work-buffer) | |
3026 (cond ((stringp organization) | |
3027 (insert organization)) | |
3028 ((and (eq t organization) | |
3029 message-user-organization-file | |
3030 (file-exists-p message-user-organization-file)) | |
3031 (insert-file-contents message-user-organization-file))) | |
3032 (goto-char (point-min)) | |
3033 (while (re-search-forward "[\t\n]+" nil t) | |
3034 (replace-match "" t t)) | |
3035 (unless (zerop (buffer-size)) | |
3036 (buffer-string))))) | |
3037 | |
3038 (defun message-make-lines () | |
3039 "Count the number of lines and return numeric string." | |
3040 (save-excursion | |
3041 (save-restriction | |
3042 (widen) | |
3043 (goto-char (point-min)) | |
3044 (re-search-forward | |
3045 (concat "^" (regexp-quote mail-header-separator) "$")) | |
3046 (forward-line 1) | |
3047 (int-to-string (count-lines (point) (point-max)))))) | |
3048 | |
3049 (defun message-make-in-reply-to () | |
3050 "Return the In-Reply-To header for this message." | |
3051 (when message-reply-headers | |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3052 (mail-header-message-id message-reply-headers))) |
17493 | 3053 |
3054 (defun message-make-distribution () | |
3055 "Make a Distribution header." | |
3056 (let ((orig-distribution (message-fetch-reply-field "distribution"))) | |
3057 (cond ((message-functionp message-distribution-function) | |
3058 (funcall message-distribution-function)) | |
3059 (t orig-distribution)))) | |
3060 | |
3061 (defun message-make-expires () | |
3062 "Return an Expires header based on `message-expires'." | |
3063 (let ((current (current-time)) | |
3064 (future (* 1.0 message-expires 60 60 24))) | |
3065 ;; Add the future to current. | |
3066 (setcar current (+ (car current) (round (/ future (expt 2 16))))) | |
3067 (setcar (cdr current) (+ (nth 1 current) (% (round future) (expt 2 16)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3068 (message-make-date current))) |
17493 | 3069 |
3070 (defun message-make-path () | |
3071 "Return uucp path." | |
3072 (let ((login-name (user-login-name))) | |
3073 (cond ((null message-user-path) | |
3074 (concat (system-name) "!" login-name)) | |
3075 ((stringp message-user-path) | |
3076 ;; Support GENERICPATH. Suggested by vixie@decwrl.dec.com. | |
3077 (concat message-user-path "!" login-name)) | |
3078 (t login-name)))) | |
3079 | |
3080 (defun message-make-from () | |
3081 "Make a From header." | |
3082 (let* ((style message-from-style) | |
3083 (login (message-make-address)) | |
3084 (fullname | |
3085 (or (and (boundp 'user-full-name) | |
3086 user-full-name) | |
3087 (user-full-name)))) | |
3088 (when (string= fullname "&") | |
3089 (setq fullname (user-login-name))) | |
3090 (save-excursion | |
3091 (message-set-work-buffer) | |
3092 (cond | |
3093 ((or (null style) | |
3094 (equal fullname "")) | |
3095 (insert login)) | |
3096 ((or (eq style 'angles) | |
3097 (and (not (eq style 'parens)) | |
3098 ;; Use angles if no quoting is needed, or if parens would | |
3099 ;; need quoting too. | |
3100 (or (not (string-match "[^- !#-'*+/-9=?A-Z^-~]" fullname)) | |
3101 (let ((tmp (concat fullname nil))) | |
3102 (while (string-match "([^()]*)" tmp) | |
3103 (aset tmp (match-beginning 0) ?-) | |
3104 (aset tmp (1- (match-end 0)) ?-)) | |
3105 (string-match "[\\()]" tmp))))) | |
3106 (insert fullname) | |
3107 (goto-char (point-min)) | |
3108 ;; Look for a character that cannot appear unquoted | |
3109 ;; according to RFC 822. | |
3110 (when (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" nil 1) | |
3111 ;; Quote fullname, escaping specials. | |
3112 (goto-char (point-min)) | |
3113 (insert "\"") | |
3114 (while (re-search-forward "[\"\\]" nil 1) | |
3115 (replace-match "\\\\\\&" t)) | |
3116 (insert "\"")) | |
3117 (insert " <" login ">")) | |
3118 (t ; 'parens or default | |
3119 (insert login " (") | |
3120 (let ((fullname-start (point))) | |
3121 (insert fullname) | |
3122 (goto-char fullname-start) | |
3123 ;; RFC 822 says \ and nonmatching parentheses | |
3124 ;; must be escaped in comments. | |
3125 ;; Escape every instance of ()\ ... | |
3126 (while (re-search-forward "[()\\]" nil 1) | |
3127 (replace-match "\\\\\\&" t)) | |
3128 ;; ... then undo escaping of matching parentheses, | |
3129 ;; including matching nested parentheses. | |
3130 (goto-char fullname-start) | |
3131 (while (re-search-forward | |
3132 "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)" | |
3133 nil 1) | |
3134 (replace-match "\\1(\\3)" t) | |
3135 (goto-char fullname-start))) | |
3136 (insert ")"))) | |
3137 (buffer-string)))) | |
3138 | |
3139 (defun message-make-sender () | |
3140 "Return the \"real\" user address. | |
3141 This function tries to ignore all user modifications, and | |
3142 give as trustworthy answer as possible." | |
3143 (concat (user-login-name) "@" (system-name))) | |
3144 | |
3145 (defun message-make-address () | |
3146 "Make the address of the user." | |
3147 (or (message-user-mail-address) | |
3148 (concat (user-login-name) "@" (message-make-domain)))) | |
3149 | |
3150 (defun message-user-mail-address () | |
3151 "Return the pertinent part of `user-mail-address'." | |
3152 (when user-mail-address | |
3153 (if (string-match " " user-mail-address) | |
3154 (nth 1 (mail-extract-address-components user-mail-address)) | |
3155 user-mail-address))) | |
3156 | |
3157 (defun message-make-fqdn () | |
3158 "Return user's fully qualified domain name." | |
3159 (let ((system-name (system-name)) | |
3160 (user-mail (message-user-mail-address))) | |
3161 (cond | |
3162 ((string-match "[^.]\\.[^.]" system-name) | |
3163 ;; `system-name' returned the right result. | |
3164 system-name) | |
3165 ;; Try `mail-host-address'. | |
3166 ((and (boundp 'mail-host-address) | |
3167 (stringp mail-host-address) | |
3168 (string-match "\\." mail-host-address)) | |
3169 mail-host-address) | |
3170 ;; We try `user-mail-address' as a backup. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3171 ((and user-mail |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3172 (string-match "\\." user-mail) |
17493 | 3173 (string-match "@\\(.*\\)\\'" user-mail)) |
3174 (match-string 1 user-mail)) | |
3175 ;; Default to this bogus thing. | |
3176 (t | |
3177 (concat system-name ".i-did-not-set--mail-host-address--so-shoot-me"))))) | |
3178 | |
3179 (defun message-make-host-name () | |
3180 "Return the name of the host." | |
3181 (let ((fqdn (message-make-fqdn))) | |
3182 (string-match "^[^.]+\\." fqdn) | |
3183 (substring fqdn 0 (1- (match-end 0))))) | |
3184 | |
3185 (defun message-make-domain () | |
3186 "Return the domain name." | |
3187 (or mail-host-address | |
3188 (message-make-fqdn))) | |
3189 | |
3190 (defun message-generate-headers (headers) | |
3191 "Prepare article HEADERS. | |
3192 Headers already prepared in the buffer are not modified." | |
3193 (save-restriction | |
3194 (message-narrow-to-headers) | |
3195 (let* ((Date (message-make-date)) | |
3196 (Message-ID (message-make-message-id)) | |
3197 (Organization (message-make-organization)) | |
3198 (From (message-make-from)) | |
3199 (Path (message-make-path)) | |
3200 (Subject nil) | |
3201 (Newsgroups nil) | |
3202 (In-Reply-To (message-make-in-reply-to)) | |
3203 (To nil) | |
3204 (Distribution (message-make-distribution)) | |
3205 (Lines (message-make-lines)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3206 (User-Agent message-newsreader) |
17493 | 3207 (Expires (message-make-expires)) |
3208 (case-fold-search t) | |
3209 header value elem) | |
3210 ;; First we remove any old generated headers. | |
3211 (let ((headers message-deletable-headers)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3212 (unless (buffer-modified-p) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3213 (setq headers (delq 'Message-ID (copy-sequence headers)))) |
17493 | 3214 (while headers |
3215 (goto-char (point-min)) | |
3216 (and (re-search-forward | |
3217 (concat "^" (symbol-name (car headers)) ": *") nil t) | |
3218 (get-text-property (1+ (match-beginning 0)) 'message-deletable) | |
3219 (message-delete-line)) | |
3220 (pop headers))) | |
3221 ;; Go through all the required headers and see if they are in the | |
3222 ;; articles already. If they are not, or are empty, they are | |
3223 ;; inserted automatically - except for Subject, Newsgroups and | |
3224 ;; Distribution. | |
3225 (while headers | |
3226 (goto-char (point-min)) | |
3227 (setq elem (pop headers)) | |
3228 (if (consp elem) | |
3229 (if (eq (car elem) 'optional) | |
3230 (setq header (cdr elem)) | |
3231 (setq header (car elem))) | |
3232 (setq header elem)) | |
3233 (when (or (not (re-search-forward | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3234 (concat "^" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3235 (regexp-quote |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3236 (downcase |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3237 (if (stringp header) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3238 header |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3239 (symbol-name header)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3240 ":") |
17493 | 3241 nil t)) |
3242 (progn | |
3243 ;; The header was found. We insert a space after the | |
3244 ;; colon, if there is none. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3245 (if (/= (char-after) ? ) (insert " ") (forward-char 1)) |
17493 | 3246 ;; Find out whether the header is empty... |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3247 (looking-at "[ \t]*\n[^ \t]"))) |
17493 | 3248 ;; So we find out what value we should insert. |
3249 (setq value | |
3250 (cond | |
3251 ((and (consp elem) (eq (car elem) 'optional)) | |
3252 ;; This is an optional header. If the cdr of this | |
3253 ;; is something that is nil, then we do not insert | |
3254 ;; this header. | |
3255 (setq header (cdr elem)) | |
3256 (or (and (fboundp (cdr elem)) (funcall (cdr elem))) | |
3257 (and (boundp (cdr elem)) (symbol-value (cdr elem))))) | |
3258 ((consp elem) | |
3259 ;; The element is a cons. Either the cdr is a | |
3260 ;; string to be inserted verbatim, or it is a | |
3261 ;; function, and we insert the value returned from | |
3262 ;; this function. | |
3263 (or (and (stringp (cdr elem)) (cdr elem)) | |
3264 (and (fboundp (cdr elem)) (funcall (cdr elem))))) | |
3265 ((and (boundp header) (symbol-value header)) | |
3266 ;; The element is a symbol. We insert the value | |
3267 ;; of this symbol, if any. | |
3268 (symbol-value header)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3269 ((not (message-check-element header)) |
17493 | 3270 ;; We couldn't generate a value for this header, |
3271 ;; so we just ask the user. | |
3272 (read-from-minibuffer | |
3273 (format "Empty header for %s; enter value: " header))))) | |
3274 ;; Finally insert the header. | |
3275 (when (and value | |
3276 (not (equal value ""))) | |
3277 (save-excursion | |
3278 (if (bolp) | |
3279 (progn | |
3280 ;; This header didn't exist, so we insert it. | |
3281 (goto-char (point-max)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3282 (insert (if (stringp header) header (symbol-name header)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3283 ": " value "\n") |
17493 | 3284 (forward-line -1)) |
3285 ;; The value of this header was empty, so we clear | |
3286 ;; totally and insert the new value. | |
3287 (delete-region (point) (gnus-point-at-eol)) | |
3288 (insert value)) | |
3289 ;; Add the deletable property to the headers that require it. | |
3290 (and (memq header message-deletable-headers) | |
3291 (progn (beginning-of-line) (looking-at "[^:]+: ")) | |
3292 (add-text-properties | |
3293 (point) (match-end 0) | |
3294 '(message-deletable t face italic) (current-buffer))))))) | |
3295 ;; Insert new Sender if the From is strange. | |
3296 (let ((from (message-fetch-field "from")) | |
3297 (sender (message-fetch-field "sender")) | |
3298 (secure-sender (message-make-sender))) | |
3299 (when (and from | |
3300 (not (message-check-element 'sender)) | |
3301 (not (string= | |
3302 (downcase | |
3303 (cadr (mail-extract-address-components from))) | |
3304 (downcase secure-sender))) | |
3305 (or (null sender) | |
3306 (not | |
3307 (string= | |
3308 (downcase | |
3309 (cadr (mail-extract-address-components sender))) | |
3310 (downcase secure-sender))))) | |
3311 (goto-char (point-min)) | |
3312 ;; Rename any old Sender headers to Original-Sender. | |
3313 (when (re-search-forward "^\\(Original-\\)*Sender:" nil t) | |
3314 (beginning-of-line) | |
3315 (insert "Original-") | |
3316 (beginning-of-line)) | |
3317 (when (or (message-news-p) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3318 (string-match "@.+\\.." secure-sender)) |
17493 | 3319 (insert "Sender: " secure-sender "\n"))))))) |
3320 | |
3321 (defun message-insert-courtesy-copy () | |
3322 "Insert a courtesy message in mail copies of combined messages." | |
3323 (let (newsgroups) | |
3324 (save-excursion | |
3325 (save-restriction | |
3326 (message-narrow-to-headers) | |
3327 (when (setq newsgroups (message-fetch-field "newsgroups")) | |
3328 (goto-char (point-max)) | |
3329 (insert "Posted-To: " newsgroups "\n"))) | |
3330 (forward-line 1) | |
3331 (when message-courtesy-message | |
3332 (cond | |
3333 ((string-match "%s" message-courtesy-message) | |
3334 (insert (format message-courtesy-message newsgroups))) | |
3335 (t | |
3336 (insert message-courtesy-message))))))) | |
3337 | |
3338 ;;; | |
3339 ;;; Setting up a message buffer | |
3340 ;;; | |
3341 | |
3342 (defun message-fill-address (header value) | |
3343 (save-restriction | |
3344 (narrow-to-region (point) (point)) | |
3345 (insert (capitalize (symbol-name header)) | |
3346 ": " | |
3347 (if (consp value) (car value) value) | |
3348 "\n") | |
3349 (narrow-to-region (point-min) (1- (point-max))) | |
3350 (let (quoted last) | |
3351 (goto-char (point-min)) | |
3352 (while (not (eobp)) | |
3353 (skip-chars-forward "^,\"" (point-max)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3354 (if (or (eq (char-after) ?,) |
17493 | 3355 (eobp)) |
3356 (when (not quoted) | |
3357 (if (and (> (current-column) 78) | |
3358 last) | |
3359 (progn | |
3360 (save-excursion | |
3361 (goto-char last) | |
3362 (insert "\n\t")) | |
3363 (setq last (1+ (point)))) | |
3364 (setq last (1+ (point))))) | |
3365 (setq quoted (not quoted))) | |
3366 (unless (eobp) | |
3367 (forward-char 1)))) | |
3368 (goto-char (point-max)) | |
3369 (widen) | |
3370 (forward-line 1))) | |
3371 | |
3372 (defun message-fill-header (header value) | |
3373 (let ((begin (point)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3374 (fill-column 78) |
17493 | 3375 (fill-prefix "\t")) |
3376 (insert (capitalize (symbol-name header)) | |
3377 ": " | |
3378 (if (consp value) (car value) value) | |
3379 "\n") | |
3380 (save-restriction | |
3381 (narrow-to-region begin (point)) | |
3382 (fill-region-as-paragraph begin (point)) | |
3383 ;; Tapdance around looong Message-IDs. | |
3384 (forward-line -1) | |
3385 (when (looking-at "[ \t]*$") | |
3386 (message-delete-line)) | |
3387 (goto-char begin) | |
3388 (re-search-forward ":" nil t) | |
3389 (when (looking-at "\n[ \t]+") | |
3390 (replace-match " " t t)) | |
3391 (goto-char (point-max))))) | |
3392 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3393 (defun message-shorten-1 (list cut surplus) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3394 ;; Cut SURPLUS elements out of LIST, beginning with CUTth one. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3395 (setcdr (nthcdr (- cut 2) list) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3396 (nthcdr (+ (- cut 2) surplus 1) list))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3397 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3398 (defun message-shorten-references (header references) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3399 "Trim REFERENCES to be less than 31 Message-ID long, and fold them. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3400 If folding is disallowed, also check that the REFERENCES are less |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3401 than 988 characters long, and if they are not, trim them until they are." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3402 (let ((maxcount 31) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3403 (count 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3404 (cut 6) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3405 refs) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3406 (with-temp-buffer |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3407 (insert references) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3408 (goto-char (point-min)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3409 ;; Cons a list of valid references. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3410 (while (re-search-forward "<[^>]+>" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3411 (push (match-string 0) refs)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3412 (setq refs (nreverse refs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3413 count (length refs))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3414 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3415 ;; If the list has more than MAXCOUNT elements, trim it by |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3416 ;; removing the CUTth element and the required number of |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3417 ;; elements that follow. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3418 (when (> count maxcount) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3419 (let ((surplus (- count maxcount))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3420 (message-shorten-1 refs cut surplus) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3421 (decf count surplus))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3422 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3423 ;; If folding is disallowed, make sure the total length (including |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3424 ;; the spaces between) will be less than MAXSIZE characters. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3425 ;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3426 ;; Only disallow folding for News messages. At this point the headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3427 ;; have not been generated, thus we use message-this-is-news directly. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3428 (when (and message-this-is-news message-cater-to-broken-inn) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3429 (let ((maxsize 988) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3430 (totalsize (+ (apply #'+ (mapcar #'length refs)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3431 (1- count))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3432 (surplus 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3433 (ptr (nthcdr (1- cut) refs))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3434 ;; Decide how many elements to cut off... |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3435 (while (> totalsize maxsize) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3436 (decf totalsize (1+ (length (car ptr)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3437 (incf surplus) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3438 (setq ptr (cdr ptr))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3439 ;; ...and do it. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3440 (when (> surplus 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3441 (message-shorten-1 refs cut surplus)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3442 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3443 ;; Finally, collect the references back into a string and insert |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3444 ;; it into the buffer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3445 (let ((refstring (mapconcat #'identity refs " "))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3446 (if (and message-this-is-news message-cater-to-broken-inn) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3447 (insert (capitalize (symbol-name header)) ": " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3448 refstring "\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3449 (message-fill-header header refstring))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3450 |
17493 | 3451 (defun message-position-point () |
3452 "Move point to where the user probably wants to find it." | |
3453 (message-narrow-to-headers) | |
3454 (cond | |
3455 ((re-search-forward "^[^:]+:[ \t]*$" nil t) | |
3456 (search-backward ":" ) | |
3457 (widen) | |
3458 (forward-char 1) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3459 (if (eq (char-after) ? ) |
17493 | 3460 (forward-char 1) |
3461 (insert " "))) | |
3462 (t | |
3463 (goto-char (point-max)) | |
3464 (widen) | |
3465 (forward-line 1) | |
3466 (unless (looking-at "$") | |
3467 (forward-line 2))) | |
3468 (sit-for 0))) | |
3469 | |
3470 (defun message-buffer-name (type &optional to group) | |
3471 "Return a new (unique) buffer name based on TYPE and TO." | |
3472 (cond | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3473 ;; Generate a new buffer name The Message Way. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3474 ((eq message-generate-new-buffers 'unique) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3475 (generate-new-buffer-name |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3476 (concat "*" type |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3477 (if to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3478 (concat " to " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3479 (or (car (mail-extract-address-components to)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3480 to) "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3481 "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3482 (if (and group (not (string= group ""))) (concat " on " group) "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3483 "*"))) |
17493 | 3484 ;; Check whether `message-generate-new-buffers' is a function, |
3485 ;; and if so, call it. | |
3486 ((message-functionp message-generate-new-buffers) | |
3487 (funcall message-generate-new-buffers type to group)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3488 ((eq message-generate-new-buffers 'unsent) |
17493 | 3489 (generate-new-buffer-name |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3490 (concat "*unsent " type |
17493 | 3491 (if to |
3492 (concat " to " | |
3493 (or (car (mail-extract-address-components to)) | |
3494 to) "") | |
3495 "") | |
3496 (if (and group (not (string= group ""))) (concat " on " group) "") | |
3497 "*"))) | |
3498 ;; Use standard name. | |
3499 (t | |
3500 (format "*%s message*" type)))) | |
3501 | |
3502 (defun message-pop-to-buffer (name) | |
3503 "Pop to buffer NAME, and warn if it already exists and is modified." | |
3504 (let ((buffer (get-buffer name))) | |
3505 (if (and buffer | |
3506 (buffer-name buffer)) | |
3507 (progn | |
3508 (set-buffer (pop-to-buffer buffer)) | |
3509 (when (and (buffer-modified-p) | |
3510 (not (y-or-n-p | |
3511 "Message already being composed; erase? "))) | |
3512 (error "Message being composed"))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3513 (set-buffer (pop-to-buffer name))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3514 (erase-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3515 (message-mode))) |
17493 | 3516 |
3517 (defun message-do-send-housekeeping () | |
3518 "Kill old message buffers." | |
3519 ;; We might have sent this buffer already. Delete it from the | |
3520 ;; list of buffers. | |
3521 (setq message-buffer-list (delq (current-buffer) message-buffer-list)) | |
3522 (while (and message-max-buffers | |
3523 message-buffer-list | |
3524 (>= (length message-buffer-list) message-max-buffers)) | |
3525 ;; Kill the oldest buffer -- unless it has been changed. | |
3526 (let ((buffer (pop message-buffer-list))) | |
3527 (when (and (buffer-name buffer) | |
3528 (not (buffer-modified-p buffer))) | |
3529 (kill-buffer buffer)))) | |
3530 ;; Rename the buffer. | |
3531 (if message-send-rename-function | |
3532 (funcall message-send-rename-function) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3533 (when (string-match "\\`\\*\\(unsent \\)?" (buffer-name)) |
17493 | 3534 (rename-buffer |
3535 (concat "*sent " (substring (buffer-name) (match-end 0))) t))) | |
3536 ;; Push the current buffer onto the list. | |
3537 (when message-max-buffers | |
3538 (setq message-buffer-list | |
3539 (nconc message-buffer-list (list (current-buffer)))))) | |
3540 | |
3541 (defvar mc-modes-alist) | |
3542 (defun message-setup (headers &optional replybuffer actions) | |
3543 (when (and (boundp 'mc-modes-alist) | |
3544 (not (assq 'message-mode mc-modes-alist))) | |
3545 (push '(message-mode (encrypt . mc-encrypt-message) | |
3546 (sign . mc-sign-message)) | |
3547 mc-modes-alist)) | |
3548 (when actions | |
3549 (setq message-send-actions actions)) | |
3550 (setq message-reply-buffer replybuffer) | |
3551 (goto-char (point-min)) | |
3552 ;; Insert all the headers. | |
3553 (mail-header-format | |
3554 (let ((h headers) | |
3555 (alist message-header-format-alist)) | |
3556 (while h | |
3557 (unless (assq (caar h) message-header-format-alist) | |
3558 (push (list (caar h)) alist)) | |
3559 (pop h)) | |
3560 alist) | |
3561 headers) | |
3562 (delete-region (point) (progn (forward-line -1) (point))) | |
3563 (when message-default-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3564 (insert message-default-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3565 (or (bolp) (insert ?\n))) |
17493 | 3566 (put-text-property |
3567 (point) | |
3568 (progn | |
3569 (insert mail-header-separator "\n") | |
3570 (1- (point))) | |
3571 'read-only nil) | |
3572 (forward-line -1) | |
3573 (when (message-news-p) | |
3574 (when message-default-news-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3575 (insert message-default-news-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3576 (or (bolp) (insert ?\n))) |
17493 | 3577 (when message-generate-headers-first |
3578 (message-generate-headers | |
3579 (delq 'Lines | |
3580 (delq 'Subject | |
3581 (copy-sequence message-required-news-headers)))))) | |
3582 (when (message-mail-p) | |
3583 (when message-default-mail-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3584 (insert message-default-mail-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3585 (or (bolp) (insert ?\n))) |
17493 | 3586 (when message-generate-headers-first |
3587 (message-generate-headers | |
3588 (delq 'Lines | |
3589 (delq 'Subject | |
3590 (copy-sequence message-required-mail-headers)))))) | |
3591 (run-hooks 'message-signature-setup-hook) | |
3592 (message-insert-signature) | |
3593 (save-restriction | |
3594 (message-narrow-to-headers) | |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3595 (if message-alternative-emails |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3596 (message-use-alternative-email-as-from)) |
17493 | 3597 (run-hooks 'message-header-setup-hook)) |
3598 (set-buffer-modified-p nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3599 (setq buffer-undo-list nil) |
17493 | 3600 (run-hooks 'message-setup-hook) |
3601 (message-position-point) | |
3602 (undo-boundary)) | |
3603 | |
3604 (defun message-set-auto-save-file-name () | |
3605 "Associate the message buffer with a file in the drafts directory." | |
23379
cfa9bc8ed327
(message-auto-save-directory): Renamed from
Karl Heuer <kwzh@gnu.org>
parents:
23096
diff
changeset
|
3606 (when message-auto-save-directory |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3607 (if (gnus-alive-p) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3608 (setq message-draft-article |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3609 (nndraft-request-associate-buffer "drafts")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3610 (setq buffer-file-name (expand-file-name "*message*" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3611 message-auto-save-directory)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3612 (setq buffer-auto-save-file-name (make-auto-save-file-name))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3613 (clear-visited-file-modtime) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3614 (setq buffer-file-coding-system message-draft-coding-system))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3615 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3616 (defun message-disassociate-draft () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3617 "Disassociate the message buffer from the drafts directory." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3618 (when message-draft-article |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3619 (nndraft-request-expire-articles |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3620 (list message-draft-article) "drafts" nil t))) |
17493 | 3621 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3622 (defun message-insert-headers () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3623 "Generate the headers for the article." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3624 (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3625 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3626 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3627 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3628 (when (message-news-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3629 (message-generate-headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3630 (delq 'Lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3631 (delq 'Subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3632 (copy-sequence message-required-news-headers))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3633 (when (message-mail-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3634 (message-generate-headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3635 (delq 'Lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3636 (delq 'Subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3637 (copy-sequence message-required-mail-headers)))))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3638 |
17493 | 3639 |
3640 | |
3641 ;;; | |
3642 ;;; Commands for interfacing with message | |
3643 ;;; | |
3644 | |
3645 ;;;###autoload | |
3646 (defun message-mail (&optional to subject | |
3647 other-headers continue switch-function | |
3648 yank-action send-actions) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3649 "Start editing a mail message to be sent. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3650 OTHER-HEADERS is an alist of header/value pairs." |
17493 | 3651 (interactive) |
3652 (let ((message-this-is-mail t)) | |
3653 (message-pop-to-buffer (message-buffer-name "mail" to)) | |
3654 (message-setup | |
3655 (nconc | |
3656 `((To . ,(or to "")) (Subject . ,(or subject ""))) | |
3657 (when other-headers other-headers))))) | |
3658 | |
3659 ;;;###autoload | |
3660 (defun message-news (&optional newsgroups subject) | |
3661 "Start editing a news article to be sent." | |
3662 (interactive) | |
3663 (let ((message-this-is-news t)) | |
3664 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups)) | |
3665 (message-setup `((Newsgroups . ,(or newsgroups "")) | |
3666 (Subject . ,(or subject "")))))) | |
3667 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3668 (defun message-get-reply-headers (wide &optional to-address) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3669 (let (follow-to mct never-mct from to cc reply-to ccalist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3670 ;; Find all relevant headers we need. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3671 (setq from (message-fetch-field "from") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3672 to (message-fetch-field "to") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3673 cc (message-fetch-field "cc") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3674 mct (message-fetch-field "mail-copies-to") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3675 reply-to (message-fetch-field "reply-to")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3676 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3677 ;; Handle special values of Mail-Copies-To. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3678 (when mct |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3679 (cond ((or (equal (downcase mct) "never") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3680 (equal (downcase mct) "nobody")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3681 (setq never-mct t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3682 (setq mct nil)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3683 ((or (equal (downcase mct) "always") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3684 (equal (downcase mct) "poster")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3685 (setq mct (or reply-to from))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3686 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3687 (if (or (not wide) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3688 to-address) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3689 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3690 (setq follow-to (list (cons 'To (or to-address reply-to from)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3691 (when (and wide mct) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3692 (push (cons 'Cc mct) follow-to))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3693 (let (ccalist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3694 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3695 (message-set-work-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3696 (unless never-mct |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3697 (insert (or reply-to from ""))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3698 (insert (if to (concat (if (bolp) "" ", ") to "") "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3699 (insert (if mct (concat (if (bolp) "" ", ") mct) "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3700 (insert (if cc (concat (if (bolp) "" ", ") cc) "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3701 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3702 (while (re-search-forward "[ \t]+" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3703 (replace-match " " t t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3704 ;; Remove addresses that match `rmail-dont-reply-to-names'. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3705 (let ((rmail-dont-reply-to-names message-dont-reply-to-names)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3706 (insert (prog1 (rmail-dont-reply-to (buffer-string)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3707 (erase-buffer)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3708 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3709 ;; Perhaps "Mail-Copies-To: never" removed the only address? |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3710 (when (eobp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3711 (insert (or reply-to from ""))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3712 (setq ccalist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3713 (mapcar |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3714 (lambda (addr) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3715 (cons (mail-strip-quoted-names addr) addr)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3716 (message-tokenize-header (buffer-string)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3717 (let ((s ccalist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3718 (while s |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3719 (setq ccalist (delq (assoc (car (pop s)) s) ccalist))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3720 (setq follow-to (list (cons 'To (cdr (pop ccalist))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3721 (when ccalist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3722 (let ((ccs (cons 'Cc (mapconcat |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3723 (lambda (addr) (cdr addr)) ccalist ", ")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3724 (when (string-match "^ +" (cdr ccs)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3725 (setcdr ccs (substring (cdr ccs) (match-end 0)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3726 (push ccs follow-to))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3727 follow-to)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3728 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3729 |
17493 | 3730 ;;;###autoload |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3731 (defun message-reply (&optional to-address wide) |
17493 | 3732 "Start editing a reply to the article in the current buffer." |
3733 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3734 (require 'gnus-sum) ; for gnus-list-identifiers |
17493 | 3735 (let ((cur (current-buffer)) |
3736 from subject date reply-to to cc | |
3737 references message-id follow-to | |
3738 (inhibit-point-motion-hooks t) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3739 (message-this-is-mail t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3740 gnus-warning) |
17493 | 3741 (save-restriction |
3742 (message-narrow-to-head) | |
3743 ;; Allow customizations to have their say. | |
3744 (if (not wide) | |
3745 ;; This is a regular reply. | |
3746 (if (message-functionp message-reply-to-function) | |
3747 (setq follow-to (funcall message-reply-to-function))) | |
3748 ;; This is a followup. | |
3749 (if (message-functionp message-wide-reply-to-function) | |
3750 (save-excursion | |
3751 (setq follow-to | |
3752 (funcall message-wide-reply-to-function))))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3753 (setq message-id (message-fetch-field "message-id" t) |
17493 | 3754 references (message-fetch-field "references") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3755 date (message-fetch-field "date") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3756 from (message-fetch-field "from") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3757 subject (or (message-fetch-field "subject") "none")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3758 (if gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3759 (setq subject (message-strip-list-identifiers subject))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3760 (setq subject (concat "Re: " (message-strip-subject-re subject))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3761 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3762 (when (and (setq gnus-warning (message-fetch-field "gnus-warning")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3763 (string-match "<[^>]+>" gnus-warning)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3764 (setq message-id (match-string 0 gnus-warning))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3765 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3766 (unless follow-to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3767 (setq follow-to (message-get-reply-headers wide to-address)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3768 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3769 (message-pop-to-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3770 (message-buffer-name |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3771 (if wide "wide reply" "reply") from |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3772 (if wide to-address nil))) |
17493 | 3773 |
3774 (setq message-reply-headers | |
3775 (vector 0 subject from date message-id references 0 0 "")) | |
3776 | |
3777 (message-setup | |
3778 `((Subject . ,subject) | |
3779 ,@follow-to | |
3780 ,@(if (or references message-id) | |
3781 `((References . ,(concat (or references "") (and references " ") | |
3782 (or message-id "")))) | |
3783 nil)) | |
3784 cur))) | |
3785 | |
3786 ;;;###autoload | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3787 (defun message-wide-reply (&optional to-address) |
17493 | 3788 "Make a \"wide\" reply to the message in the current buffer." |
3789 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3790 (message-reply to-address t)) |
17493 | 3791 |
3792 ;;;###autoload | |
3793 (defun message-followup (&optional to-newsgroups) | |
3794 "Follow up to the message in the current buffer. | |
3795 If TO-NEWSGROUPS, use that as the new Newsgroups line." | |
3796 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3797 (require 'gnus-sum) ; for gnus-list-identifiers |
17493 | 3798 (let ((cur (current-buffer)) |
3799 from subject date reply-to mct | |
3800 references message-id follow-to | |
3801 (inhibit-point-motion-hooks t) | |
3802 (message-this-is-news t) | |
3803 followup-to distribution newsgroups gnus-warning posted-to) | |
3804 (save-restriction | |
3805 (narrow-to-region | |
3806 (goto-char (point-min)) | |
3807 (if (search-forward "\n\n" nil t) | |
3808 (1- (point)) | |
3809 (point-max))) | |
3810 (when (message-functionp message-followup-to-function) | |
3811 (setq follow-to | |
3812 (funcall message-followup-to-function))) | |
3813 (setq from (message-fetch-field "from") | |
3814 date (message-fetch-field "date") | |
3815 subject (or (message-fetch-field "subject") "none") | |
3816 references (message-fetch-field "references") | |
3817 message-id (message-fetch-field "message-id" t) | |
3818 followup-to (message-fetch-field "followup-to") | |
3819 newsgroups (message-fetch-field "newsgroups") | |
3820 posted-to (message-fetch-field "posted-to") | |
3821 reply-to (message-fetch-field "reply-to") | |
3822 distribution (message-fetch-field "distribution") | |
3823 mct (message-fetch-field "mail-copies-to")) | |
3824 (when (and (setq gnus-warning (message-fetch-field "gnus-warning")) | |
3825 (string-match "<[^>]+>" gnus-warning)) | |
3826 (setq message-id (match-string 0 gnus-warning))) | |
3827 ;; Remove bogus distribution. | |
3828 (when (and (stringp distribution) | |
3829 (let ((case-fold-search t)) | |
3830 (string-match "world" distribution))) | |
3831 (setq distribution nil)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3832 (if gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3833 (setq subject (message-strip-list-identifiers subject))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3834 (setq subject (concat "Re: " (message-strip-subject-re subject))) |
17493 | 3835 (widen)) |
3836 | |
3837 (message-pop-to-buffer (message-buffer-name "followup" from newsgroups)) | |
3838 | |
3839 (message-setup | |
3840 `((Subject . ,subject) | |
3841 ,@(cond | |
3842 (to-newsgroups | |
3843 (list (cons 'Newsgroups to-newsgroups))) | |
3844 (follow-to follow-to) | |
3845 ((and followup-to message-use-followup-to) | |
3846 (list | |
3847 (cond | |
3848 ((equal (downcase followup-to) "poster") | |
3849 (if (or (eq message-use-followup-to 'use) | |
3850 (message-y-or-n-p "Obey Followup-To: poster? " t "\ | |
3851 You should normally obey the Followup-To: header. | |
3852 | |
3853 `Followup-To: poster' sends your response via e-mail instead of news. | |
3854 | |
3855 A typical situation where `Followup-To: poster' is used is when the poster | |
3856 does not read the newsgroup, so he wouldn't see any replies sent to it.")) | |
3857 (progn | |
3858 (setq message-this-is-news nil) | |
3859 (cons 'To (or reply-to from ""))) | |
3860 (cons 'Newsgroups newsgroups))) | |
3861 (t | |
3862 (if (or (equal followup-to newsgroups) | |
3863 (not (eq message-use-followup-to 'ask)) | |
3864 (message-y-or-n-p | |
3865 (concat "Obey Followup-To: " followup-to "? ") t "\ | |
3866 You should normally obey the Followup-To: header. | |
3867 | |
3868 `Followup-To: " followup-to "' | |
3869 directs your response to " (if (string-match "," followup-to) | |
3870 "the specified newsgroups" | |
3871 "that newsgroup only") ". | |
3872 | |
3873 If a message is posted to several newsgroups, Followup-To is often | |
3874 used to direct the following discussion to one newsgroup only, | |
3875 because discussions that are spread over several newsgroup tend to | |
3876 be fragmented and very difficult to follow. | |
3877 | |
3878 Also, some source/announcement newsgroups are not indented for discussion; | |
3879 responses here are directed to other newsgroups.")) | |
3880 (cons 'Newsgroups followup-to) | |
3881 (cons 'Newsgroups newsgroups)))))) | |
3882 (posted-to | |
3883 `((Newsgroups . ,posted-to))) | |
3884 (t | |
3885 `((Newsgroups . ,newsgroups)))) | |
3886 ,@(and distribution (list (cons 'Distribution distribution))) | |
3887 ,@(if (or references message-id) | |
3888 `((References . ,(concat (or references "") (and references " ") | |
3889 (or message-id ""))))) | |
3890 ,@(when (and mct | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3891 (not (or (equal (downcase mct) "never") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3892 (equal (downcase mct) "nobody")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3893 (list (cons 'Cc (if (or (equal (downcase mct) "always") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3894 (equal (downcase mct) "poster")) |
17493 | 3895 (or reply-to from "") |
3896 mct))))) | |
3897 | |
3898 cur) | |
3899 | |
3900 (setq message-reply-headers | |
3901 (vector 0 subject from date message-id references 0 0 "")))) | |
3902 | |
3903 | |
3904 ;;;###autoload | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3905 (defun message-cancel-news (&optional arg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3906 "Cancel an article you posted. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3907 If ARG, allow editing of the cancellation message." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3908 (interactive "P") |
17493 | 3909 (unless (message-news-p) |
3910 (error "This is not a news article; canceling is impossible")) | |
3911 (when (yes-or-no-p "Do you really want to cancel this article? ") | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3912 (let (from newsgroups message-id distribution buf sender) |
17493 | 3913 (save-excursion |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3914 ;; Get header info from original article. |
17493 | 3915 (save-restriction |
3916 (message-narrow-to-head) | |
3917 (setq from (message-fetch-field "from") | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3918 sender (message-fetch-field "sender") |
17493 | 3919 newsgroups (message-fetch-field "newsgroups") |
3920 message-id (message-fetch-field "message-id" t) | |
3921 distribution (message-fetch-field "distribution"))) | |
3922 ;; Make sure that this article was written by the user. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3923 (unless (or (and sender |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3924 (string-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3925 (downcase sender) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3926 (downcase (message-make-sender)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3927 (string-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3928 (downcase (cadr (mail-extract-address-components from))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3929 (downcase (cadr (mail-extract-address-components |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3930 (message-make-from)))))) |
17493 | 3931 (error "This article is not yours")) |
3932 ;; Make control message. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3933 (if arg |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3934 (message-news) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3935 (setq buf (set-buffer (get-buffer-create " *message cancel*")))) |
17493 | 3936 (erase-buffer) |
3937 (insert "Newsgroups: " newsgroups "\n" | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3938 "From: " from "\n" |
17493 | 3939 "Subject: cmsg cancel " message-id "\n" |
3940 "Control: cancel " message-id "\n" | |
3941 (if distribution | |
3942 (concat "Distribution: " distribution "\n") | |
3943 "") | |
3944 mail-header-separator "\n" | |
3945 message-cancel-message) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3946 (run-hooks 'message-cancel-hook) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3947 (unless arg |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3948 (message "Canceling your article...") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3949 (if (let ((message-syntax-checks |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3950 'dont-check-for-anything-just-trust-me)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3951 (funcall message-send-news-function)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3952 (message "Canceling your article...done")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3953 (kill-buffer buf)))))) |
17493 | 3954 |
3955 ;;;###autoload | |
3956 (defun message-supersede () | |
3957 "Start composing a message to supersede the current message. | |
3958 This is done simply by taking the old article and adding a Supersedes | |
3959 header line with the old Message-ID." | |
3960 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3961 (let ((cur (current-buffer)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3962 (sender (message-fetch-field "sender")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3963 (from (message-fetch-field "from"))) |
17493 | 3964 ;; Check whether the user owns the article that is to be superseded. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3965 (unless (or (and sender |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3966 (string-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3967 (downcase sender) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3968 (downcase (message-make-sender)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3969 (string-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3970 (downcase (cadr (mail-extract-address-components from))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3971 (downcase (cadr (mail-extract-address-components |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3972 (message-make-from)))))) |
17493 | 3973 (error "This article is not yours")) |
3974 ;; Get a normal message buffer. | |
3975 (message-pop-to-buffer (message-buffer-name "supersede")) | |
3976 (insert-buffer-substring cur) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3977 (mime-to-mml) |
17493 | 3978 (message-narrow-to-head) |
3979 ;; Remove unwanted headers. | |
3980 (when message-ignored-supersedes-headers | |
3981 (message-remove-header message-ignored-supersedes-headers t)) | |
3982 (goto-char (point-min)) | |
3983 (if (not (re-search-forward "^Message-ID: " nil t)) | |
3984 (error "No Message-ID in this article") | |
3985 (replace-match "Supersedes: " t t)) | |
3986 (goto-char (point-max)) | |
3987 (insert mail-header-separator) | |
3988 (widen) | |
3989 (forward-line 1))) | |
3990 | |
3991 ;;;###autoload | |
3992 (defun message-recover () | |
3993 "Reread contents of current buffer from its last auto-save file." | |
3994 (interactive) | |
3995 (let ((file-name (make-auto-save-file-name))) | |
3996 (cond ((save-window-excursion | |
3997 (if (not (eq system-type 'vax-vms)) | |
3998 (with-output-to-temp-buffer "*Directory*" | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3999 (with-current-buffer standard-output |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4000 (fundamental-mode)) ; for Emacs 20.4+ |
17493 | 4001 (buffer-disable-undo standard-output) |
4002 (let ((default-directory "/")) | |
4003 (call-process | |
4004 "ls" nil standard-output nil "-l" file-name)))) | |
4005 (yes-or-no-p (format "Recover auto save file %s? " file-name))) | |
4006 (let ((buffer-read-only nil)) | |
4007 (erase-buffer) | |
4008 (insert-file-contents file-name nil))) | |
4009 (t (error "message-recover cancelled"))))) | |
4010 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4011 ;;; Washing Subject: |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4012 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4013 (defun message-wash-subject (subject) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4014 "Remove junk like \"Re:\", \"(fwd)\", etc. that was added to the subject by previous forwarders, replyers, etc." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4015 (with-temp-buffer |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4016 (insert-string subject) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4017 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4018 ;; strip Re/Fwd stuff off the beginning |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4019 (while (re-search-forward |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4020 "\\([Rr][Ee]:\\|[Ff][Ww][Dd]\\(\\[[0-9]*\\]\\)?:\\|[Ff][Ww]:\\)" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4021 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4022 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4023 ;; and gnus-style forwards [foo@bar.com] subject |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4024 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4025 (while (re-search-forward "\\[[^ \t]*\\(@\\|\\.\\)[^ \t]*\\]" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4026 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4027 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4028 ;; and off the end |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4029 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4030 (while (re-search-backward "([Ff][Ww][Dd])" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4031 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4032 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4033 ;; and finally, any whitespace that was left-over |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4034 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4035 (while (re-search-forward "^[ \t]+" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4036 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4037 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4038 (while (re-search-backward "[ \t]+$" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4039 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4040 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4041 (buffer-string))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4042 |
17493 | 4043 ;;; Forwarding messages. |
4044 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4045 (defun message-forward-subject-author-subject (subject) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4046 "Generate a subject for a forwarded message. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4047 The form is: [Source] Subject, where if the original message was mail, |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4048 Source is the sender, and if the original message was news, Source is |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4049 the list of newsgroups is was posted to." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4050 (concat "[" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4051 (or (message-fetch-field |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4052 (if (message-news-p) "newsgroups" "from")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4053 "(nowhere)") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4054 "] " subject)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4055 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4056 (defun message-forward-subject-fwd (subject) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4057 "Generate a subject for a forwarded message. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4058 The form is: Fwd: Subject, where Subject is the original subject of |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4059 the message." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4060 (concat "Fwd: " subject)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4061 |
17493 | 4062 (defun message-make-forward-subject () |
4063 "Return a Subject header suitable for the message in the current buffer." | |
4064 (save-excursion | |
4065 (save-restriction | |
4066 (current-buffer) | |
4067 (message-narrow-to-head) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4068 (let ((funcs message-make-forward-subject-function) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4069 (subject (if message-wash-forwarded-subjects |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4070 (message-wash-subject |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4071 (or (message-fetch-field "Subject") "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4072 (or (message-fetch-field "Subject") "")))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4073 ;; Make sure funcs is a list. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4074 (and funcs |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4075 (not (listp funcs)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4076 (setq funcs (list funcs))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4077 ;; Apply funcs in order, passing subject generated by previous |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4078 ;; func to the next one. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4079 (while funcs |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4080 (when (message-functionp (car funcs)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4081 (setq subject (funcall (car funcs) subject))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4082 (setq funcs (cdr funcs))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4083 subject)))) |
17493 | 4084 |
4085 ;;;###autoload | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4086 (defun message-forward (&optional news digest) |
17493 | 4087 "Forward the current message via mail. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4088 Optional NEWS will use news to forward instead of mail. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4089 Optional DIGEST will use digest to forward." |
17493 | 4090 (interactive "P") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4091 (let* ((cur (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4092 (subject (if message-forward-show-mml |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4093 (message-make-forward-subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4094 (mail-decode-encoded-word-string |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4095 (message-make-forward-subject)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4096 art-beg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4097 (if news |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4098 (message-news nil subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4099 (message-mail nil subject)) |
17493 | 4100 ;; Put point where we want it before inserting the forwarded |
4101 ;; message. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4102 (if message-forward-before-signature |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4103 (message-goto-body) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4104 (goto-char (point-max))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4105 (if message-forward-as-mime |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4106 (if digest |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4107 (insert "\n<#multipart type=digest>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4108 (if message-forward-show-mml |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4109 (insert "\n\n<#mml type=message/rfc822 disposition=inline>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4110 (insert "\n\n<#part type=message/rfc822 disposition=inline raw=t>\n"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4111 (insert "\n-------------------- Start of forwarded message --------------------\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4112 (let ((b (point)) e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4113 (if digest |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4114 (if message-forward-as-mime |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4115 (insert-buffer-substring cur) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4116 (mml-insert-buffer cur)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4117 (if message-forward-show-mml |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4118 (insert-buffer-substring cur) |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4119 (mml-insert-buffer cur))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4120 (setq e (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4121 (if message-forward-as-mime |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4122 (if digest |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4123 (insert "<#/multipart>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4124 (if message-forward-show-mml |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4125 (insert "<#/mml>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4126 (insert "<#/part>\n"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4127 (insert "\n-------------------- End of forwarded message --------------------\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4128 (if (and digest message-forward-as-mime) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4129 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4130 (narrow-to-region b e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4131 (goto-char b) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4132 (narrow-to-region (point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4133 (or (search-forward "\n\n" nil t) (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4134 (delete-region (point-min) (point-max))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4135 (when (and (not current-prefix-arg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4136 message-forward-ignored-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4137 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4138 (narrow-to-region b e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4139 (goto-char b) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4140 (narrow-to-region (point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4141 (or (search-forward "\n\n" nil t) (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4142 (message-remove-header message-forward-ignored-headers t))))) |
17493 | 4143 (message-position-point))) |
4144 | |
4145 ;;;###autoload | |
4146 (defun message-resend (address) | |
4147 "Resend the current article to ADDRESS." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4148 (interactive |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4149 (list (message-read-from-minibuffer "Resend message to: "))) |
17493 | 4150 (message "Resending message to %s..." address) |
4151 (save-excursion | |
4152 (let ((cur (current-buffer)) | |
4153 beg) | |
4154 ;; We first set up a normal mail buffer. | |
4155 (set-buffer (get-buffer-create " *message resend*")) | |
4156 (erase-buffer) | |
4157 (message-setup `((To . ,address))) | |
4158 ;; Insert our usual headers. | |
4159 (message-generate-headers '(From Date To)) | |
4160 (message-narrow-to-headers) | |
4161 ;; Rename them all to "Resent-*". | |
4162 (while (re-search-forward "^[A-Za-z]" nil t) | |
4163 (forward-char -1) | |
4164 (insert "Resent-")) | |
4165 (widen) | |
4166 (forward-line) | |
4167 (delete-region (point) (point-max)) | |
4168 (setq beg (point)) | |
4169 ;; Insert the message to be resent. | |
4170 (insert-buffer-substring cur) | |
4171 (goto-char (point-min)) | |
4172 (search-forward "\n\n") | |
4173 (forward-char -1) | |
4174 (save-restriction | |
4175 (narrow-to-region beg (point)) | |
4176 (message-remove-header message-ignored-resent-headers t) | |
4177 (goto-char (point-max))) | |
4178 (insert mail-header-separator) | |
4179 ;; Rename all old ("Also-")Resent headers. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4180 (while (re-search-backward "^\\(Also-\\)*Resent-" beg t) |
17493 | 4181 (beginning-of-line) |
4182 (insert "Also-")) | |
4183 ;; Quote any "From " lines at the beginning. | |
4184 (goto-char beg) | |
4185 (when (looking-at "From ") | |
4186 (replace-match "X-From-Line: ")) | |
4187 ;; Send it. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4188 (let ((message-inhibit-body-encoding t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4189 message-required-mail-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4190 (message-send-mail)) |
17493 | 4191 (kill-buffer (current-buffer))) |
4192 (message "Resending message to %s...done" address))) | |
4193 | |
4194 ;;;###autoload | |
4195 (defun message-bounce () | |
4196 "Re-mail the current message. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4197 This only makes sense if the current message is a bounce message that |
17493 | 4198 contains some mail you have written which has been bounced back to |
4199 you." | |
4200 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4201 (let ((handles (mm-dissect-buffer t)) |
17493 | 4202 boundary) |
4203 (message-pop-to-buffer (message-buffer-name "bounce")) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4204 (if (stringp (car handles)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4205 ;; This is a MIME bounce. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4206 (mm-insert-part (car (last handles))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4207 ;; This is a non-MIME bounce, so we try to remove things |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4208 ;; manually. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4209 (mm-insert-part handles) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4210 (undo-boundary) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4211 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4212 (search-forward "\n\n" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4213 (or (and (re-search-forward message-unsent-separator nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4214 (forward-line 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4215 (re-search-forward "^Return-Path:.*\n" nil t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4216 ;; We remove everything before the bounced mail. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4217 (delete-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4218 (point-min) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4219 (if (re-search-forward "^[^ \n\t]+:" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4220 (match-beginning 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4221 (point)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4222 (mm-enable-multibyte) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4223 (mime-to-mml) |
17493 | 4224 (save-restriction |
4225 (message-narrow-to-head) | |
4226 (message-remove-header message-ignored-bounced-headers t) | |
4227 (goto-char (point-max)) | |
4228 (insert mail-header-separator)) | |
4229 (message-position-point))) | |
4230 | |
4231 ;;; | |
4232 ;;; Interactive entry points for new message buffers. | |
4233 ;;; | |
4234 | |
4235 ;;;###autoload | |
4236 (defun message-mail-other-window (&optional to subject) | |
4237 "Like `message-mail' command, but display mail buffer in another window." | |
4238 (interactive) | |
4239 (let ((pop-up-windows t) | |
4240 (special-display-buffer-names nil) | |
4241 (special-display-regexps nil) | |
4242 (same-window-buffer-names nil) | |
4243 (same-window-regexps nil)) | |
4244 (message-pop-to-buffer (message-buffer-name "mail" to))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4245 (let ((message-this-is-mail t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4246 (message-setup `((To . ,(or to "")) (Subject . ,(or subject "")))))) |
17493 | 4247 |
4248 ;;;###autoload | |
4249 (defun message-mail-other-frame (&optional to subject) | |
4250 "Like `message-mail' command, but display mail buffer in another frame." | |
4251 (interactive) | |
4252 (let ((pop-up-frames t) | |
4253 (special-display-buffer-names nil) | |
4254 (special-display-regexps nil) | |
4255 (same-window-buffer-names nil) | |
4256 (same-window-regexps nil)) | |
4257 (message-pop-to-buffer (message-buffer-name "mail" to))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4258 (let ((message-this-is-mail t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4259 (message-setup `((To . ,(or to "")) (Subject . ,(or subject "")))))) |
17493 | 4260 |
4261 ;;;###autoload | |
4262 (defun message-news-other-window (&optional newsgroups subject) | |
4263 "Start editing a news article to be sent." | |
4264 (interactive) | |
4265 (let ((pop-up-windows t) | |
4266 (special-display-buffer-names nil) | |
4267 (special-display-regexps nil) | |
4268 (same-window-buffer-names nil) | |
4269 (same-window-regexps nil)) | |
4270 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4271 (let ((message-this-is-news t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4272 (message-setup `((Newsgroups . ,(or newsgroups "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4273 (Subject . ,(or subject "")))))) |
17493 | 4274 |
4275 ;;;###autoload | |
4276 (defun message-news-other-frame (&optional newsgroups subject) | |
4277 "Start editing a news article to be sent." | |
4278 (interactive) | |
4279 (let ((pop-up-frames t) | |
4280 (special-display-buffer-names nil) | |
4281 (special-display-regexps nil) | |
4282 (same-window-buffer-names nil) | |
4283 (same-window-regexps nil)) | |
4284 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4285 (let ((message-this-is-news t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4286 (message-setup `((Newsgroups . ,(or newsgroups "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4287 (Subject . ,(or subject "")))))) |
17493 | 4288 |
4289 ;;; underline.el | |
4290 | |
4291 ;; This code should be moved to underline.el (from which it is stolen). | |
4292 | |
4293 ;;;###autoload | |
4294 (defun bold-region (start end) | |
4295 "Bold all nonblank characters in the region. | |
4296 Works by overstriking characters. | |
4297 Called from program, takes two arguments START and END | |
4298 which specify the range to operate on." | |
4299 (interactive "r") | |
4300 (save-excursion | |
4301 (let ((end1 (make-marker))) | |
4302 (move-marker end1 (max start end)) | |
4303 (goto-char (min start end)) | |
4304 (while (< (point) end1) | |
4305 (or (looking-at "[_\^@- ]") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4306 (insert (char-after) "\b")) |
17493 | 4307 (forward-char 1))))) |
4308 | |
4309 ;;;###autoload | |
4310 (defun unbold-region (start end) | |
4311 "Remove all boldness (overstruck characters) in the region. | |
4312 Called from program, takes two arguments START and END | |
4313 which specify the range to operate on." | |
4314 (interactive "r") | |
4315 (save-excursion | |
4316 (let ((end1 (make-marker))) | |
4317 (move-marker end1 (max start end)) | |
4318 (goto-char (min start end)) | |
4319 (while (re-search-forward "\b" end1 t) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4320 (if (eq (char-after) (char-after (- (point) 2))) |
17493 | 4321 (delete-char -2)))))) |
4322 | |
4323 (defalias 'message-exchange-point-and-mark 'exchange-point-and-mark) | |
4324 | |
4325 ;; Support for toolbar | |
32964
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4326 (if (featurep 'xemacs) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4327 (require 'messagexmas) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4328 (when (and (fboundp 'tool-bar-add-item-from-menu) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4329 tool-bar-mode) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4330 (defvar message-tool-bar-map |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4331 (let ((tool-bar-map (copy-keymap tool-bar-map))) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4332 ;; Zap some items which aren't so relevant and take up space. |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4333 (dolist (key '(print-buffer kill-buffer save-buffer write-file |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4334 dired open-file)) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4335 (define-key tool-bar-map (vector key) nil)) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4336 |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4337 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4338 'message-send-and-exit "mail_send" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4339 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4340 'message-kill-buffer "close" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4341 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4342 'message-dont-send "cancel" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4343 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4344 'mml-attach-file "attach" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4345 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4346 'ispell-message "spell" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4347 tool-bar-map)))) |
17493 | 4348 |
4349 ;;; Group name completion. | |
4350 | |
4351 (defvar message-newgroups-header-regexp | |
4352 "^\\(Newsgroups\\|Followup-To\\|Posted-To\\|Gcc\\):" | |
4353 "Regexp that match headers that lists groups.") | |
4354 | |
4355 (defun message-tab () | |
4356 "Expand group names in Newsgroups and Followup-To headers. | |
4357 Do a `tab-to-tab-stop' if not in those headers." | |
4358 (interactive) | |
4359 (if (let ((mail-abbrev-mode-regexp message-newgroups-header-regexp)) | |
4360 (mail-abbrev-in-expansion-header-p)) | |
4361 (message-expand-group) | |
4362 (tab-to-tab-stop))) | |
4363 | |
4364 (defvar gnus-active-hashtb) | |
4365 (defun message-expand-group () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4366 "Expand the group name under point." |
17493 | 4367 (let* ((b (save-excursion |
4368 (save-restriction | |
4369 (narrow-to-region | |
4370 (save-excursion | |
4371 (beginning-of-line) | |
4372 (skip-chars-forward "^:") | |
4373 (1+ (point))) | |
4374 (point)) | |
4375 (skip-chars-backward "^, \t\n") (point)))) | |
4376 (completion-ignore-case t) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4377 (string (buffer-substring b (progn (skip-chars-forward "^,\t\n ") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4378 (point)))) |
17493 | 4379 (hashtb (and (boundp 'gnus-active-hashtb) gnus-active-hashtb)) |
4380 (completions (all-completions string hashtb)) | |
4381 comp) | |
4382 (delete-region b (point)) | |
4383 (cond | |
4384 ((= (length completions) 1) | |
4385 (if (string= (car completions) string) | |
4386 (progn | |
4387 (insert string) | |
4388 (message "Only matching group")) | |
4389 (insert (car completions)))) | |
4390 ((and (setq comp (try-completion string hashtb)) | |
4391 (not (string= comp string))) | |
4392 (insert comp)) | |
4393 (t | |
4394 (insert string) | |
4395 (if (not comp) | |
4396 (message "No matching groups") | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4397 (save-selected-window |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4398 (pop-to-buffer "*Completions*") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4399 (buffer-disable-undo) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4400 (let ((buffer-read-only nil)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4401 (erase-buffer) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4402 (let ((standard-output (current-buffer))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4403 (display-completion-list (sort completions 'string<))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4404 (goto-char (point-min)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4405 (delete-region (point) (progn (forward-line 3) (point)))))))))) |
17493 | 4406 |
4407 ;;; Help stuff. | |
4408 | |
4409 (defun message-talkative-question (ask question show &rest text) | |
19525
59026d8478f7
Require cl only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
19481
diff
changeset
|
4410 "Call FUNCTION with argument QUESTION; optionally display TEXT... args. |
59026d8478f7
Require cl only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
19481
diff
changeset
|
4411 If SHOW is non-nil, the arguments TEXT... are displayed in a temp buffer. |
17493 | 4412 The following arguments may contain lists of values." |
4413 (if (and show | |
4414 (setq text (message-flatten-list text))) | |
4415 (save-window-excursion | |
4416 (save-excursion | |
4417 (with-output-to-temp-buffer " *MESSAGE information message*" | |
4418 (set-buffer " *MESSAGE information message*") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4419 (fundamental-mode) ; for Emacs 20.4+ |
17493 | 4420 (mapcar 'princ text) |
4421 (goto-char (point-min)))) | |
4422 (funcall ask question)) | |
4423 (funcall ask question))) | |
4424 | |
4425 (defun message-flatten-list (list) | |
4426 "Return a new, flat list that contains all elements of LIST. | |
4427 | |
4428 \(message-flatten-list '(1 (2 3 (4 5 (6))) 7)) | |
4429 => (1 2 3 4 5 6 7)" | |
4430 (cond ((consp list) | |
4431 (apply 'append (mapcar 'message-flatten-list list))) | |
4432 (list | |
4433 (list list)))) | |
4434 | |
4435 (defun message-generate-new-buffer-clone-locals (name &optional varstr) | |
4436 "Create and return a buffer with a name based on NAME using generate-new-buffer. | |
4437 Then clone the local variables and values from the old buffer to the | |
4438 new one, cloning only the locals having a substring matching the | |
4439 regexp varstr." | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4440 (let ((oldbuf (current-buffer))) |
17493 | 4441 (save-excursion |
4442 (set-buffer (generate-new-buffer name)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4443 (message-clone-locals oldbuf varstr) |
17493 | 4444 (current-buffer)))) |
4445 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4446 (defun message-clone-locals (buffer &optional varstr) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4447 "Clone the local variables from BUFFER to the current buffer." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4448 (let ((locals (save-excursion |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4449 (set-buffer buffer) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4450 (buffer-local-variables))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4451 (regexp "^gnus\\|^nn\\|^message\\|^user-mail-address")) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4452 (mapcar |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4453 (lambda (local) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4454 (when (and (consp local) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4455 (car local) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4456 (string-match regexp (symbol-name (car local))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4457 (or (null varstr) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4458 (string-match varstr (symbol-name (car local))))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4459 (ignore-errors |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4460 (set (make-local-variable (car local)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4461 (cdr local))))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4462 locals))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4463 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4464 ;;; Miscellaneous functions |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4465 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4466 ;; stolen (and renamed) from nnheader.el |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4467 (if (fboundp 'subst-char-in-string) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4468 (defsubst message-replace-chars-in-string (string from to) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4469 (subst-char-in-string from to string)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4470 (defun message-replace-chars-in-string (string from to) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4471 "Replace characters in STRING from FROM to TO." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4472 (let ((string (substring string 0)) ;Copy string. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4473 (len (length string)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4474 (idx 0)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4475 ;; Replace all occurrences of FROM with TO. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4476 (while (< idx len) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4477 (when (= (aref string idx) from) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4478 (aset string idx to)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4479 (setq idx (1+ idx))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4480 string))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4481 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4482 ;;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4483 ;;; MIME functions |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4484 ;;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4485 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4486 (defvar message-inhibit-body-encoding nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4487 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4488 (defun message-encode-message-body () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4489 (unless message-inhibit-body-encoding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4490 (let ((mail-parse-charset (or mail-parse-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4491 message-default-charset)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4492 (case-fold-search t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4493 lines content-type-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4494 (message-goto-body) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4495 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4496 (narrow-to-region (point) (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4497 (let ((new (mml-generate-mime))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4498 (when new |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4499 (delete-region (point-min) (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4500 (insert new) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4501 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4502 (if (eq (aref new 0) ?\n) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4503 (delete-char 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4504 (search-forward "\n\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4505 (setq lines (buffer-substring (point-min) (1- (point)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4506 (delete-region (point-min) (point)))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4507 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4508 (message-narrow-to-headers-or-head) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4509 (message-remove-header "Mime-Version") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4510 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4511 (insert "MIME-Version: 1.0\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4512 (when lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4513 (insert lines)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4514 (setq content-type-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4515 (re-search-backward "^Content-Type:" nil t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4516 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4517 (message-narrow-to-headers-or-head) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4518 (message-remove-first-header "Content-Type") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4519 (message-remove-first-header "Content-Transfer-Encoding")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4520 ;; We always make sure that the message has a Content-Type header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4521 ;; This is because some broken MTAs and MUAs get awfully confused |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4522 ;; when confronted with a message with a MIME-Version header and |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4523 ;; without a Content-Type header. For instance, Solaris' |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4524 ;; /usr/bin/mail. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4525 (unless content-type-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4526 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4527 (re-search-forward "^MIME-Version:") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4528 (forward-line 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4529 (insert "Content-Type: text/plain; charset=us-ascii\n"))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4530 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4531 (defun message-read-from-minibuffer (prompt) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4532 "Read from the minibuffer while providing abbrev expansion." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4533 (if (fboundp 'mail-abbrevs-setup) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4534 (let ((mail-abbrev-mode-regexp "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4535 (minibuffer-setup-hook 'mail-abbrevs-setup)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4536 (read-from-minibuffer prompt)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4537 (let ((minibuffer-setup-hook 'mail-abbrev-minibuffer-setup-hook)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4538 (read-string prompt)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4539 |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4540 (defun message-use-alternative-email-as-from () |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4541 (require 'mail-utils) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4542 (let* ((fields '("To" "Cc")) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4543 (emails |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4544 (split-string |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4545 (mail-strip-quoted-names |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4546 (mapconcat 'message-fetch-reply-field fields ",")) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4547 "[ \f\t\n\r\v,]+")) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4548 email) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4549 (while emails |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4550 (if (string-match message-alternative-emails (car emails)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4551 (setq email (car emails) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4552 emails nil)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4553 (pop emails)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4554 (unless (or (not email) (equal email user-mail-address)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4555 (goto-char (point-max)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4556 (insert "From: " email "\n")))) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4557 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4558 (provide 'message) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4559 |
17493 | 4560 (run-hooks 'message-load-hook) |
4561 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4562 ;; Local Variables: |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4563 ;; coding: iso-8859-1 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4564 ;; End: |
17493 | 4565 |
4566 ;;; message.el ends here |