Mercurial > emacs
annotate lisp/gnus/message.el @ 88242:a64eb026ac9e
*** empty log message ***
author | Henrik Enberg <henrik.enberg@telia.com> |
---|---|
date | Fri, 20 Jan 2006 18:50:02 +0000 |
parents | d7ddb3e565de |
children |
rev | line source |
---|---|
88155 | 1 ;;; message.el --- composing mail and news messages |
2 | |
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, | |
4 ;; 2005 Free Software Foundation, Inc. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6 ;; Author: Lars Magne Ingebrigtsen <larsi@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 | |
88155 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
17493 | 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) |
88155 | 36 (defvar gnus-message-group-art) |
37 (defvar gnus-list-identifiers)) ; gnus-sum is required where necessary | |
38 (require 'canlock) | |
17493 | 39 (require 'mailheader) |
40 (require 'nnheader) | |
88155 | 41 ;; This is apparently necessary even though things are autoloaded. |
42 ;; Because we dynamically bind mail-abbrev-mode-regexp, we'd better | |
43 ;; require mailabbrev here. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
44 (if (featurep 'xemacs) |
88155 | 45 (require 'mail-abbrevs) |
46 (require 'mailabbrev)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
47 (require 'mail-parse) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
48 (require 'mml) |
88155 | 49 (require 'rfc822) |
50 (eval-and-compile | |
51 (autoload 'gnus-find-method-for-group "gnus") | |
52 (autoload 'nnvirtual-find-group-art "nnvirtual") | |
53 (autoload 'gnus-group-decoded-name "gnus-group")) | |
17493 | 54 |
55 (defgroup message '((user-mail-address custom-variable) | |
56 (user-full-name custom-variable)) | |
57 "Mail and news message composing." | |
58 :link '(custom-manual "(message)Top") | |
59 :group 'mail | |
60 :group 'news) | |
61 | |
62 (put 'user-mail-address 'custom-type 'string) | |
63 (put 'user-full-name 'custom-type 'string) | |
64 | |
65 (defgroup message-various nil | |
88155 | 66 "Various Message Variables." |
17493 | 67 :link '(custom-manual "(message)Various Message Variables") |
68 :group 'message) | |
69 | |
70 (defgroup message-buffers nil | |
88155 | 71 "Message Buffers." |
17493 | 72 :link '(custom-manual "(message)Message Buffers") |
73 :group 'message) | |
74 | |
75 (defgroup message-sending nil | |
88155 | 76 "Message Sending." |
17493 | 77 :link '(custom-manual "(message)Sending Variables") |
78 :group 'message) | |
79 | |
80 (defgroup message-interface nil | |
88155 | 81 "Message Interface." |
17493 | 82 :link '(custom-manual "(message)Interface") |
83 :group 'message) | |
84 | |
85 (defgroup message-forwarding nil | |
88155 | 86 "Message Forwarding." |
17493 | 87 :link '(custom-manual "(message)Forwarding") |
88 :group 'message-interface) | |
89 | |
90 (defgroup message-insertion nil | |
88155 | 91 "Message Insertion." |
17493 | 92 :link '(custom-manual "(message)Insertion") |
93 :group 'message) | |
94 | |
95 (defgroup message-headers nil | |
88155 | 96 "Message Headers." |
17493 | 97 :link '(custom-manual "(message)Message Headers") |
98 :group 'message) | |
99 | |
100 (defgroup message-news nil | |
88155 | 101 "Composing News Messages." |
17493 | 102 :group 'message) |
103 | |
104 (defgroup message-mail nil | |
88155 | 105 "Composing Mail Messages." |
17493 | 106 :group 'message) |
107 | |
108 (defgroup message-faces nil | |
109 "Faces used for message composing." | |
110 :group 'message | |
111 :group 'faces) | |
112 | |
113 (defcustom message-directory "~/Mail/" | |
114 "*Directory from which all other mail file variables are derived." | |
115 :group 'message-various | |
116 :type 'directory) | |
117 | |
118 (defcustom message-max-buffers 10 | |
119 "*How many buffers to keep before starting to kill them off." | |
120 :group 'message-buffers | |
121 :type 'integer) | |
122 | |
123 (defcustom message-send-rename-function nil | |
124 "Function called to rename the buffer after sending it." | |
125 :group 'message-buffers | |
35147 | 126 :type '(choice function (const nil))) |
17493 | 127 |
128 (defcustom message-fcc-handler-function 'message-output | |
129 "*A function called to save outgoing articles. | |
130 This function will be called with the name of the file to store the | |
131 article in. The default function is `message-output' which saves in Unix | |
132 mailbox format." | |
133 :type '(radio (function-item message-output) | |
134 (function :tag "Other")) | |
135 :group 'message-sending) | |
136 | |
88155 | 137 (defcustom message-fcc-externalize-attachments nil |
138 "If non-nil, attachments are included as external parts in Fcc copies." | |
139 :version "22.1" | |
140 :type 'boolean | |
141 :group 'message-sending) | |
142 | |
17493 | 143 (defcustom message-courtesy-message |
144 "The following message is a courtesy copy of an article\nthat has been posted to %s as well.\n\n" | |
145 "*This is inserted at the start of a mailed copy of a posted message. | |
146 If the string contains the format spec \"%s\", the Newsgroups | |
147 the article has been posted to will be inserted there. | |
148 If this variable is nil, no such courtesy message will be added." | |
149 :group 'message-sending | |
88155 | 150 :type '(radio string (const nil))) |
151 | |
152 (defcustom message-ignored-bounced-headers | |
153 "^\\(Received\\|Return-Path\\|Delivered-To\\):" | |
17493 | 154 "*Regexp that matches headers to be removed in resent bounced mail." |
155 :group 'message-interface | |
156 :type 'regexp) | |
157 | |
158 ;;;###autoload | |
159 (defcustom message-from-style 'default | |
160 "*Specifies how \"From\" headers look. | |
161 | |
35147 | 162 If nil, they contain just the return address like: |
17493 | 163 king@grassland.com |
164 If `parens', they look like: | |
165 king@grassland.com (Elvis Parsley) | |
166 If `angles', they look like: | |
167 Elvis Parsley <king@grassland.com> | |
168 | |
169 Otherwise, most addresses look like `angles', but they look like | |
170 `parens' if `angles' would need quoting and `parens' would not." | |
171 :type '(choice (const :tag "simple" nil) | |
172 (const parens) | |
173 (const angles) | |
174 (const default)) | |
175 :group 'message-headers) | |
176 | |
88155 | 177 (defcustom message-insert-canlock t |
178 "Whether to insert a Cancel-Lock header in news postings." | |
179 :version "22.1" | |
180 :group 'message-headers | |
181 :type 'boolean) | |
182 | |
183 (defcustom message-syntax-checks | |
184 (if message-insert-canlock '((sender . disabled)) nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
185 ;; 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
|
186 "*Controls what syntax checks should not be performed on outgoing posts. |
17493 | 187 To disable checking of long signatures, for instance, add |
188 `(signature . disabled)' to this list. | |
189 | |
190 Don't touch this variable unless you really know what you're doing. | |
191 | |
35147 | 192 Checks include `subject-cmsg', `multiple-headers', `sendsys', |
193 `message-id', `from', `long-lines', `control-chars', `size', | |
194 `new-text', `quoting-style', `redirected-followup', `signature', | |
195 `approved', `sender', `empty', `empty-headers', `message-id', `from', | |
196 `subject', `shorten-followup-to', `existing-newsgroups', | |
88155 | 197 `buffer-file-name', `unchanged', `newsgroups', `reply-to', |
198 `continuation-headers', `long-header-lines', `invisible-text' and | |
199 `illegible-text'." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
200 :group 'message-news |
35147 | 201 :type '(repeat sexp)) ; Fixme: improve this |
17493 | 202 |
88155 | 203 (defcustom message-required-headers '((optional . References) |
204 From) | |
205 "*Headers to be generated or prompted for when sending a message. | |
206 Also see `message-required-news-headers' and | |
207 `message-required-mail-headers'." | |
208 :version "22.1" | |
209 :group 'message-news | |
210 :group 'message-headers | |
211 :link '(custom-manual "(message)Message Headers") | |
212 :type '(repeat sexp)) | |
213 | |
214 (defcustom message-draft-headers '(References From) | |
215 "*Headers to be generated when saving a draft message." | |
216 :version "22.1" | |
217 :group 'message-news | |
218 :group 'message-headers | |
219 :link '(custom-manual "(message)Message Headers") | |
220 :type '(repeat sexp)) | |
221 | |
17493 | 222 (defcustom message-required-news-headers |
223 '(From Newsgroups Subject Date Message-ID | |
88155 | 224 (optional . Organization) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
225 (optional . User-Agent)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
226 "*Headers to be generated or prompted for when posting an article. |
17493 | 227 RFC977 and RFC1036 require From, Date, Newsgroups, Subject, |
228 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
|
229 User-Agent are optional. If don't you want message to insert some |
17493 | 230 header, remove it from this list." |
231 :group 'message-news | |
232 :group 'message-headers | |
88155 | 233 :link '(custom-manual "(message)Message Headers") |
17493 | 234 :type '(repeat sexp)) |
235 | |
236 (defcustom message-required-mail-headers | |
88155 | 237 '(From Subject Date (optional . In-Reply-To) Message-ID |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
238 (optional . User-Agent)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
239 "*Headers to be generated or prompted for when mailing a message. |
88155 | 240 It is recommended that From, Date, To, Subject and Message-ID be |
241 included. Organization and User-Agent are optional." | |
17493 | 242 :group 'message-mail |
243 :group 'message-headers | |
88155 | 244 :link '(custom-manual "(message)Message Headers") |
17493 | 245 :type '(repeat sexp)) |
246 | |
247 (defcustom message-deletable-headers '(Message-ID Date Lines) | |
248 "Headers to be deleted if they already exist and were generated by message previously." | |
249 :group 'message-headers | |
88155 | 250 :link '(custom-manual "(message)Message Headers") |
17493 | 251 :type 'sexp) |
252 | |
253 (defcustom message-ignored-news-headers | |
88155 | 254 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:" |
17493 | 255 "*Regexp of headers to be removed unconditionally before posting." |
256 :group 'message-news | |
257 :group 'message-headers | |
88155 | 258 :link '(custom-manual "(message)Message Headers") |
259 :type '(repeat :value-to-internal (lambda (widget value) | |
260 (custom-split-regexp-maybe value)) | |
261 :match (lambda (widget value) | |
262 (or (stringp value) | |
263 (widget-editable-list-match widget value))) | |
264 regexp)) | |
265 | |
266 (defcustom message-ignored-mail-headers | |
267 "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:\\|^X-Draft-From:\\|^X-Gnus-Agent-Meta-Information:" | |
17493 | 268 "*Regexp of headers to be removed unconditionally before mailing." |
269 :group 'message-mail | |
270 :group 'message-headers | |
88155 | 271 :link '(custom-manual "(message)Mail Headers") |
17493 | 272 :type 'regexp) |
273 | |
88155 | 274 (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:\\|^Cancel-Lock:\\|^Cancel-Key:\\|^X-Hashcash:\\|^X-Payment:" |
17493 | 275 "*Header lines matching this regexp will be deleted before posting. |
276 It's best to delete old Path and Date headers before posting to avoid | |
277 any confusion." | |
278 :group 'message-interface | |
88155 | 279 :link '(custom-manual "(message)Superseding") |
280 :type '(repeat :value-to-internal (lambda (widget value) | |
281 (custom-split-regexp-maybe value)) | |
282 :match (lambda (widget value) | |
283 (or (stringp value) | |
284 (widget-editable-list-match widget value))) | |
285 regexp)) | |
286 | |
287 (defcustom message-subject-re-regexp | |
288 "^[ \t]*\\([Rr][Ee]\\(\\[[0-9]*\\]\\)*:[ \t]*\\)*[ \t]*" | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
289 "*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
|
290 :group 'message-various |
88155 | 291 :link '(custom-manual "(message)Message Headers") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
292 :type 'regexp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
293 |
88155 | 294 ;;; Start of variables adopted from `message-utils.el'. |
295 | |
296 (defcustom message-subject-trailing-was-query 'ask | |
297 "*What to do with trailing \"(was: <old subject>)\" in subject lines. | |
298 If nil, leave the subject unchanged. If it is the symbol `ask', query | |
299 the user what do do. In this case, the subject is matched against | |
300 `message-subject-trailing-was-ask-regexp'. If | |
301 `message-subject-trailing-was-query' is t, always strip the trailing | |
302 old subject. In this case, `message-subject-trailing-was-regexp' is | |
303 used." | |
304 :version "22.1" | |
305 :type '(choice (const :tag "never" nil) | |
306 (const :tag "always strip" t) | |
307 (const ask)) | |
308 :link '(custom-manual "(message)Message Headers") | |
309 :group 'message-various) | |
310 | |
311 (defcustom message-subject-trailing-was-ask-regexp | |
312 "[ \t]*\\([[(]+[Ww][Aa][Ss][ \t]*.*[\])]+\\)" | |
313 "*Regexp matching \"(was: <old subject>)\" in the subject line. | |
314 | |
315 The function `message-strip-subject-trailing-was' uses this regexp if | |
316 `message-subject-trailing-was-query' is set to the symbol `ask'. If | |
317 the variable is t instead of `ask', use | |
318 `message-subject-trailing-was-regexp' instead. | |
319 | |
320 It is okay to create some false positives here, as the user is asked." | |
321 :version "22.1" | |
322 :group 'message-various | |
323 :link '(custom-manual "(message)Message Headers") | |
324 :type 'regexp) | |
325 | |
326 (defcustom message-subject-trailing-was-regexp | |
327 "[ \t]*\\((*[Ww][Aa][Ss]:[ \t]*.*)\\)" | |
328 "*Regexp matching \"(was: <old subject>)\" in the subject line. | |
329 | |
330 If `message-subject-trailing-was-query' is set to t, the subject is | |
331 matched against `message-subject-trailing-was-regexp' in | |
332 `message-strip-subject-trailing-was'. You should use a regexp creating very | |
333 few false positives here." | |
334 :version "22.1" | |
335 :group 'message-various | |
336 :link '(custom-manual "(message)Message Headers") | |
337 :type 'regexp) | |
338 | |
339 ;;; marking inserted text | |
340 | |
341 (defcustom message-mark-insert-begin | |
342 "--8<---------------cut here---------------start------------->8---\n" | |
343 "How to mark the beginning of some inserted text." | |
344 :version "22.1" | |
345 :type 'string | |
346 :link '(custom-manual "(message)Insertion Variables") | |
347 :group 'message-various) | |
348 | |
349 (defcustom message-mark-insert-end | |
350 "--8<---------------cut here---------------end--------------->8---\n" | |
351 "How to mark the end of some inserted text." | |
352 :version "22.1" | |
353 :type 'string | |
354 :link '(custom-manual "(message)Insertion Variables") | |
355 :group 'message-various) | |
356 | |
357 (defcustom message-archive-header "X-No-Archive: Yes\n" | |
358 "Header to insert when you don't want your article to be archived. | |
359 Archives \(such as groups.google.com\) respect this header." | |
360 :version "22.1" | |
361 :type 'string | |
362 :link '(custom-manual "(message)Header Commands") | |
363 :group 'message-various) | |
364 | |
365 (defcustom message-archive-note | |
366 "X-No-Archive: Yes - save http://groups.google.com/" | |
367 "Note to insert why you wouldn't want this posting archived. | |
368 If nil, don't insert any text in the body." | |
369 :version "22.1" | |
370 :type '(radio string (const nil)) | |
371 :link '(custom-manual "(message)Header Commands") | |
372 :group 'message-various) | |
373 | |
374 ;;; Crossposts and Followups | |
375 ;; inspired by JoH-followup-to by Jochem Huhman <joh at gmx.de> | |
376 ;; new suggestions by R. Weikusat <rw at another.de> | |
377 | |
378 (defvar message-cross-post-old-target nil | |
379 "Old target for cross-posts or follow-ups.") | |
380 (make-variable-buffer-local 'message-cross-post-old-target) | |
381 | |
382 (defcustom message-cross-post-default t | |
383 "When non-nil `message-cross-post-followup-to' will perform a crosspost. | |
384 If nil, `message-cross-post-followup-to' will only do a followup. Note that | |
385 you can explicitly override this setting by calling | |
386 `message-cross-post-followup-to' with a prefix." | |
387 :version "22.1" | |
388 :type 'boolean | |
389 :group 'message-various) | |
390 | |
391 (defcustom message-cross-post-note "Crosspost & Followup-To: " | |
392 "Note to insert before signature to notify of cross-post and follow-up." | |
393 :version "22.1" | |
394 :type 'string | |
395 :group 'message-various) | |
396 | |
397 (defcustom message-followup-to-note "Followup-To: " | |
398 "Note to insert before signature to notify of follow-up only." | |
399 :version "22.1" | |
400 :type 'string | |
401 :group 'message-various) | |
402 | |
403 (defcustom message-cross-post-note-function 'message-cross-post-insert-note | |
404 "Function to use to insert note about Crosspost or Followup-To. | |
405 The function will be called with four arguments. The function should not only | |
406 insert a note, but also ensure old notes are deleted. See the documentation | |
407 for `message-cross-post-insert-note'." | |
408 :version "22.1" | |
409 :type 'function | |
410 :group 'message-various) | |
411 | |
412 ;;; End of variables adopted from `message-utils.el'. | |
413 | |
17493 | 414 ;;;###autoload |
415 (defcustom message-signature-separator "^-- *$" | |
416 "Regexp matching the signature separator." | |
417 :type 'regexp | |
88155 | 418 :link '(custom-manual "(message)Various Message Variables") |
17493 | 419 :group 'message-various) |
420 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
421 (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
|
422 "*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
|
423 :type 'string |
88155 | 424 :link '(custom-manual "(message)Various Commands") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
425 :group 'message-various) |
17493 | 426 |
88155 | 427 (defcustom message-interactive t |
17493 | 428 "Non-nil means when sending a message wait for and display errors. |
429 nil means let mailer mail back a message to report errors." | |
430 :group 'message-sending | |
431 :group 'message-mail | |
88155 | 432 :link '(custom-manual "(message)Sending Variables") |
17493 | 433 :type 'boolean) |
434 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
435 (defcustom message-generate-new-buffers 'unique |
35147 | 436 "*Non-nil means create a new message buffer whenever `message-setup' is called. |
17493 | 437 If this is a function, call that function with three parameters: The type, |
438 the to address and the group name. (Any of these may be nil.) The function | |
439 should return the new buffer name." | |
440 :group 'message-buffers | |
88155 | 441 :link '(custom-manual "(message)Message Buffers") |
17493 | 442 :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
|
443 (const :tag "unique" unique) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
444 (const :tag "unsent" unsent) |
17493 | 445 (function fun))) |
446 | |
447 (defcustom message-kill-buffer-on-exit nil | |
448 "*Non-nil means that the message buffer will be killed after sending a message." | |
449 :group 'message-buffers | |
88155 | 450 :link '(custom-manual "(message)Message Buffers") |
17493 | 451 :type 'boolean) |
452 | |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
453 (eval-when-compile |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
454 (defvar gnus-local-organization)) |
17493 | 455 (defcustom message-user-organization |
456 (or (and (boundp 'gnus-local-organization) | |
457 (stringp gnus-local-organization) | |
458 gnus-local-organization) | |
459 (getenv "ORGANIZATION") | |
460 t) | |
461 "*String to be used as an Organization header. | |
462 If t, use `message-user-organization-file'." | |
463 :group 'message-headers | |
464 :type '(choice string | |
465 (const :tag "consult file" t))) | |
466 | |
467 ;;;###autoload | |
468 (defcustom message-user-organization-file "/usr/lib/news/organization" | |
469 "*Local news organization file." | |
470 :type 'file | |
88155 | 471 :link '(custom-manual "(message)News Headers") |
17493 | 472 :group 'message-headers) |
473 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
474 (defcustom message-make-forward-subject-function |
88155 | 475 #'message-forward-subject-name-subject |
35147 | 476 "*List of functions called to generate subject headers for forwarded messages. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
477 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
|
478 successive function. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
479 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
480 The provided functions are: |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
481 |
88155 | 482 * `message-forward-subject-author-subject' Source of article (author or |
483 newsgroup), in brackets followed by the subject | |
484 * `message-forward-subject-name-subject' Source of article (name of author | |
485 or newsgroup), in brackets followed by the subject | |
486 * `message-forward-subject-fwd' Subject of article with 'Fwd:' prepended | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
487 to it." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
488 :group 'message-forwarding |
88155 | 489 :link '(custom-manual "(message)Forwarding") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
490 :type '(radio (function-item message-forward-subject-author-subject) |
35147 | 491 (function-item message-forward-subject-fwd) |
88155 | 492 (function-item message-forward-subject-name-subject) |
35147 | 493 (repeat :tag "List of functions" function))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
494 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
495 (defcustom message-forward-as-mime t |
88155 | 496 "*Non-nil means forward messages as an inline/rfc822 MIME section. |
497 Otherwise, directly inline the old message in the forwarded message." | |
33400
42c1ba3caf9c
(message-forward-as-mime, message-forward-ignored-headers)
Dave Love <fx@gnu.org>
parents:
33375
diff
changeset
|
498 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
499 :group 'message-forwarding |
88155 | 500 :link '(custom-manual "(message)Forwarding") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
501 :type 'boolean) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
502 |
88155 | 503 (defcustom message-forward-show-mml 'best |
504 "*Non-nil means show forwarded messages as MML (decoded from MIME). | |
505 Otherwise, forwarded messages are unchanged. | |
506 Can also be the symbol `best' to indicate that MML should be | |
507 used, except when it is a bad idea to use MML. One example where | |
508 it is a bad idea is when forwarding a signed or encrypted | |
509 message, because converting MIME to MML would invalidate the | |
510 digital signature." | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
511 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
512 :group 'message-forwarding |
88155 | 513 :type '(choice (const :tag "use MML" t) |
514 (const :tag "don't use MML " nil) | |
515 (const :tag "use MML when appropriate" best))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
516 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
517 (defcustom message-forward-before-signature t |
88155 | 518 "*Non-nil means put forwarded message before signature, else after." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
519 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
520 :type 'boolean) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
521 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
522 (defcustom message-wash-forwarded-subjects nil |
88155 | 523 "*Non-nil means try to remove as much cruft as possible from the subject. |
524 Done before generating the new subject of a forward." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
525 :group 'message-forwarding |
88155 | 526 :link '(custom-manual "(message)Forwarding") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
527 :type 'boolean) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
528 |
88155 | 529 (defcustom message-ignored-resent-headers "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From " |
17493 | 530 "*All headers that match this regexp will be deleted when resending a message." |
531 :group 'message-interface | |
88155 | 532 :link '(custom-manual "(message)Resending") |
533 :type '(repeat :value-to-internal (lambda (widget value) | |
534 (custom-split-regexp-maybe value)) | |
535 :match (lambda (widget value) | |
536 (or (stringp value) | |
537 (widget-editable-list-match widget value))) | |
538 regexp)) | |
17493 | 539 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
540 (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
|
541 "*All headers that match this regexp will be deleted when forwarding a message." |
33400
42c1ba3caf9c
(message-forward-as-mime, message-forward-ignored-headers)
Dave Love <fx@gnu.org>
parents:
33375
diff
changeset
|
542 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
543 :group 'message-forwarding |
88155 | 544 :type '(repeat :value-to-internal (lambda (widget value) |
545 (custom-split-regexp-maybe value)) | |
546 :match (lambda (widget value) | |
547 (or (stringp value) | |
548 (widget-editable-list-match widget value))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
549 regexp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
550 |
17493 | 551 (defcustom message-ignored-cited-headers "." |
552 "*Delete these headers from the messages you yank." | |
553 :group 'message-insertion | |
88155 | 554 :link '(custom-manual "(message)Insertion Variables") |
555 :type 'regexp) | |
556 | |
557 (defcustom message-cite-prefix-regexp | |
558 (if (string-match "[[:digit:]]" "1") ;; support POSIX? | |
559 "\\([ \t]*[-_.[:word:]]+>+\\|[ \t]*[]>|}+]\\)+" | |
560 ;; ?-, ?_ or ?. MUST NOT be in syntax entry w. | |
561 (let ((old-table (syntax-table)) | |
562 non-word-constituents) | |
563 (set-syntax-table text-mode-syntax-table) | |
564 (setq non-word-constituents | |
565 (concat | |
566 (if (string-match "\\w" "-") "" "-") | |
567 (if (string-match "\\w" "_") "" "_") | |
568 (if (string-match "\\w" ".") "" "."))) | |
569 (set-syntax-table old-table) | |
570 (if (equal non-word-constituents "") | |
571 "\\([ \t]*\\(\\w\\)+>+\\|[ \t]*[]>|}+]\\)+" | |
572 (concat "\\([ \t]*\\(\\w\\|[" | |
573 non-word-constituents | |
574 "]\\)+>+\\|[ \t]*[]>|}+]\\)+")))) | |
575 "*Regexp matching the longest possible citation prefix on a line." | |
576 :version "22.1" | |
577 :group 'message-insertion | |
578 :link '(custom-manual "(message)Insertion Variables") | |
17493 | 579 :type 'regexp) |
580 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
581 (defcustom message-cancel-message "I am canceling my own article.\n" |
17493 | 582 "Message to be inserted in the cancel message." |
583 :group 'message-interface | |
88155 | 584 :link '(custom-manual "(message)Canceling News") |
17493 | 585 :type 'string) |
586 | |
587 ;; Useful to set in site-init.el | |
588 ;;;###autoload | |
589 (defcustom message-send-mail-function 'message-send-mail-with-sendmail | |
590 "Function to call to send the current buffer as mail. | |
591 The headers should be delimited by a line whose contents match the | |
592 variable `mail-header-separator'. | |
593 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
594 Valid values include `message-send-mail-with-sendmail' (the default), |
35147 | 595 `message-send-mail-with-mh', `message-send-mail-with-qmail', |
88155 | 596 `message-smtpmail-send-it', `smtpmail-send-it' and `feedmail-send-it'. |
35147 | 597 |
598 See also `send-mail-function'." | |
17493 | 599 :type '(radio (function-item message-send-mail-with-sendmail) |
600 (function-item message-send-mail-with-mh) | |
601 (function-item message-send-mail-with-qmail) | |
88155 | 602 (function-item message-smtpmail-send-it) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
603 (function-item smtpmail-send-it) |
35147 | 604 (function-item feedmail-send-it) |
17493 | 605 (function :tag "Other")) |
606 :group 'message-sending | |
88155 | 607 :link '(custom-manual "(message)Mail Variables") |
17493 | 608 :group 'message-mail) |
609 | |
610 (defcustom message-send-news-function 'message-send-news | |
611 "Function to call to send the current buffer as news. | |
612 The headers should be delimited by a line whose contents match the | |
613 variable `mail-header-separator'." | |
614 :group 'message-sending | |
615 :group 'message-news | |
88155 | 616 :link '(custom-manual "(message)News Variables") |
17493 | 617 :type 'function) |
618 | |
619 (defcustom message-reply-to-function nil | |
35147 | 620 "If non-nil, function that should return a list of headers. |
17493 | 621 This function should pick out addresses from the To, Cc, and From headers |
622 and respond with new To and Cc headers." | |
623 :group 'message-interface | |
88155 | 624 :link '(custom-manual "(message)Reply") |
35147 | 625 :type '(choice function (const nil))) |
17493 | 626 |
627 (defcustom message-wide-reply-to-function nil | |
35147 | 628 "If non-nil, function that should return a list of headers. |
17493 | 629 This function should pick out addresses from the To, Cc, and From headers |
630 and respond with new To and Cc headers." | |
631 :group 'message-interface | |
88155 | 632 :link '(custom-manual "(message)Wide Reply") |
35147 | 633 :type '(choice function (const nil))) |
17493 | 634 |
635 (defcustom message-followup-to-function nil | |
35147 | 636 "If non-nil, function that should return a list of headers. |
17493 | 637 This function should pick out addresses from the To, Cc, and From headers |
638 and respond with new To and Cc headers." | |
639 :group 'message-interface | |
88155 | 640 :link '(custom-manual "(message)Followup") |
35147 | 641 :type '(choice function (const nil))) |
17493 | 642 |
643 (defcustom message-use-followup-to 'ask | |
644 "*Specifies what to do with Followup-To header. | |
645 If nil, always ignore the header. If it is t, use its value, but | |
646 query before using the \"poster\" value. If it is the symbol `ask', | |
647 always query the user whether to use the value. If it is the symbol | |
648 `use', always use the value." | |
649 :group 'message-interface | |
88155 | 650 :link '(custom-manual "(message)Followup") |
651 :type '(choice (const :tag "ignore" nil) | |
652 (const :tag "use & query" t) | |
653 (const use) | |
654 (const ask))) | |
655 | |
656 (defcustom message-use-mail-followup-to 'use | |
657 "*Specifies what to do with Mail-Followup-To header. | |
658 If nil, always ignore the header. If it is the symbol `ask', always | |
659 query the user whether to use the value. If it is the symbol `use', | |
660 always use the value." | |
661 :version "22.1" | |
662 :group 'message-interface | |
663 :link '(custom-manual "(message)Mailing Lists") | |
17493 | 664 :type '(choice (const :tag "ignore" nil) |
665 (const use) | |
666 (const ask))) | |
667 | |
88155 | 668 (defcustom message-subscribed-address-functions nil |
669 "*Specifies functions for determining list subscription. | |
670 If nil, do not attempt to determine list subscription with functions. | |
671 If non-nil, this variable contains a list of functions which return | |
672 regular expressions to match lists. These functions can be used in | |
673 conjunction with `message-subscribed-regexps' and | |
674 `message-subscribed-addresses'." | |
675 :version "22.1" | |
676 :group 'message-interface | |
677 :link '(custom-manual "(message)Mailing Lists") | |
678 :type '(repeat sexp)) | |
679 | |
680 (defcustom message-subscribed-address-file nil | |
681 "*A file containing addresses the user is subscribed to. | |
682 If nil, do not look at any files to determine list subscriptions. If | |
683 non-nil, each line of this file should be a mailing list address." | |
684 :version "22.1" | |
685 :group 'message-interface | |
686 :link '(custom-manual "(message)Mailing Lists") | |
687 :type '(radio file (const nil))) | |
688 | |
689 (defcustom message-subscribed-addresses nil | |
690 "*Specifies a list of addresses the user is subscribed to. | |
691 If nil, do not use any predefined list subscriptions. This list of | |
692 addresses can be used in conjunction with | |
693 `message-subscribed-address-functions' and `message-subscribed-regexps'." | |
694 :version "22.1" | |
695 :group 'message-interface | |
696 :link '(custom-manual "(message)Mailing Lists") | |
697 :type '(repeat string)) | |
698 | |
699 (defcustom message-subscribed-regexps nil | |
700 "*Specifies a list of addresses the user is subscribed to. | |
701 If nil, do not use any predefined list subscriptions. This list of | |
702 regular expressions can be used in conjunction with | |
703 `message-subscribed-address-functions' and `message-subscribed-addresses'." | |
704 :version "22.1" | |
705 :group 'message-interface | |
706 :link '(custom-manual "(message)Mailing Lists") | |
707 :type '(repeat regexp)) | |
708 | |
709 (defcustom message-allow-no-recipients 'ask | |
710 "Specifies what to do when there are no recipients other than Gcc/Fcc. | |
711 If it is the symbol `always', the posting is allowed. If it is the | |
712 symbol `never', the posting is not allowed. If it is the symbol | |
713 `ask', you are prompted." | |
714 :version "22.1" | |
715 :group 'message-interface | |
716 :link '(custom-manual "(message)Message Headers") | |
717 :type '(choice (const always) | |
718 (const never) | |
719 (const ask))) | |
720 | |
17493 | 721 (defcustom message-sendmail-f-is-evil nil |
35147 | 722 "*Non-nil means don't add \"-f username\" to the sendmail command line. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
723 Doing so would be even more evil than leaving it out." |
17493 | 724 :group 'message-sending |
88155 | 725 :link '(custom-manual "(message)Mail Variables") |
17493 | 726 :type 'boolean) |
727 | |
88155 | 728 (defcustom message-sendmail-envelope-from nil |
729 "*Envelope-from when sending mail with sendmail. | |
730 If this is nil, use `user-mail-address'. If it is the symbol | |
731 `header', use the From: header of the message." | |
732 :version "22.1" | |
733 :type '(choice (string :tag "From name") | |
734 (const :tag "Use From: header from message" header) | |
735 (const :tag "Use `user-mail-address'" nil)) | |
736 :link '(custom-manual "(message)Mail Variables") | |
737 :group 'message-sending) | |
738 | |
17493 | 739 ;; qmail-related stuff |
740 (defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject" | |
741 "Location of the qmail-inject program." | |
742 :group 'message-sending | |
88155 | 743 :link '(custom-manual "(message)Mail Variables") |
17493 | 744 :type 'file) |
745 | |
746 (defcustom message-qmail-inject-args nil | |
747 "Arguments passed to qmail-inject programs. | |
88155 | 748 This should be a list of strings, one string for each argument. It |
749 may also be a function. | |
17493 | 750 |
751 For e.g., if you wish to set the envelope sender address so that bounces | |
752 go to the right place or to deal with listserv's usage of that address, you | |
753 might set this variable to '(\"-f\" \"you@some.where\")." | |
754 :group 'message-sending | |
88155 | 755 :link '(custom-manual "(message)Mail Variables") |
756 :type '(choice (function) | |
757 (repeat string))) | |
17493 | 758 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
759 (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
|
760 "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
|
761 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
|
762 NOV lines.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
763 |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
764 (eval-when-compile |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
765 (defvar gnus-post-method) |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
766 (defvar gnus-select-method)) |
17493 | 767 (defcustom message-post-method |
768 (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
|
769 (listp gnus-post-method) |
17493 | 770 gnus-post-method) |
771 gnus-post-method) | |
772 ((boundp 'gnus-select-method) | |
773 gnus-select-method) | |
774 (t '(nnspool ""))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
775 "*Method used to post news. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
776 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
|
777 variable isn't used." |
17493 | 778 :group 'message-news |
779 :group 'message-sending | |
780 ;; This should be the `gnus-select-method' widget, but that might | |
781 ;; create a dependence to `gnus.el'. | |
782 :type 'sexp) | |
783 | |
88155 | 784 ;; FIXME: This should be a temporary workaround until someone implements a |
785 ;; proper solution. If a crash happens while replying, the auto-save file | |
786 ;; will *not* have a `References:' header if `message-generate-headers-first' | |
787 ;; is nil. See: http://article.gmane.org/gmane.emacs.gnus.general/51138 | |
788 (defcustom message-generate-headers-first '(references) | |
789 "Which headers should be generated before starting to compose a message. | |
790 If t, generate all required headers. This can also be a list of headers to | |
791 generate. The variables `message-required-news-headers' and | |
792 `message-required-mail-headers' specify which headers to generate. | |
793 | |
794 Note that the variable `message-deletable-headers' specifies headers which | |
795 are to be deleted and then re-generated before sending, so this variable | |
796 will not have a visible effect for those headers." | |
17493 | 797 :group 'message-headers |
88155 | 798 :link '(custom-manual "(message)Message Headers") |
799 :type '(choice (const :tag "None" nil) | |
800 (const :tag "References" '(references)) | |
801 (const :tag "All" t) | |
802 (repeat (sexp :tag "Header")))) | |
17493 | 803 |
804 (defcustom message-setup-hook nil | |
805 "Normal hook, run each time a new outgoing message is initialized. | |
806 The function `message-setup' runs this hook." | |
807 :group 'message-various | |
88155 | 808 :link '(custom-manual "(message)Various Message Variables") |
17493 | 809 :type 'hook) |
810 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
811 (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
|
812 "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
|
813 :group 'message-various |
88155 | 814 :link '(custom-manual "(message)Various Message Variables") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
815 :type 'hook) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
816 |
17493 | 817 (defcustom message-signature-setup-hook nil |
818 "Normal hook, run each time a new outgoing message is initialized. | |
819 It is run after the headers have been inserted and before | |
820 the signature is inserted." | |
821 :group 'message-various | |
88155 | 822 :link '(custom-manual "(message)Various Message Variables") |
17493 | 823 :type 'hook) |
824 | |
825 (defcustom message-mode-hook nil | |
826 "Hook run in message mode buffers." | |
827 :group 'message-various | |
828 :type 'hook) | |
829 | |
830 (defcustom message-header-hook nil | |
831 "Hook run in a message mode buffer narrowed to the headers." | |
832 :group 'message-various | |
833 :type 'hook) | |
834 | |
835 (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
|
836 "Hook called narrowed to the headers when setting up a message buffer." |
17493 | 837 :group 'message-various |
88155 | 838 :link '(custom-manual "(message)Various Message Variables") |
17493 | 839 :type 'hook) |
840 | |
88155 | 841 (defcustom message-minibuffer-local-map |
842 (let ((map (make-sparse-keymap 'message-minibuffer-local-map))) | |
843 (set-keymap-parent map minibuffer-local-map) | |
844 map) | |
845 "Keymap for `message-read-from-minibuffer'." | |
846 :version "22.1" | |
847 :group 'message-various) | |
848 | |
17493 | 849 ;;;###autoload |
850 (defcustom message-citation-line-function 'message-insert-citation-line | |
88155 | 851 "*Function called to insert the \"Whomever writes:\" line. |
852 | |
853 Note that Gnus provides a feature where the reader can click on | |
854 `writes:' to hide the cited text. If you change this line too much, | |
855 people who read your message will have to change their Gnus | |
856 configuration. See the variable `gnus-cite-attribution-suffix'." | |
17493 | 857 :type 'function |
88155 | 858 :link '(custom-manual "(message)Insertion Variables") |
17493 | 859 :group 'message-insertion) |
860 | |
861 ;;;###autoload | |
862 (defcustom message-yank-prefix "> " | |
88155 | 863 "*Prefix inserted on the lines of yanked messages. |
864 Fix `message-cite-prefix-regexp' if it is set to an abnormal value. | |
865 See also `message-yank-cited-prefix'." | |
17493 | 866 :type 'string |
88155 | 867 :link '(custom-manual "(message)Insertion Variables") |
868 :group 'message-insertion) | |
869 | |
870 (defcustom message-yank-cited-prefix ">" | |
871 "*Prefix inserted on cited or empty lines of yanked messages. | |
872 Fix `message-cite-prefix-regexp' if it is set to an abnormal value. | |
873 See also `message-yank-prefix'." | |
874 :version "22.1" | |
875 :type 'string | |
876 :link '(custom-manual "(message)Insertion Variables") | |
17493 | 877 :group 'message-insertion) |
878 | |
879 (defcustom message-indentation-spaces 3 | |
880 "*Number of spaces to insert at the beginning of each cited line. | |
881 Used by `message-yank-original' via `message-yank-cite'." | |
882 :group 'message-insertion | |
88155 | 883 :link '(custom-manual "(message)Insertion Variables") |
17493 | 884 :type 'integer) |
885 | |
886 ;;;###autoload | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
887 (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
|
888 "*Function for citing an original message. |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
889 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
|
890 `message-cite-original-without-signature'. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
891 Note that `message-cite-original' uses `mail-citation-hook' if that is non-nil." |
17493 | 892 :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
|
893 (function-item message-cite-original-without-signature) |
17493 | 894 (function-item sc-cite-original) |
895 (function :tag "Other")) | |
88155 | 896 :link '(custom-manual "(message)Insertion Variables") |
17493 | 897 :group 'message-insertion) |
898 | |
899 ;;;###autoload | |
900 (defcustom message-indent-citation-function 'message-indent-citation | |
901 "*Function for modifying a citation just inserted in the mail buffer. | |
902 This can also be a list of functions. Each function can find the | |
903 citation between (point) and (mark t). And each function should leave | |
904 point and mark around the citation text as modified." | |
905 :type 'function | |
88155 | 906 :link '(custom-manual "(message)Insertion Variables") |
17493 | 907 :group 'message-insertion) |
908 | |
909 ;;;###autoload | |
910 (defcustom message-signature t | |
911 "*String to be inserted at the end of the message buffer. | |
912 If t, the `message-signature-file' file will be inserted instead. | |
913 If a function, the result from the function will be used instead. | |
914 If a form, the result from the form will be used instead." | |
915 :type 'sexp | |
88155 | 916 :link '(custom-manual "(message)Insertion Variables") |
17493 | 917 :group 'message-insertion) |
918 | |
919 ;;;###autoload | |
920 (defcustom message-signature-file "~/.signature" | |
36036
dcbe0206da25
(message-signature-file): Fix doc, :type.
Dave Love <fx@gnu.org>
parents:
35957
diff
changeset
|
921 "*Name of file containing the text inserted at end of message buffer. |
dcbe0206da25
(message-signature-file): Fix doc, :type.
Dave Love <fx@gnu.org>
parents:
35957
diff
changeset
|
922 Ignored if the named file doesn't exist. |
dcbe0206da25
(message-signature-file): Fix doc, :type.
Dave Love <fx@gnu.org>
parents:
35957
diff
changeset
|
923 If nil, don't insert a signature." |
dcbe0206da25
(message-signature-file): Fix doc, :type.
Dave Love <fx@gnu.org>
parents:
35957
diff
changeset
|
924 :type '(choice file (const :tags "None" nil)) |
88155 | 925 :link '(custom-manual "(message)Insertion Variables") |
926 :group 'message-insertion) | |
927 | |
928 ;;;###autoload | |
929 (defcustom message-signature-insert-empty-line t | |
930 "*If non-nil, insert an empty line before the signature separator." | |
931 :version "22.1" | |
932 :type 'boolean | |
933 :link '(custom-manual "(message)Insertion Variables") | |
17493 | 934 :group 'message-insertion) |
935 | |
936 (defcustom message-distribution-function nil | |
937 "*Function called to return a Distribution header." | |
938 :group 'message-news | |
939 :group 'message-headers | |
88155 | 940 :link '(custom-manual "(message)News Headers") |
35147 | 941 :type '(choice function (const nil))) |
17493 | 942 |
943 (defcustom message-expires 14 | |
944 "Number of days before your article expires." | |
945 :group 'message-news | |
946 :group 'message-headers | |
947 :link '(custom-manual "(message)News Headers") | |
948 :type 'integer) | |
949 | |
950 (defcustom message-user-path nil | |
951 "If nil, use the NNTP server name in the Path header. | |
952 If stringp, use this; if non-nil, use no host name (user name only)." | |
953 :group 'message-news | |
954 :group 'message-headers | |
955 :link '(custom-manual "(message)News Headers") | |
956 :type '(choice (const :tag "nntp" nil) | |
957 (string :tag "name") | |
958 (sexp :tag "none" :format "%t" t))) | |
959 | |
960 (defvar message-reply-buffer nil) | |
88155 | 961 (defvar message-reply-headers nil |
962 "The headers of the current replied article. | |
963 It is a vector of the following headers: | |
964 \[number subject from date id references chars lines xref extra].") | |
17493 | 965 (defvar message-newsreader nil) |
966 (defvar message-mailer nil) | |
967 (defvar message-sent-message-via nil) | |
968 (defvar message-checksum nil) | |
969 (defvar message-send-actions nil | |
970 "A list of actions to be performed upon successful sending of a message.") | |
971 (defvar message-exit-actions nil | |
972 "A list of actions to be performed upon exiting after sending a message.") | |
973 (defvar message-kill-actions nil | |
974 "A list of actions to be performed before killing a message buffer.") | |
975 (defvar message-postpone-actions nil | |
976 "A list of actions to be performed after postponing a message.") | |
977 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
978 (define-widget 'message-header-lines 'text |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
979 "All header lines must be LFD terminated." |
33982
ff339ba39162
(message-header-lines): Fontify tag.
Miles Bader <miles@gnu.org>
parents:
33768
diff
changeset
|
980 :format "%{%t%}:%n%v" |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
981 :valid-regexp "^\\'" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
982 :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
|
983 |
17493 | 984 (defcustom message-default-headers "" |
985 "*A string containing header lines to be inserted in outgoing messages. | |
986 It is inserted before you edit the message, so you can edit or delete | |
987 these lines." | |
988 :group 'message-headers | |
88155 | 989 :link '(custom-manual "(message)Message Headers") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
990 :type 'message-header-lines) |
17493 | 991 |
992 (defcustom message-default-mail-headers "" | |
993 "*A string of header lines to be inserted in outgoing mails." | |
994 :group 'message-headers | |
995 :group 'message-mail | |
88155 | 996 :link '(custom-manual "(message)Mail Headers") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
997 :type 'message-header-lines) |
17493 | 998 |
999 (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
|
1000 "*A string of header lines to be inserted in outgoing news articles." |
17493 | 1001 :group 'message-headers |
1002 :group 'message-news | |
88155 | 1003 :link '(custom-manual "(message)News Headers") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1004 :type 'message-header-lines) |
17493 | 1005 |
1006 ;; Note: could use /usr/ucb/mail instead of sendmail; | |
1007 ;; options -t, and -v if not interactive. | |
1008 (defcustom message-mailer-swallows-blank-line | |
1009 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)" | |
1010 system-configuration) | |
1011 (file-readable-p "/etc/sendmail.cf") | |
1012 (let ((buffer (get-buffer-create " *temp*"))) | |
1013 (unwind-protect | |
1014 (save-excursion | |
1015 (set-buffer buffer) | |
1016 (insert-file-contents "/etc/sendmail.cf") | |
1017 (goto-char (point-min)) | |
1018 (let ((case-fold-search nil)) | |
1019 (re-search-forward "^OR\\>" nil t))) | |
1020 (kill-buffer buffer)))) | |
1021 ;; According to RFC822, "The field-name must be composed of printable | |
1022 ;; ASCII characters (i. e., characters that have decimal values between | |
1023 ;; 33 and 126, except colon)", i. e., any chars except ctl chars, | |
1024 ;; space, or colon. | |
1025 '(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
|
1026 "*Set this non-nil if the system's mailer runs the header and body together. |
17493 | 1027 \(This problem exists on Sunos 4 when sendmail is run in remote mode.) |
1028 The value should be an expression to test whether the problem will | |
1029 actually occur." | |
1030 :group 'message-sending | |
88155 | 1031 :link '(custom-manual "(message)Mail Variables") |
17493 | 1032 :type 'sexp) |
1033 | |
19481
4d492290e085
(message-user-agent): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
1034 ;;;###autoload |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1035 (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
|
1036 '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
|
1037 'message-kill-buffer 'message-send-hook) |
17493 | 1038 |
1039 (defvar message-mh-deletable-headers '(Message-ID Date Lines Sender) | |
1040 "If non-nil, delete the deletable headers before feeding to mh.") | |
1041 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1042 (defvar message-send-method-alist |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1043 '((news message-news-p message-send-via-news) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1044 (mail message-mail-p message-send-via-mail)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1045 "Alist of ways to send outgoing messages. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1046 Each element has the form |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1047 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1048 \(TYPE PREDICATE FUNCTION) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1049 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1050 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
|
1051 called without any parameters to determine whether the message is |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1052 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
|
1053 PREDICATE returns non-nil. FUNCTION is called with one parameter -- |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1054 the prefix.") |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1055 |
34058
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
1056 (defcustom message-mail-alias-type 'abbrev |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1057 "*What alias expansion type to use in Message buffers. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1058 The default is `abbrev', which uses mailabbrev. nil switches |
34058
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
1059 mail aliases off." |
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
1060 :group 'message |
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
1061 :link '(custom-manual "(message)Mail Aliases") |
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
1062 :type '(choice (const :tag "Use Mailabbrev" abbrev) |
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
1063 (const :tag "No expansion" nil))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1064 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1065 (defcustom message-auto-save-directory |
34057
98bd49d8cf7d
(message-auto-save-directory): Use
Dave Love <fx@gnu.org>
parents:
33982
diff
changeset
|
1066 (file-name-as-directory (nnheader-concat message-directory "drafts")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1067 "*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
|
1068 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
|
1069 :group 'message-buffers |
88155 | 1070 :link '(custom-manual "(message)Various Message Variables") |
35147 | 1071 :type '(choice directory (const :tag "Don't auto-save" nil))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1072 |
35147 | 1073 (defcustom message-default-charset |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
1074 (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
|
1075 "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
|
1076 If nil, you might be asked to input the charset." |
33400
42c1ba3caf9c
(message-forward-as-mime, message-forward-ignored-headers)
Dave Love <fx@gnu.org>
parents:
33375
diff
changeset
|
1077 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1078 :group 'message |
88155 | 1079 :link '(custom-manual "(message)Various Message Variables") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1080 :type 'symbol) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1081 |
35147 | 1082 (defcustom message-dont-reply-to-names |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1083 (and (boundp 'rmail-dont-reply-to-names) rmail-dont-reply-to-names) |
88155 | 1084 "*A regexp specifying addresses to prune when doing wide replies. |
1085 A value of nil means exclude your own user name only." | |
33400
42c1ba3caf9c
(message-forward-as-mime, message-forward-ignored-headers)
Dave Love <fx@gnu.org>
parents:
33375
diff
changeset
|
1086 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1087 :group 'message |
88155 | 1088 :link '(custom-manual "(message)Wide Reply") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1089 :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
|
1090 regexp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1091 |
88155 | 1092 (defvar message-shoot-gnksa-feet nil |
1093 "*A list of GNKSA feet you are allowed to shoot. | |
1094 Gnus gives you all the opportunity you could possibly want for | |
1095 shooting yourself in the foot. Also, Gnus allows you to shoot the | |
1096 feet of Good Net-Keeping Seal of Approval. The following are foot | |
1097 candidates: | |
1098 `empty-article' Allow you to post an empty article; | |
1099 `quoted-text-only' Allow you to post quoted text only; | |
1100 `multiple-copies' Allow you to post multiple copies; | |
1101 `cancel-messages' Allow you to cancel or supersede messages from | |
1102 your other email addresses.") | |
1103 | |
1104 (defsubst message-gnksa-enable-p (feature) | |
1105 (or (not (listp message-shoot-gnksa-feet)) | |
1106 (memq feature message-shoot-gnksa-feet))) | |
1107 | |
1108 (defcustom message-hidden-headers nil | |
1109 "Regexp of headers to be hidden when composing new messages. | |
1110 This can also be a list of regexps to match headers. Or a list | |
1111 starting with `not' and followed by regexps." | |
1112 :version "22.1" | |
1113 :group 'message | |
1114 :link '(custom-manual "(message)Message Headers") | |
1115 :type '(repeat regexp)) | |
1116 | |
17493 | 1117 ;;; Internal variables. |
1118 ;;; Well, not really internal. | |
1119 | |
1120 (defvar message-mode-syntax-table | |
1121 (let ((table (copy-syntax-table text-mode-syntax-table))) | |
1122 (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
|
1123 (modify-syntax-entry ?> ". " table) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1124 (modify-syntax-entry ?< ". " table) |
17493 | 1125 table) |
1126 "Syntax table used while in Message mode.") | |
1127 | |
88155 | 1128 (defface message-header-to |
17493 | 1129 '((((class color) |
1130 (background dark)) | |
88155 | 1131 (:foreground "green2" :bold t)) |
17493 | 1132 (((class color) |
1133 (background light)) | |
88155 | 1134 (:foreground "MidnightBlue" :bold t)) |
17493 | 1135 (t |
88155 | 1136 (:bold t :italic t))) |
17493 | 1137 "Face used for displaying From headers." |
1138 :group 'message-faces) | |
88155 | 1139 ;; backward-compatibility alias |
1140 (put 'message-header-to-face 'face-alias 'message-header-to) | |
1141 | |
1142 (defface message-header-cc | |
17493 | 1143 '((((class color) |
1144 (background dark)) | |
88155 | 1145 (:foreground "green4" :bold t)) |
17493 | 1146 (((class color) |
1147 (background light)) | |
1148 (:foreground "MidnightBlue")) | |
1149 (t | |
88155 | 1150 (:bold t))) |
17493 | 1151 "Face used for displaying Cc headers." |
1152 :group 'message-faces) | |
88155 | 1153 ;; backward-compatibility alias |
1154 (put 'message-header-cc-face 'face-alias 'message-header-cc) | |
1155 | |
1156 (defface message-header-subject | |
17493 | 1157 '((((class color) |
1158 (background dark)) | |
1159 (:foreground "green3")) | |
1160 (((class color) | |
1161 (background light)) | |
88155 | 1162 (:foreground "navy blue" :bold t)) |
17493 | 1163 (t |
88155 | 1164 (:bold t))) |
17493 | 1165 "Face used for displaying subject headers." |
1166 :group 'message-faces) | |
88155 | 1167 ;; backward-compatibility alias |
1168 (put 'message-header-subject-face 'face-alias 'message-header-subject) | |
1169 | |
1170 (defface message-header-newsgroups | |
17493 | 1171 '((((class color) |
1172 (background dark)) | |
88155 | 1173 (:foreground "yellow" :bold t :italic t)) |
17493 | 1174 (((class color) |
1175 (background light)) | |
88155 | 1176 (:foreground "blue4" :bold t :italic t)) |
17493 | 1177 (t |
88155 | 1178 (:bold t :italic t))) |
17493 | 1179 "Face used for displaying newsgroups headers." |
1180 :group 'message-faces) | |
88155 | 1181 ;; backward-compatibility alias |
1182 (put 'message-header-newsgroups-face 'face-alias 'message-header-newsgroups) | |
1183 | |
1184 (defface message-header-other | |
17493 | 1185 '((((class color) |
1186 (background dark)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1187 (:foreground "#b00000")) |
17493 | 1188 (((class color) |
1189 (background light)) | |
1190 (:foreground "steel blue")) | |
1191 (t | |
88155 | 1192 (:bold t :italic t))) |
17493 | 1193 "Face used for displaying newsgroups headers." |
1194 :group 'message-faces) | |
88155 | 1195 ;; backward-compatibility alias |
1196 (put 'message-header-other-face 'face-alias 'message-header-other) | |
1197 | |
1198 (defface message-header-name | |
17493 | 1199 '((((class color) |
1200 (background dark)) | |
1201 (:foreground "DarkGreen")) | |
1202 (((class color) | |
1203 (background light)) | |
1204 (:foreground "cornflower blue")) | |
1205 (t | |
88155 | 1206 (:bold t))) |
17493 | 1207 "Face used for displaying header names." |
1208 :group 'message-faces) | |
88155 | 1209 ;; backward-compatibility alias |
1210 (put 'message-header-name-face 'face-alias 'message-header-name) | |
1211 | |
1212 (defface message-header-xheader | |
17493 | 1213 '((((class color) |
1214 (background dark)) | |
1215 (:foreground "blue")) | |
1216 (((class color) | |
1217 (background light)) | |
1218 (:foreground "blue")) | |
1219 (t | |
88155 | 1220 (:bold t))) |
17493 | 1221 "Face used for displaying X-Header headers." |
1222 :group 'message-faces) | |
88155 | 1223 ;; backward-compatibility alias |
1224 (put 'message-header-xheader-face 'face-alias 'message-header-xheader) | |
1225 | |
1226 (defface message-separator | |
17493 | 1227 '((((class color) |
1228 (background dark)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1229 (:foreground "blue3")) |
17493 | 1230 (((class color) |
1231 (background light)) | |
1232 (:foreground "brown")) | |
1233 (t | |
88155 | 1234 (:bold t))) |
17493 | 1235 "Face used for displaying the separator." |
1236 :group 'message-faces) | |
88155 | 1237 ;; backward-compatibility alias |
1238 (put 'message-separator-face 'face-alias 'message-separator) | |
1239 | |
1240 (defface message-cited-text | |
17493 | 1241 '((((class color) |
1242 (background dark)) | |
1243 (:foreground "red")) | |
1244 (((class color) | |
1245 (background light)) | |
1246 (:foreground "red")) | |
1247 (t | |
88155 | 1248 (:bold t))) |
17493 | 1249 "Face used for displaying cited text names." |
1250 :group 'message-faces) | |
88155 | 1251 ;; backward-compatibility alias |
1252 (put 'message-cited-text-face 'face-alias 'message-cited-text) | |
1253 | |
1254 (defface message-mml | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1255 '((((class color) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1256 (background dark)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1257 (:foreground "ForestGreen")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1258 (((class color) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1259 (background light)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1260 (:foreground "ForestGreen")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1261 (t |
88155 | 1262 (:bold t))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1263 "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
|
1264 :group 'message-faces) |
88155 | 1265 ;; backward-compatibility alias |
1266 (put 'message-mml-face 'face-alias 'message-mml) | |
1267 | |
1268 (defun message-font-lock-make-header-matcher (regexp) | |
1269 (let ((form | |
1270 `(lambda (limit) | |
1271 (let ((start (point))) | |
1272 (save-restriction | |
1273 (widen) | |
1274 (goto-char (point-min)) | |
1275 (if (re-search-forward | |
1276 (concat "^" (regexp-quote mail-header-separator) "$") | |
1277 nil t) | |
1278 (setq limit (min limit (match-beginning 0)))) | |
1279 (goto-char start)) | |
1280 (and (< start limit) | |
1281 (re-search-forward ,regexp limit t)))))) | |
1282 (if (featurep 'bytecomp) | |
1283 (byte-compile form) | |
1284 form))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1285 |
17493 | 1286 (defvar message-font-lock-keywords |
88155 | 1287 (let ((content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?")) |
1288 `((,(message-font-lock-make-header-matcher | |
1289 (concat "^\\([Tt]o:\\)" content)) | |
1290 (1 'message-header-name) | |
1291 (2 'message-header-to nil t)) | |
1292 (,(message-font-lock-make-header-matcher | |
1293 (concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content)) | |
1294 (1 'message-header-name) | |
1295 (2 'message-header-cc nil t)) | |
1296 (,(message-font-lock-make-header-matcher | |
1297 (concat "^\\([Ss]ubject:\\)" content)) | |
1298 (1 'message-header-name) | |
1299 (2 'message-header-subject nil t)) | |
1300 (,(message-font-lock-make-header-matcher | |
1301 (concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content)) | |
1302 (1 'message-header-name) | |
1303 (2 'message-header-newsgroups nil t)) | |
1304 (,(message-font-lock-make-header-matcher | |
1305 (concat "^\\([A-Z][^: \n\t]+:\\)" content)) | |
1306 (1 'message-header-name) | |
1307 (2 'message-header-other nil t)) | |
1308 (,(message-font-lock-make-header-matcher | |
1309 (concat "^\\(X-[A-Za-z0-9-]+:\\|In-Reply-To:\\)" content)) | |
1310 (1 'message-header-name) | |
1311 (2 'message-header-name)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1312 ,@(if (and mail-header-separator |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1313 (not (equal mail-header-separator ""))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1314 `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$") |
88155 | 1315 1 'message-separator)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1316 nil) |
88155 | 1317 ((lambda (limit) |
1318 (re-search-forward (concat "^\\(" | |
1319 message-cite-prefix-regexp | |
1320 "\\).*") | |
1321 limit t)) | |
1322 (0 'message-cited-text)) | |
1323 ("<#/?\\(multipart\\|part\\|external\\|mml\\|secure\\)[^>]*>" | |
1324 (0 'message-mml)))) | |
17493 | 1325 "Additional expressions to highlight in Message mode.") |
1326 | |
88155 | 1327 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1328 ;; 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
|
1329 ;; `font-lock-defaults' buffer-local variable. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1330 (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
|
1331 |
17493 | 1332 (defvar message-face-alist |
1333 '((bold . bold-region) | |
1334 (underline . underline-region) | |
1335 (default . (lambda (b e) | |
1336 (unbold-region b e) | |
1337 (ununderline-region b e)))) | |
1338 "Alist of mail and news faces for facemenu. | |
48588 | 1339 The cdr of each entry is a function for applying the face to a region.") |
17493 | 1340 |
1341 (defcustom message-send-hook nil | |
88155 | 1342 "Hook run before sending messages. |
1343 This hook is run quite early when sending." | |
17493 | 1344 :group 'message-various |
1345 :options '(ispell-message) | |
88155 | 1346 :link '(custom-manual "(message)Various Message Variables") |
17493 | 1347 :type 'hook) |
1348 | |
1349 (defcustom message-send-mail-hook nil | |
88155 | 1350 "Hook run before sending mail messages. |
1351 This hook is run very late -- just before the message is sent as | |
1352 mail." | |
17493 | 1353 :group 'message-various |
88155 | 1354 :link '(custom-manual "(message)Various Message Variables") |
17493 | 1355 :type 'hook) |
1356 | |
1357 (defcustom message-send-news-hook nil | |
88155 | 1358 "Hook run before sending news messages. |
1359 This hook is run very late -- just before the message is sent as | |
1360 news." | |
17493 | 1361 :group 'message-various |
88155 | 1362 :link '(custom-manual "(message)Various Message Variables") |
17493 | 1363 :type 'hook) |
1364 | |
1365 (defcustom message-sent-hook nil | |
1366 "Hook run after sending messages." | |
1367 :group 'message-various | |
1368 :type 'hook) | |
1369 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1370 (defvar message-send-coding-system 'binary |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1371 "Coding system to encode outgoing mail.") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1372 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1373 (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
|
1374 mm-auto-save-coding-system |
88155 | 1375 "*Coding system to compose mail. |
1376 If you'd like to make it possible to share draft files between XEmacs | |
1377 and Emacs, you may use `iso-2022-7bit' for this value at your own risk. | |
1378 Note that the coding-system `iso-2022-7bit' isn't suitable to all data.") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1379 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1380 (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
|
1381 "The limitation of messages sent as message/partial. |
35147 | 1382 The lower bound of message size in characters, beyond which the message |
1383 should be sent in several parts. If it is nil, the size is unlimited." | |
33400
42c1ba3caf9c
(message-forward-as-mime, message-forward-ignored-headers)
Dave Love <fx@gnu.org>
parents:
33375
diff
changeset
|
1384 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1385 :group 'message-buffers |
88155 | 1386 :link '(custom-manual "(message)Mail Variables") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1387 :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
|
1388 (integer 1000000))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1389 |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
1390 (defcustom message-alternative-emails nil |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
1391 "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
|
1392 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
|
1393 :group 'message-headers |
88155 | 1394 :link '(custom-manual "(message)Message Headers") |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
1395 :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
|
1396 regexp)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
1397 |
88155 | 1398 (defcustom message-hierarchical-addresses nil |
1399 "A list of hierarchical mail address definitions. | |
1400 | |
1401 Inside each entry, the first address is the \"top\" address, and | |
1402 subsequent addresses are subaddresses; this is used to indicate that | |
1403 mail sent to the first address will automatically be delivered to the | |
1404 subaddresses. So if the first address appears in the recipient list | |
1405 for a message, the subaddresses will be removed (if present) before | |
1406 the mail is sent. All addresses in this structure should be | |
1407 downcased." | |
1408 :version "22.1" | |
1409 :group 'message-headers | |
1410 :type '(repeat (repeat string))) | |
1411 | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1412 (defcustom message-mail-user-agent nil |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1413 "Like `mail-user-agent'. |
35147 | 1414 Except if it is nil, use Gnus native MUA; if it is t, use |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1415 `mail-user-agent'." |
88155 | 1416 :version "22.1" |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1417 :type '(radio (const :tag "Gnus native" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1418 :format "%t\n" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1419 nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1420 (const :tag "`mail-user-agent'" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1421 :format "%t\n" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1422 t) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1423 (function-item :tag "Default Emacs mail" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1424 :format "%t\n" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1425 sendmail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1426 (function-item :tag "Emacs interface to MH" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1427 :format "%t\n" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1428 mh-e-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1429 (function :tag "Other")) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1430 :version "21.1" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1431 :group 'message) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
1432 |
88155 | 1433 (defcustom message-wide-reply-confirm-recipients nil |
1434 "Whether to confirm a wide reply to multiple email recipients. | |
1435 If this variable is nil, don't ask whether to reply to all recipients. | |
1436 If this variable is non-nil, pose the question \"Reply to all | |
1437 recipients?\" before a wide reply to multiple recipients. If the user | |
1438 answers yes, reply to all recipients as usual. If the user answers | |
1439 no, only reply back to the author." | |
1440 :version "22.1" | |
1441 :group 'message-headers | |
1442 :link '(custom-manual "(message)Wide Reply") | |
1443 :type 'boolean) | |
1444 | |
1445 (defcustom message-user-fqdn nil | |
1446 "*Domain part of Message-Ids." | |
1447 :version "22.1" | |
1448 :group 'message-headers | |
1449 :link '(custom-manual "(message)News Headers") | |
1450 :type '(radio (const :format "%v " nil) | |
1451 (string :format "FQDN: %v"))) | |
1452 | |
1453 (defcustom message-use-idna (and (condition-case nil (require 'idna) | |
1454 (file-error)) | |
1455 (mm-coding-system-p 'utf-8) | |
1456 (executable-find idna-program) | |
1457 (string= (idna-to-ascii "räksmörgås") | |
1458 "xn--rksmrgs-5wao1o") | |
1459 t) | |
1460 "Whether to encode non-ASCII in domain names into ASCII according to IDNA. | |
1461 GNU Libidn, and in particular the elisp package \"idna.el\" and | |
1462 the external program \"idn\", must be installed for this | |
1463 functionality to work." | |
1464 :version "22.1" | |
1465 :group 'message-headers | |
1466 :link '(custom-manual "(message)IDNA") | |
1467 :type '(choice (const :tag "Ask" ask) | |
1468 (const :tag "Never" nil) | |
1469 (const :tag "Always" t))) | |
1470 | |
17493 | 1471 ;;; Internal variables. |
1472 | |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
1473 (defvar message-sending-message "Sending...") |
17493 | 1474 (defvar message-buffer-list nil) |
1475 (defvar message-this-is-news nil) | |
1476 (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
|
1477 (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
|
1478 (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
|
1479 (defvar message-posting-charset nil) |
88155 | 1480 (defvar message-inserted-headers nil) |
17493 | 1481 |
1482 ;; Byte-compiler warning | |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
1483 (eval-when-compile |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
1484 (defvar gnus-active-hashtb) |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
1485 (defvar gnus-read-active-file)) |
17493 | 1486 |
1487 ;;; 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
|
1488 ;;; (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
|
1489 ;;; of rmail.el's rmail-unix-mail-delimiter. |
17493 | 1490 (defvar message-unix-mail-delimiter |
1491 (let ((time-zone-regexp | |
1492 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?" | |
1493 "\\|[-+]?[0-9][0-9][0-9][0-9]" | |
1494 "\\|" | |
1495 "\\) *"))) | |
1496 (concat | |
1497 "From " | |
1498 | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1499 ;; 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
|
1500 ;; 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
|
1501 ;; `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
|
1502 ;; `<@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
|
1503 ;; can be removed, e.g. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1504 ;; From: joe@y.z (Joe K |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1505 ;; User) |
88155 | 1506 ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1507 ;; From: Joe User |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1508 ;; <joe@y.z> |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1509 ;; 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
|
1510 ;; 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
|
1511 ;; From: "Joe User"{space}{tab} |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1512 ;; <joe@y.z> |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1513 ;; 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
|
1514 ;; 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
|
1515 ;; 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
|
1516 ;; 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
|
1517 ;; obviously bogus, but after that anything goes. |
88155 | 1518 "\\([^\0-\b\n-\r\^?].*\\)?" |
17493 | 1519 |
1520 ;; 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
|
1521 "\\([^\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
|
1522 "\\([^\0-\r \^?]+\\) +" ; month |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1523 "\\([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
|
1524 "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day |
17493 | 1525 |
1526 ;; Perhaps a time zone, specified by an abbreviation, or by a | |
1527 ;; numeric offset. | |
1528 time-zone-regexp | |
1529 | |
1530 ;; The year. | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1531 " \\([0-9][0-9]+\\) *" |
17493 | 1532 |
1533 ;; On some systems the time zone can appear after the year, too. | |
1534 time-zone-regexp | |
1535 | |
1536 ;; Old uucp cruft. | |
1537 "\\(remote from .*\\)?" | |
1538 | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1539 "\n")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1540 "Regexp matching the delimiter of messages in UNIX mail format.") |
17493 | 1541 |
1542 (defvar message-unsent-separator | |
1543 (concat "^ *---+ +Unsent message follows +---+ *$\\|" | |
1544 "^ *---+ +Returned message +---+ *$\\|" | |
1545 "^Start of returned message$\\|" | |
1546 "^ *---+ +Original message +---+ *$\\|" | |
1547 "^ *--+ +begin message +--+ *$\\|" | |
1548 "^ *---+ +Original message follows +---+ *$\\|" | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1549 "^ *---+ +Undelivered message follows +---+ *$\\|" |
17493 | 1550 "^|? *---+ +Message text follows: +---+ *|?$") |
1551 "A regexp that matches the separator before the text of a failed message.") | |
1552 | |
1553 (defvar message-header-format-alist | |
1554 `((Newsgroups) | |
1555 (To . message-fill-address) | |
1556 (Cc . message-fill-address) | |
1557 (Subject) | |
1558 (In-Reply-To) | |
1559 (Fcc) | |
1560 (Bcc) | |
1561 (Date) | |
1562 (Organization) | |
1563 (Distribution) | |
1564 (Lines) | |
1565 (Expires) | |
1566 (Message-ID) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1567 (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
|
1568 (User-Agent)) |
17493 | 1569 "Alist used for formatting headers.") |
1570 | |
88155 | 1571 (defvar message-options nil |
1572 "Some saved answers when sending message.") | |
1573 | |
1574 (defvar message-send-mail-real-function nil | |
1575 "Internal send mail function.") | |
1576 | |
1577 (defvar message-bogus-system-names "^localhost\\." | |
1578 "The regexp of bogus system names.") | |
1579 | |
1580 (defcustom message-valid-fqdn-regexp | |
1581 (concat "[a-z0-9][-.a-z0-9]+\\." ;; [hostname.subdomain.]domain. | |
1582 ;; valid TLDs: | |
1583 "\\([a-z][a-z]" ;; two letter country TDLs | |
1584 "\\|biz\\|com\\|edu\\|gov\\|int\\|mil\\|net\\|org" | |
1585 "\\|aero\\|coop\\|info\\|name\\|museum" | |
1586 "\\|arpa\\|pro\\|uucp\\|bitnet\\|bofh" ;; old style? | |
1587 "\\)") | |
1588 "Regular expression that matches a valid FQDN." | |
1589 ;; see also: gnus-button-valid-fqdn-regexp | |
1590 :version "22.1" | |
1591 :group 'message-headers | |
1592 :type 'regexp) | |
1593 | |
17493 | 1594 (eval-and-compile |
88155 | 1595 (autoload 'idna-to-ascii "idna") |
17493 | 1596 (autoload 'message-setup-toolbar "messagexmas") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1597 (autoload 'mh-new-draft-name "mh-comp") |
17493 | 1598 (autoload 'mh-send-letter "mh-comp") |
1599 (autoload 'gnus-point-at-eol "gnus-util") | |
1600 (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
|
1601 (autoload 'gnus-output-to-rmail "gnus-util") |
17493 | 1602 (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
|
1603 (autoload 'nndraft-request-associate-buffer "nndraft") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1604 (autoload 'nndraft-request-expire-articles "nndraft") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1605 (autoload 'gnus-open-server "gnus-int") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1606 (autoload 'gnus-request-post "gnus-int") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1607 (autoload 'gnus-alive-p "gnus-util") |
88155 | 1608 (autoload 'gnus-server-string "gnus") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1609 (autoload 'gnus-group-name-charset "gnus-group") |
88155 | 1610 (autoload 'gnus-group-name-decode "gnus-group") |
1611 (autoload 'gnus-groups-from-server "gnus") | |
1612 (autoload 'rmail-output "rmailout") | |
1613 (autoload 'gnus-delay-article "gnus-delay") | |
1614 (autoload 'gnus-make-local-hook "gnus-util") | |
1615 (autoload 'gnus-extract-address-components "gnus-util")) | |
17493 | 1616 |
1617 | |
1618 | |
1619 ;;; | |
1620 ;;; Utility functions. | |
1621 ;;; | |
1622 | |
1623 (defmacro message-y-or-n-p (question show &rest text) | |
35147 | 1624 "Ask QUESTION, displaying remaining args in a temporary buffer if SHOW." |
17493 | 1625 `(message-talkative-question 'y-or-n-p ,question ,show ,@text)) |
1626 | |
1627 (defmacro message-delete-line (&optional n) | |
35147 | 1628 "Delete the current line (and the next N lines)." |
17493 | 1629 `(delete-region (progn (beginning-of-line) (point)) |
1630 (progn (forward-line ,(or n 1)) (point)))) | |
1631 | |
88155 | 1632 (defun message-mark-active-p () |
1633 "Non-nil means the mark and region are currently active in this buffer." | |
1634 mark-active) | |
1635 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1636 (defun message-unquote-tokens (elems) |
35147 | 1637 "Remove double quotes (\") from strings in list ELEMS." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1638 (mapcar (lambda (item) |
88155 | 1639 (while (string-match "^\\(.*\\)\"\\(.*\\)$" item) |
1640 (setq item (concat (match-string 1 item) | |
1641 (match-string 2 item)))) | |
1642 item) | |
1643 elems)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1644 |
17493 | 1645 (defun message-tokenize-header (header &optional separator) |
1646 "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
|
1647 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
|
1648 is used by default." |
17493 | 1649 (if (not header) |
1650 nil | |
1651 (let ((regexp (format "[%s]+" (or separator ","))) | |
1652 (first t) | |
88155 | 1653 beg quoted elems paren) |
1654 (with-temp-buffer | |
1655 (mm-enable-multibyte) | |
1656 (setq beg (point-min)) | |
17493 | 1657 (insert header) |
1658 (goto-char (point-min)) | |
1659 (while (not (eobp)) | |
1660 (if first | |
1661 (setq first nil) | |
1662 (forward-char 1)) | |
1663 (cond ((and (> (point) beg) | |
1664 (or (eobp) | |
1665 (and (looking-at regexp) | |
1666 (not quoted) | |
1667 (not paren)))) | |
1668 (push (buffer-substring beg (point)) elems) | |
1669 (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
|
1670 ((eq (char-after) ?\") |
17493 | 1671 (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
|
1672 ((and (eq (char-after) ?\() |
17493 | 1673 (not quoted)) |
1674 (setq paren t)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1675 ((and (eq (char-after) ?\)) |
17493 | 1676 (not quoted)) |
1677 (setq paren nil)))) | |
88155 | 1678 (nreverse elems))))) |
17493 | 1679 |
1680 (defun message-mail-file-mbox-p (file) | |
1681 "Say whether FILE looks like a Unix mbox file." | |
1682 (when (and (file-exists-p file) | |
1683 (file-readable-p file) | |
1684 (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
|
1685 (with-temp-buffer |
17493 | 1686 (nnheader-insert-file-contents file) |
1687 (goto-char (point-min)) | |
1688 (looking-at message-unix-mail-delimiter)))) | |
1689 | |
1690 (defun message-fetch-field (header &optional not-all) | |
88155 | 1691 "The same as `mail-fetch-field', only remove all newlines. |
1692 The buffer is expected to be narrowed to just the header of the message; | |
1693 see `message-narrow-to-headers-or-head'." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1694 (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
|
1695 (case-fold-search t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1696 (value (mail-fetch-field header nil (not not-all)))) |
17493 | 1697 (when value |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1698 (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
|
1699 (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
|
1700 (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
|
1701 value))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1702 |
88155 | 1703 (defun message-field-value (header &optional not-all) |
1704 "The same as `message-fetch-field', only narrow to the headers first." | |
1705 (save-excursion | |
1706 (save-restriction | |
1707 (message-narrow-to-headers-or-head) | |
1708 (message-fetch-field header not-all)))) | |
1709 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1710 (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
|
1711 "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
|
1712 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1713 (narrow-to-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1714 (point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1715 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1716 (forward-line 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1717 (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
|
1718 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1719 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1720 (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1721 (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1722 (goto-char (point-min))) |
17493 | 1723 |
1724 (defun message-add-header (&rest headers) | |
1725 "Add the HEADERS to the message header, skipping those already present." | |
1726 (while headers | |
1727 (let (hclean) | |
1728 (unless (string-match "^\\([^:]+\\):[ \t]*[^ \t]" (car headers)) | |
1729 (error "Invalid header `%s'" (car headers))) | |
1730 (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
|
1731 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1732 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1733 (unless (re-search-forward (concat "^" (regexp-quote hclean) ":") nil t) |
88155 | 1734 (goto-char (point-max)) |
1735 (if (string-match "\n$" (car headers)) | |
1736 (insert (car headers)) | |
1737 (insert (car headers) ?\n))))) | |
17493 | 1738 (setq headers (cdr headers)))) |
1739 | |
88155 | 1740 (defmacro message-with-reply-buffer (&rest forms) |
1741 "Evaluate FORMS in the reply buffer, if it exists." | |
1742 `(when (and message-reply-buffer | |
1743 (buffer-name message-reply-buffer)) | |
1744 (save-excursion | |
1745 (set-buffer message-reply-buffer) | |
1746 ,@forms))) | |
1747 | |
1748 (put 'message-with-reply-buffer 'lisp-indent-function 0) | |
1749 (put 'message-with-reply-buffer 'edebug-form-spec '(body)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1750 |
17493 | 1751 (defun message-fetch-reply-field (header) |
35147 | 1752 "Fetch field HEADER from the message we're replying to." |
88155 | 1753 (message-with-reply-buffer |
1754 (save-restriction | |
1755 (mail-narrow-to-head) | |
17493 | 1756 (message-fetch-field header)))) |
1757 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1758 (defun message-strip-list-identifiers (subject) |
35147 | 1759 "Remove list identifiers in `gnus-list-identifiers' from string SUBJECT." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1760 (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
|
1761 (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
|
1762 gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1763 (mapconcat 'identity gnus-list-identifiers " *\\|")))) |
35147 | 1764 (if (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp |
88155 | 1765 " *\\)\\)+\\(Re: +\\)?\\)") subject) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1766 (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
|
1767 (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
|
1768 (match-string 5 subject)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1769 (substring subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1770 (match-end 1))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1771 subject))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1772 |
17493 | 1773 (defun message-strip-subject-re (subject) |
35147 | 1774 "Remove \"Re:\" from subject lines in string SUBJECT." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1775 (if (string-match message-subject-re-regexp subject) |
17493 | 1776 (substring subject (match-end 0)) |
1777 subject)) | |
1778 | |
88155 | 1779 ;;; Start of functions adopted from `message-utils.el'. |
1780 | |
1781 (defun message-strip-subject-trailing-was (subject) | |
1782 "Remove trailing \"(was: <old subject>)\" from SUBJECT lines. | |
1783 Leading \"Re: \" is not stripped by this function. Use the function | |
1784 `message-strip-subject-re' for this." | |
1785 (let* ((query message-subject-trailing-was-query) | |
1786 (new) (found)) | |
1787 (setq found | |
1788 (string-match | |
1789 (if (eq query 'ask) | |
1790 message-subject-trailing-was-ask-regexp | |
1791 message-subject-trailing-was-regexp) | |
1792 subject)) | |
1793 (if found | |
1794 (setq new (substring subject 0 (match-beginning 0)))) | |
1795 (if (or (not found) (eq query nil)) | |
1796 subject | |
1797 (if (eq query 'ask) | |
1798 (if (message-y-or-n-p | |
1799 "Strip `(was: <old subject>)' in subject? " t | |
1800 (concat | |
1801 "Strip `(was: <old subject>)' in subject " | |
1802 "and use the new one instead?\n\n" | |
1803 "Current subject is: \"" | |
1804 subject "\"\n\n" | |
1805 "New subject would be: \"" | |
1806 new "\"\n\n" | |
1807 "See the variable `message-subject-trailing-was-query' " | |
1808 "to get rid of this query." | |
1809 )) | |
1810 new subject) | |
1811 new)))) | |
1812 | |
1813 ;;; Suggested by Jonas Steverud @ www.dtek.chalmers.se/~d4jonas/ | |
1814 | |
1815 (defun message-change-subject (new-subject) | |
1816 "Ask for NEW-SUBJECT header, append (was: <Old Subject>)." | |
1817 ;; <URL:http://www.landfield.com/usefor/drafts/draft-ietf-usefor-useage--1.02.unpaged> | |
1818 (interactive | |
1819 (list | |
1820 (read-from-minibuffer "New subject: "))) | |
1821 (cond ((and (not (or (null new-subject) ; new subject not empty | |
1822 (zerop (string-width new-subject)) | |
1823 (string-match "^[ \t]*$" new-subject)))) | |
1824 (save-excursion | |
1825 (let ((old-subject | |
1826 (save-restriction | |
1827 (message-narrow-to-headers) | |
1828 (message-fetch-field "Subject")))) | |
1829 (cond ((not old-subject) | |
1830 (error "No current subject")) | |
1831 ((not (string-match | |
1832 (concat "^[ \t]*" | |
1833 (regexp-quote new-subject) | |
1834 " \t]*$") | |
1835 old-subject)) ; yes, it really is a new subject | |
1836 ;; delete eventual Re: prefix | |
1837 (setq old-subject | |
1838 (message-strip-subject-re old-subject)) | |
1839 (message-goto-subject) | |
1840 (message-delete-line) | |
1841 (insert (concat "Subject: " | |
1842 new-subject | |
1843 " (was: " | |
1844 old-subject ")\n"))))))))) | |
1845 | |
1846 (defun message-mark-inserted-region (beg end) | |
1847 "Mark some region in the current article with enclosing tags. | |
1848 See `message-mark-insert-begin' and `message-mark-insert-end'." | |
1849 (interactive "r") | |
1850 (save-excursion | |
1851 ;; add to the end of the region first, otherwise end would be invalid | |
1852 (goto-char end) | |
1853 (insert message-mark-insert-end) | |
1854 (goto-char beg) | |
1855 (insert message-mark-insert-begin))) | |
1856 | |
1857 (defun message-mark-insert-file (file) | |
1858 "Insert FILE at point, marking it with enclosing tags. | |
1859 See `message-mark-insert-begin' and `message-mark-insert-end'." | |
1860 (interactive "fFile to insert: ") | |
1861 ;; reverse insertion to get correct result. | |
1862 (let ((p (point))) | |
1863 (insert message-mark-insert-end) | |
1864 (goto-char p) | |
1865 (insert-file-contents file) | |
1866 (goto-char p) | |
1867 (insert message-mark-insert-begin))) | |
1868 | |
1869 (defun message-add-archive-header () | |
1870 "Insert \"X-No-Archive: Yes\" in the header and a note in the body. | |
1871 The note can be customized using `message-archive-note'. When called with a | |
1872 prefix argument, ask for a text to insert. If you don't want the note in the | |
1873 body, set `message-archive-note' to nil." | |
1874 (interactive) | |
1875 (if current-prefix-arg | |
1876 (setq message-archive-note | |
1877 (read-from-minibuffer "Reason for No-Archive: " | |
1878 (cons message-archive-note 0)))) | |
1879 (save-excursion | |
1880 (if (message-goto-signature) | |
1881 (re-search-backward message-signature-separator)) | |
1882 (when message-archive-note | |
1883 (insert message-archive-note) | |
1884 (newline)) | |
1885 (message-add-header message-archive-header) | |
1886 (message-sort-headers))) | |
1887 | |
1888 (defun message-cross-post-followup-to-header (target-group) | |
1889 "Mangles FollowUp-To and Newsgroups header to point to TARGET-GROUP. | |
1890 With prefix-argument just set Follow-Up, don't cross-post." | |
1891 (interactive | |
1892 (list ; Completion based on Gnus | |
1893 (completing-read "Followup To: " | |
1894 (if (boundp 'gnus-newsrc-alist) | |
1895 gnus-newsrc-alist) | |
1896 nil nil '("poster" . 0) | |
1897 (if (boundp 'gnus-group-history) | |
1898 'gnus-group-history)))) | |
1899 (message-remove-header "Follow[Uu]p-[Tt]o" t) | |
1900 (message-goto-newsgroups) | |
1901 (beginning-of-line) | |
1902 ;; if we already did a crosspost before, kill old target | |
1903 (if (and message-cross-post-old-target | |
1904 (re-search-forward | |
1905 (regexp-quote (concat "," message-cross-post-old-target)) | |
1906 nil t)) | |
1907 (replace-match "")) | |
1908 ;; unless (followup is to poster or user explicitly asked not | |
1909 ;; to cross-post, or target-group is already in Newsgroups) | |
1910 ;; add target-group to Newsgroups line. | |
1911 (cond ((and (or | |
1912 ;; def: cross-post, req:no | |
1913 (and message-cross-post-default (not current-prefix-arg)) | |
1914 ;; def: no-cross-post, req:yes | |
1915 (and (not message-cross-post-default) current-prefix-arg)) | |
1916 (not (string-match "poster" target-group)) | |
1917 (not (string-match (regexp-quote target-group) | |
1918 (message-fetch-field "Newsgroups")))) | |
1919 (end-of-line) | |
1920 (insert (concat "," target-group)))) | |
1921 (end-of-line) ; ensure Followup: comes after Newsgroups: | |
1922 ;; unless new followup would be identical to Newsgroups line | |
1923 ;; make a new Followup-To line | |
1924 (if (not (string-match (concat "^[ \t]*" | |
1925 target-group | |
1926 "[ \t]*$") | |
1927 (message-fetch-field "Newsgroups"))) | |
1928 (insert (concat "\nFollowup-To: " target-group))) | |
1929 (setq message-cross-post-old-target target-group)) | |
1930 | |
1931 (defun message-cross-post-insert-note (target-group cross-post in-old | |
1932 old-groups) | |
1933 "Insert a in message body note about a set Followup or Crosspost. | |
1934 If there have been previous notes, delete them. TARGET-GROUP specifies the | |
1935 group to Followup-To. When CROSS-POST is t, insert note about | |
1936 crossposting. IN-OLD specifies whether TARGET-GROUP is a member of | |
1937 OLD-GROUPS. OLD-GROUPS lists the old-groups the posting would have | |
1938 been made to before the user asked for a Crosspost." | |
1939 ;; start scanning body for previous uses | |
1940 (message-goto-signature) | |
1941 (let ((head (re-search-backward | |
1942 (concat "^" mail-header-separator) | |
1943 nil t))) ; just search in body | |
1944 (message-goto-signature) | |
1945 (while (re-search-backward | |
1946 (concat "^" (regexp-quote message-cross-post-note) ".*") | |
1947 head t) | |
1948 (message-delete-line)) | |
1949 (message-goto-signature) | |
1950 (while (re-search-backward | |
1951 (concat "^" (regexp-quote message-followup-to-note) ".*") | |
1952 head t) | |
1953 (message-delete-line)) | |
1954 ;; insert new note | |
1955 (if (message-goto-signature) | |
1956 (re-search-backward message-signature-separator)) | |
1957 (if (or in-old | |
1958 (not cross-post) | |
1959 (string-match "^[ \t]*poster[ \t]*$" target-group)) | |
1960 (insert (concat message-followup-to-note target-group "\n")) | |
1961 (insert (concat message-cross-post-note target-group "\n"))))) | |
1962 | |
1963 (defun message-cross-post-followup-to (target-group) | |
1964 "Crossposts message and set Followup-To to TARGET-GROUP. | |
1965 With prefix-argument just set Follow-Up, don't cross-post." | |
1966 (interactive | |
1967 (list ; Completion based on Gnus | |
1968 (completing-read "Followup To: " | |
1969 (if (boundp 'gnus-newsrc-alist) | |
1970 gnus-newsrc-alist) | |
1971 nil nil '("poster" . 0) | |
1972 (if (boundp 'gnus-group-history) | |
1973 'gnus-group-history)))) | |
1974 (cond ((not (or (null target-group) ; new subject not empty | |
1975 (zerop (string-width target-group)) | |
1976 (string-match "^[ \t]*$" target-group))) | |
1977 (save-excursion | |
1978 (let* ((old-groups (message-fetch-field "Newsgroups")) | |
1979 (in-old (string-match | |
1980 (regexp-quote target-group) | |
1981 (or old-groups "")))) | |
1982 ;; check whether target exactly matches old Newsgroups | |
1983 (cond ((not old-groups) | |
1984 (error "No current newsgroup")) | |
1985 ((or (not in-old) | |
1986 (not (string-match | |
1987 (concat "^[ \t]*" | |
1988 (regexp-quote target-group) | |
1989 "[ \t]*$") | |
1990 old-groups))) | |
1991 ;; yes, Newsgroups line must change | |
1992 (message-cross-post-followup-to-header target-group) | |
1993 ;; insert note whether we do cross-post or followup-to | |
1994 (funcall message-cross-post-note-function | |
1995 target-group | |
1996 (if (or (and message-cross-post-default | |
1997 (not current-prefix-arg)) | |
1998 (and (not message-cross-post-default) | |
1999 current-prefix-arg)) t) | |
2000 in-old old-groups)))))))) | |
2001 | |
2002 ;;; Reduce To: to Cc: or Bcc: header | |
2003 | |
2004 (defun message-reduce-to-to-cc () | |
2005 "Replace contents of To: header with contents of Cc: or Bcc: header." | |
2006 (interactive) | |
2007 (let ((cc-content | |
2008 (save-restriction (message-narrow-to-headers) | |
2009 (message-fetch-field "cc"))) | |
2010 (bcc nil)) | |
2011 (if (and (not cc-content) | |
2012 (setq cc-content | |
2013 (save-restriction | |
2014 (message-narrow-to-headers) | |
2015 (message-fetch-field "bcc")))) | |
2016 (setq bcc t)) | |
2017 (cond (cc-content | |
2018 (save-excursion | |
2019 (message-goto-to) | |
2020 (message-delete-line) | |
2021 (insert (concat "To: " cc-content "\n")) | |
2022 (save-restriction | |
2023 (message-narrow-to-headers) | |
2024 (message-remove-header (if bcc | |
2025 "bcc" | |
2026 "cc")))))))) | |
2027 | |
2028 ;;; End of functions adopted from `message-utils.el'. | |
2029 | |
17493 | 2030 (defun message-remove-header (header &optional is-regexp first reverse) |
2031 "Remove HEADER in the narrowed buffer. | |
35147 | 2032 If IS-REGEXP, HEADER is a regular expression. |
17493 | 2033 If FIRST, only remove the first instance of the header. |
2034 Return the number of headers removed." | |
2035 (goto-char (point-min)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2036 (let ((regexp (if is-regexp header (concat "^" (regexp-quote header) ":"))) |
17493 | 2037 (number 0) |
2038 (case-fold-search t) | |
2039 last) | |
2040 (while (and (not (eobp)) | |
2041 (not last)) | |
2042 (if (if reverse | |
2043 (not (looking-at regexp)) | |
2044 (looking-at regexp)) | |
2045 (progn | |
2046 (incf number) | |
2047 (when first | |
2048 (setq last t)) | |
2049 (delete-region | |
2050 (point) | |
2051 ;; There might be a continuation header, so we have to search | |
2052 ;; until we find a new non-continuation line. | |
2053 (progn | |
2054 (forward-line 1) | |
2055 (if (re-search-forward "^[^ \t]" nil t) | |
2056 (goto-char (match-beginning 0)) | |
2057 (point-max))))) | |
2058 (forward-line 1) | |
2059 (if (re-search-forward "^[^ \t]" nil t) | |
2060 (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
|
2061 (goto-char (point-max))))) |
17493 | 2062 number)) |
2063 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2064 (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
|
2065 "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
|
2066 (let ((count 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2067 (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
|
2068 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2069 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2070 (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
|
2071 (incf count))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2072 (while (> count 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2073 (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
|
2074 (decf count)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2075 |
17493 | 2076 (defun message-narrow-to-headers () |
2077 "Narrow the buffer to the head of the message." | |
2078 (widen) | |
2079 (narrow-to-region | |
2080 (goto-char (point-min)) | |
2081 (if (re-search-forward | |
2082 (concat "^" (regexp-quote mail-header-separator) "\n") nil t) | |
2083 (match-beginning 0) | |
2084 (point-max))) | |
2085 (goto-char (point-min))) | |
2086 | |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
2087 (defun message-narrow-to-head-1 () |
35147 | 2088 "Like `message-narrow-to-head'. Don't widen." |
17493 | 2089 (narrow-to-region |
2090 (goto-char (point-min)) | |
2091 (if (search-forward "\n\n" nil 1) | |
2092 (1- (point)) | |
2093 (point-max))) | |
2094 (goto-char (point-min))) | |
2095 | |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
2096 (defun message-narrow-to-head () |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
2097 "Narrow the buffer to the head of the message. |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
2098 Point is left at the beginning of the narrowed-to region." |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
2099 (widen) |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
2100 (message-narrow-to-head-1)) |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
2101 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2102 (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
|
2103 "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
|
2104 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2105 (narrow-to-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2106 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2107 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2108 ((re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2109 (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
|
2110 (match-beginning 0)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2111 ((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
|
2112 (1- (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2113 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2114 (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2115 (goto-char (point-min))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2116 |
17493 | 2117 (defun message-news-p () |
2118 "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
|
2119 (and (not message-this-is-mail) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2120 (or message-this-is-news |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2121 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2122 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2123 (message-narrow-to-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2124 (and (message-fetch-field "newsgroups") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2125 (not (message-fetch-field "posted-to")))))))) |
17493 | 2126 |
2127 (defun message-mail-p () | |
2128 "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
|
2129 (and (not message-this-is-news) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2130 (or message-this-is-mail |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2131 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2132 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2133 (message-narrow-to-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2134 (or (message-fetch-field "to") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2135 (message-fetch-field "cc") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2136 (message-fetch-field "bcc"))))))) |
17493 | 2137 |
88155 | 2138 (defun message-subscribed-p () |
2139 "Say whether we need to insert a MFT header." | |
2140 (or message-subscribed-regexps | |
2141 message-subscribed-addresses | |
2142 message-subscribed-address-file | |
2143 message-subscribed-address-functions)) | |
2144 | |
17493 | 2145 (defun message-next-header () |
2146 "Go to the beginning of the next header." | |
2147 (beginning-of-line) | |
2148 (or (eobp) (forward-char 1)) | |
2149 (not (if (re-search-forward "^[^ \t]" nil t) | |
2150 (beginning-of-line) | |
2151 (goto-char (point-max))))) | |
2152 | |
2153 (defun message-sort-headers-1 () | |
2154 "Sort the buffer as headers using `message-rank' text props." | |
2155 (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
|
2156 (require 'sort) |
17493 | 2157 (sort-subr |
2158 nil 'message-next-header | |
2159 (lambda () | |
2160 (message-next-header) | |
2161 (unless (bobp) | |
2162 (forward-char -1))) | |
2163 (lambda () | |
2164 (or (get-text-property (point) 'message-rank) | |
2165 10000)))) | |
2166 | |
2167 (defun message-sort-headers () | |
2168 "Sort the headers of the current message according to `message-header-format-alist'." | |
2169 (interactive) | |
2170 (save-excursion | |
2171 (save-restriction | |
2172 (let ((max (1+ (length message-header-format-alist))) | |
2173 rank) | |
2174 (message-narrow-to-headers) | |
2175 (while (re-search-forward "^[^ \n]+:" nil t) | |
2176 (put-text-property | |
2177 (match-beginning 0) (1+ (match-beginning 0)) | |
2178 'message-rank | |
2179 (if (setq rank (length (memq (assq (intern (buffer-substring | |
2180 (match-beginning 0) | |
2181 (1- (match-end 0)))) | |
2182 message-header-format-alist) | |
2183 message-header-format-alist))) | |
2184 (- max rank) | |
2185 (1+ max))))) | |
2186 (message-sort-headers-1)))) | |
2187 | |
88155 | 2188 |
17493 | 2189 |
2190 | |
2191 ;;; | |
2192 ;;; Message mode | |
2193 ;;; | |
2194 | |
2195 ;;; Set up keymap. | |
2196 | |
2197 (defvar message-mode-map nil) | |
2198 | |
2199 (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
|
2200 (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
|
2201 (set-keymap-parent message-mode-map text-mode-map) |
17493 | 2202 (define-key message-mode-map "\C-c?" 'describe-mode) |
2203 | |
2204 (define-key message-mode-map "\C-c\C-f\C-t" 'message-goto-to) | |
88155 | 2205 (define-key message-mode-map "\C-c\C-f\C-o" 'message-goto-from) |
17493 | 2206 (define-key message-mode-map "\C-c\C-f\C-b" 'message-goto-bcc) |
2207 (define-key message-mode-map "\C-c\C-f\C-w" 'message-goto-fcc) | |
2208 (define-key message-mode-map "\C-c\C-f\C-c" 'message-goto-cc) | |
2209 (define-key message-mode-map "\C-c\C-f\C-s" 'message-goto-subject) | |
2210 (define-key message-mode-map "\C-c\C-f\C-r" 'message-goto-reply-to) | |
2211 (define-key message-mode-map "\C-c\C-f\C-n" 'message-goto-newsgroups) | |
2212 (define-key message-mode-map "\C-c\C-f\C-d" 'message-goto-distribution) | |
2213 (define-key message-mode-map "\C-c\C-f\C-f" 'message-goto-followup-to) | |
88155 | 2214 (define-key message-mode-map "\C-c\C-f\C-m" 'message-goto-mail-followup-to) |
17493 | 2215 (define-key message-mode-map "\C-c\C-f\C-k" 'message-goto-keywords) |
2216 (define-key message-mode-map "\C-c\C-f\C-u" 'message-goto-summary) | |
88155 | 2217 (define-key message-mode-map "\C-c\C-f\C-i" |
2218 'message-insert-or-toggle-importance) | |
2219 (define-key message-mode-map "\C-c\C-f\C-a" | |
2220 'message-generate-unsubscribed-mail-followup-to) | |
2221 | |
2222 ;; modify headers (and insert notes in body) | |
2223 (define-key message-mode-map "\C-c\C-fs" 'message-change-subject) | |
2224 ;; | |
2225 (define-key message-mode-map "\C-c\C-fx" 'message-cross-post-followup-to) | |
2226 ;; prefix+message-cross-post-followup-to = same w/o cross-post | |
2227 (define-key message-mode-map "\C-c\C-ft" 'message-reduce-to-to-cc) | |
2228 (define-key message-mode-map "\C-c\C-fa" 'message-add-archive-header) | |
2229 ;; mark inserted text | |
2230 (define-key message-mode-map "\C-c\M-m" 'message-mark-inserted-region) | |
2231 (define-key message-mode-map "\C-c\M-f" 'message-mark-insert-file) | |
2232 | |
17493 | 2233 (define-key message-mode-map "\C-c\C-b" 'message-goto-body) |
2234 (define-key message-mode-map "\C-c\C-i" 'message-goto-signature) | |
2235 | |
2236 (define-key message-mode-map "\C-c\C-t" 'message-insert-to) | |
88155 | 2237 (define-key message-mode-map "\C-c\C-fw" 'message-insert-wide-reply) |
17493 | 2238 (define-key message-mode-map "\C-c\C-n" 'message-insert-newsgroups) |
88155 | 2239 (define-key message-mode-map "\C-c\C-l" 'message-to-list-only) |
2240 | |
2241 (define-key message-mode-map "\C-c\C-u" 'message-insert-or-toggle-importance) | |
2242 (define-key message-mode-map "\C-c\M-n" | |
2243 'message-insert-disposition-notification-to) | |
17493 | 2244 |
2245 (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
|
2246 (define-key message-mode-map "\C-c\M-\C-y" 'message-yank-buffer) |
17493 | 2247 (define-key message-mode-map "\C-c\C-q" 'message-fill-yanked-message) |
2248 (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
|
2249 (define-key message-mode-map "\C-c\M-h" 'message-insert-headers) |
17493 | 2250 (define-key message-mode-map "\C-c\C-r" 'message-caesar-buffer-body) |
2251 (define-key message-mode-map "\C-c\C-o" 'message-sort-headers) | |
2252 (define-key message-mode-map "\C-c\M-r" 'message-rename-buffer) | |
2253 | |
2254 (define-key message-mode-map "\C-c\C-c" 'message-send-and-exit) | |
2255 (define-key message-mode-map "\C-c\C-s" 'message-send) | |
2256 (define-key message-mode-map "\C-c\C-k" 'message-kill-buffer) | |
2257 (define-key message-mode-map "\C-c\C-d" 'message-dont-send) | |
88155 | 2258 (define-key message-mode-map "\C-c\n" 'gnus-delay-article) |
17493 | 2259 |
2260 (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
|
2261 (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
|
2262 (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
|
2263 (define-key message-mode-map "\M-\r" 'message-newline-and-reformat) |
88155 | 2264 ;;(define-key message-mode-map "\M-q" 'message-fill-paragraph) |
49034
b6e082e00b00
(message-split-line): New function.
Kim F. Storm <storm@cua.dk>
parents:
48588
diff
changeset
|
2265 (define-key message-mode-map [remap split-line] 'message-split-line) |
17493 | 2266 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2267 (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
|
2268 |
88155 | 2269 (define-key message-mode-map "\C-a" 'message-beginning-of-line) |
2270 (define-key message-mode-map "\t" 'message-tab) | |
2271 (define-key message-mode-map "\M-;" 'comment-region)) | |
2272 | |
2273 (easy-menu-define | |
2274 message-mode-menu message-mode-map "Message Menu." | |
2275 `("Message" | |
2276 ["Yank Original" message-yank-original message-reply-buffer] | |
2277 ["Fill Yanked Message" message-fill-yanked-message t] | |
2278 ["Insert Signature" message-insert-signature t] | |
2279 ["Caesar (rot13) Message" message-caesar-buffer-body t] | |
2280 ["Caesar (rot13) Region" message-caesar-region (message-mark-active-p)] | |
2281 ["Elide Region" message-elide-region | |
2282 :active (message-mark-active-p) | |
2283 ,@(if (featurep 'xemacs) nil | |
2284 '(:help "Replace text in region with an ellipsis"))] | |
2285 ["Delete Outside Region" message-delete-not-region | |
2286 :active (message-mark-active-p) | |
2287 ,@(if (featurep 'xemacs) nil | |
2288 '(:help "Delete all quoted text outside region"))] | |
2289 ["Kill To Signature" message-kill-to-signature t] | |
2290 ["Newline and Reformat" message-newline-and-reformat t] | |
2291 ["Rename buffer" message-rename-buffer t] | |
2292 ["Spellcheck" ispell-message | |
2293 ,@(if (featurep 'xemacs) '(t) | |
2294 '(:help "Spellcheck this message"))] | |
2295 "----" | |
2296 ["Insert Region Marked" message-mark-inserted-region | |
2297 :active (message-mark-active-p) | |
2298 ,@(if (featurep 'xemacs) nil | |
2299 '(:help "Mark region with enclosing tags"))] | |
2300 ["Insert File Marked..." message-mark-insert-file | |
2301 ,@(if (featurep 'xemacs) '(t) | |
2302 '(:help "Insert file at point marked with enclosing tags"))] | |
2303 "----" | |
2304 ["Send Message" message-send-and-exit | |
2305 ,@(if (featurep 'xemacs) '(t) | |
2306 '(:help "Send this message"))] | |
2307 ["Postpone Message" message-dont-send | |
2308 ,@(if (featurep 'xemacs) '(t) | |
2309 '(:help "File this draft message and exit"))] | |
2310 ["Send at Specific Time..." gnus-delay-article | |
2311 ,@(if (featurep 'xemacs) '(t) | |
2312 '(:help "Ask, then arrange to send message at that time"))] | |
2313 ["Kill Message" message-kill-buffer | |
2314 ,@(if (featurep 'xemacs) '(t) | |
2315 '(:help "Delete this message without sending"))])) | |
17493 | 2316 |
2317 (easy-menu-define | |
88155 | 2318 message-mode-field-menu message-mode-map "" |
2319 `("Field" | |
2320 ["To" message-goto-to t] | |
2321 ["From" message-goto-from t] | |
2322 ["Subject" message-goto-subject t] | |
2323 ["Change subject..." message-change-subject t] | |
2324 ["Cc" message-goto-cc t] | |
2325 ["Bcc" message-goto-bcc t] | |
2326 ["Fcc" message-goto-fcc t] | |
2327 ["Reply-To" message-goto-reply-to t] | |
2328 ["Flag As Important" message-insert-importance-high | |
2329 ,@(if (featurep 'xemacs) '(t) | |
2330 '(:help "Mark this message as important"))] | |
2331 ["Flag As Unimportant" message-insert-importance-low | |
2332 ,@(if (featurep 'xemacs) '(t) | |
2333 '(:help "Mark this message as unimportant"))] | |
2334 ["Request Receipt" | |
2335 message-insert-disposition-notification-to | |
2336 ,@(if (featurep 'xemacs) '(t) | |
2337 '(:help "Request a receipt notification"))] | |
2338 "----" | |
2339 ;; (typical) news stuff | |
2340 ["Summary" message-goto-summary t] | |
2341 ["Keywords" message-goto-keywords t] | |
2342 ["Newsgroups" message-goto-newsgroups t] | |
2343 ["Fetch Newsgroups" message-insert-newsgroups t] | |
2344 ["Followup-To" message-goto-followup-to t] | |
2345 ;; ["Followup-To (with note in body)" message-cross-post-followup-to t] | |
2346 ["Crosspost / Followup-To..." message-cross-post-followup-to t] | |
2347 ["Distribution" message-goto-distribution t] | |
2348 ["X-No-Archive:" message-add-archive-header t ] | |
2349 "----" | |
2350 ;; (typical) mailing-lists stuff | |
2351 ["Fetch To" message-insert-to | |
2352 ,@(if (featurep 'xemacs) '(t) | |
2353 '(:help "Insert a To header that points to the author."))] | |
2354 ["Fetch To and Cc" message-insert-wide-reply | |
2355 ,@(if (featurep 'xemacs) '(t) | |
2356 '(:help | |
2357 "Insert To and Cc headers as if you were doing a wide reply."))] | |
2358 "----" | |
2359 ["Send to list only" message-to-list-only t] | |
2360 ["Mail-Followup-To" message-goto-mail-followup-to t] | |
2361 ["Unsubscribed list post" message-generate-unsubscribed-mail-followup-to | |
2362 ,@(if (featurep 'xemacs) '(t) | |
2363 '(:help "Insert a reasonable `Mail-Followup-To:' header."))] | |
2364 ["Reduce To: to Cc:" message-reduce-to-to-cc t] | |
2365 "----" | |
2366 ["Sort Headers" message-sort-headers t] | |
2367 ["Encode non-ASCII domain names" message-idna-to-ascii-rhs t] | |
2368 ["Goto Body" message-goto-body t] | |
2369 ["Goto Signature" message-goto-signature t])) | |
2370 | |
2371 (defvar message-tool-bar-map nil) | |
17493 | 2372 |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
2373 (eval-when-compile |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
2374 (defvar facemenu-add-face-function) |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
2375 (defvar facemenu-remove-face-function)) |
17493 | 2376 |
88155 | 2377 ;;; Forbidden properties |
2378 ;; | |
2379 ;; We use `after-change-functions' to keep special text properties | |
2380 ;; that interfer with the normal function of message mode out of the | |
2381 ;; buffer. | |
2382 | |
2383 (defcustom message-strip-special-text-properties t | |
2384 "Strip special properties from the message buffer. | |
2385 | |
2386 Emacs has a number of special text properties which can break message | |
2387 composing in various ways. If this option is set, message will strip | |
2388 these properties from the message composition buffer. However, some | |
2389 packages requires these properties to be present in order to work. | |
2390 If you use one of these packages, turn this option off, and hope the | |
2391 message composition doesn't break too bad." | |
2392 :version "22.1" | |
2393 :group 'message-various | |
2394 :link '(custom-manual "(message)Various Message Variables") | |
2395 :type 'boolean) | |
2396 | |
2397 (defconst message-forbidden-properties | |
2398 ;; No reason this should be clutter up customize. We make it a | |
2399 ;; property list (rather than a list of property symbols), to be | |
2400 ;; directly useful for `remove-text-properties'. | |
2401 '(field nil read-only nil invisible nil intangible nil | |
2402 mouse-face nil modification-hooks nil insert-in-front-hooks nil | |
2403 insert-behind-hooks nil point-entered nil point-left nil) | |
2404 ;; Other special properties: | |
2405 ;; category, face, display: probably doesn't do any harm. | |
2406 ;; fontified: is used by font-lock. | |
2407 ;; syntax-table, local-map: I dunno. | |
2408 ;; We need to add XEmacs names to the list. | |
2409 "Property list of with properties forbidden in message buffers. | |
2410 The values of the properties are ignored, only the property names are used.") | |
2411 | |
2412 (defun message-tamago-not-in-use-p (pos) | |
2413 "Return t when tamago version 4 is not in use at the cursor position. | |
2414 Tamago version 4 is a popular input method for writing Japanese text. | |
2415 It uses the properties `intangible', `invisible', `modification-hooks' | |
2416 and `read-only' when translating ascii or kana text to kanji text. | |
2417 These properties are essential to work, so we should never strip them." | |
2418 (not (and (boundp 'egg-modefull-mode) | |
2419 (symbol-value 'egg-modefull-mode) | |
2420 (or (memq (get-text-property pos 'intangible) | |
2421 '(its-part-1 its-part-2)) | |
2422 (get-text-property pos 'egg-end) | |
2423 (get-text-property pos 'egg-lang) | |
2424 (get-text-property pos 'egg-start))))) | |
2425 | |
2426 (defun message-strip-forbidden-properties (begin end &optional old-length) | |
2427 "Strip forbidden properties between BEGIN and END, ignoring the third arg. | |
2428 This function is intended to be called from `after-change-functions'. | |
2429 See also `message-forbidden-properties'." | |
2430 (when (and message-strip-special-text-properties | |
2431 (message-tamago-not-in-use-p begin)) | |
2432 (let ((buffer-read-only nil) | |
2433 (inhibit-read-only t)) | |
2434 (while (not (= begin end)) | |
2435 (when (not (get-text-property begin 'message-hidden)) | |
2436 (remove-text-properties begin (1+ begin) | |
2437 message-forbidden-properties)) | |
2438 (incf begin))))) | |
2439 | |
17493 | 2440 ;;;###autoload |
88155 | 2441 (define-derived-mode message-mode text-mode "Message" |
17493 | 2442 "Major mode for editing mail and news to be sent. |
35147 | 2443 Like Text Mode but with these additional commands:\\<message-mode-map> |
2444 C-c C-s `message-send' (send the message) C-c C-c `message-send-and-exit' | |
2445 C-c C-d Postpone sending the message C-c C-k Kill the message | |
17493 | 2446 C-c C-f move to a header field (and create it if there isn't): |
2447 C-c C-f C-t move to To C-c C-f C-s move to Subject | |
2448 C-c C-f C-c move to Cc C-c C-f C-b move to Bcc | |
2449 C-c C-f C-w move to Fcc C-c C-f C-r move to Reply-To | |
2450 C-c C-f C-u move to Summary C-c C-f C-n move to Newsgroups | |
2451 C-c C-f C-k move to Keywords C-c C-f C-d move to Distribution | |
88155 | 2452 C-c C-f C-o move to From (\"Originator\") |
17493 | 2453 C-c C-f C-f move to Followup-To |
88155 | 2454 C-c C-f C-m move to Mail-Followup-To |
2455 C-c C-f C-i cycle through Importance values | |
2456 C-c C-f s change subject and append \"(was: <Old Subject>)\" | |
2457 C-c C-f x crossposting with FollowUp-To header and note in body | |
2458 C-c C-f t replace To: header with contents of Cc: or Bcc: | |
2459 C-c C-f a Insert X-No-Archive: header and a note in the body | |
35147 | 2460 C-c C-t `message-insert-to' (add a To header to a news followup) |
88155 | 2461 C-c C-l `message-to-list-only' (removes all but list address in to/cc) |
35147 | 2462 C-c C-n `message-insert-newsgroups' (add a Newsgroup header to a news reply) |
2463 C-c C-b `message-goto-body' (move to beginning of message text). | |
2464 C-c C-i `message-goto-signature' (move to the beginning of the signature). | |
2465 C-c C-w `message-insert-signature' (insert `message-signature-file' file). | |
2466 C-c C-y `message-yank-original' (insert current message, if any). | |
2467 C-c C-q `message-fill-yanked-message' (fill what was yanked). | |
2468 C-c C-e `message-elide-region' (elide the text between point and mark). | |
2469 C-c C-v `message-delete-not-region' (remove the text outside the region). | |
2470 C-c C-z `message-kill-to-signature' (kill the text up to the signature). | |
2471 C-c C-r `message-caesar-buffer-body' (rot13 the message body). | |
2472 C-c C-a `mml-attach-file' (attach a file as MIME). | |
88155 | 2473 C-c C-u `message-insert-or-toggle-importance' (insert or cycle importance). |
2474 C-c M-n `message-insert-disposition-notification-to' (request receipt). | |
2475 C-c M-m `message-mark-inserted-region' (mark region with enclosing tags). | |
2476 C-c M-f `message-mark-insert-file' (insert file marked with enclosing tags). | |
35147 | 2477 M-RET `message-newline-and-reformat' (break the line and reformat)." |
88155 | 2478 (setq local-abbrev-table text-mode-abbrev-table) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2479 (set (make-local-variable 'message-reply-buffer) nil) |
88155 | 2480 (set (make-local-variable 'message-inserted-headers) nil) |
2481 (set (make-local-variable 'message-send-actions) nil) | |
2482 (set (make-local-variable 'message-exit-actions) nil) | |
2483 (set (make-local-variable 'message-kill-actions) nil) | |
2484 (set (make-local-variable 'message-postpone-actions) nil) | |
2485 (set (make-local-variable 'message-draft-article) nil) | |
17493 | 2486 (setq buffer-offer-save t) |
88155 | 2487 (set (make-local-variable 'facemenu-add-face-function) |
2488 (lambda (face end) | |
2489 (let ((face-fun (cdr (assq face message-face-alist)))) | |
2490 (if face-fun | |
2491 (funcall face-fun (point) end) | |
2492 (error "Face %s not configured for %s mode" face mode-name))) | |
2493 "")) | |
2494 (set (make-local-variable 'facemenu-remove-face-function) t) | |
2495 (set (make-local-variable 'message-reply-headers) nil) | |
17493 | 2496 (make-local-variable 'message-newsreader) |
2497 (make-local-variable 'message-mailer) | |
2498 (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
|
2499 (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
|
2500 (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
|
2501 (set (make-local-variable 'message-mime-part) 0) |
33436
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2502 (message-setup-fill-variables) |
34766 | 2503 ;; Allow using comment commands to add/remove quoting. |
88155 | 2504 ;; (set (make-local-variable 'comment-start) message-yank-prefix) |
2505 (when message-yank-prefix | |
2506 (set (make-local-variable 'comment-start) message-yank-prefix) | |
2507 (set (make-local-variable 'comment-start-skip) | |
2508 (concat "^" (regexp-quote message-yank-prefix) "[ \t]*"))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2509 (if (featurep 'xemacs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2510 (message-setup-toolbar) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2511 (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
|
2512 '(message-font-lock-keywords t)) |
88155 | 2513 (if (boundp 'tool-bar-map) |
2514 (set (make-local-variable 'tool-bar-map) (message-tool-bar-map)))) | |
17493 | 2515 (easy-menu-add message-mode-menu message-mode-map) |
2516 (easy-menu-add message-mode-field-menu message-mode-map) | |
88155 | 2517 (gnus-make-local-hook 'after-change-functions) |
2518 ;; Mmmm... Forbidden properties... | |
2519 (add-hook 'after-change-functions 'message-strip-forbidden-properties | |
2520 nil 'local) | |
17493 | 2521 ;; Allow mail alias things. |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2522 (when (eq message-mail-alias-type 'abbrev) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2523 (if (fboundp 'mail-abbrevs-setup) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2524 (mail-abbrevs-setup) |
88155 | 2525 (if (fboundp 'mail-aliases-setup) ; warning avoidance |
2526 (mail-aliases-setup)))) | |
44075
7782e54757bb
* mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
43075
diff
changeset
|
2527 (unless buffer-file-name |
7782e54757bb
* mail-source.el (make-source-make-complex-temp-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
43075
diff
changeset
|
2528 (message-set-auto-save-file-name)) |
88155 | 2529 (unless (buffer-base-buffer) |
2530 ;; Don't enable multibyte on an indirect buffer. Maybe enabling | |
2531 ;; multibyte is not necessary at all. -- zsh | |
2532 (mm-enable-multibyte)) | |
2533 (set (make-local-variable 'indent-tabs-mode) nil) ;No tabs for indentation. | |
2534 (mml-mode)) | |
17493 | 2535 |
33436
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2536 (defun message-setup-fill-variables () |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2537 "Setup message fill variables." |
88155 | 2538 (set (make-local-variable 'fill-paragraph-function) |
2539 'message-fill-paragraph) | |
33436
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2540 (make-local-variable 'paragraph-separate) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2541 (make-local-variable 'paragraph-start) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2542 (make-local-variable 'adaptive-fill-regexp) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2543 (unless (boundp 'adaptive-fill-first-line-regexp) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2544 (setq adaptive-fill-first-line-regexp nil)) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2545 (make-local-variable 'adaptive-fill-first-line-regexp) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2546 (let ((quote-prefix-regexp |
88155 | 2547 ;; User should change message-cite-prefix-regexp if |
2548 ;; message-yank-prefix is set to an abnormal value. | |
2549 (concat "\\(" message-cite-prefix-regexp "\\)[ \t]*"))) | |
33436
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2550 (setq paragraph-start |
88155 | 2551 (concat |
2552 (regexp-quote mail-header-separator) "$\\|" | |
2553 "[ \t]*$\\|" ; blank lines | |
2554 "-- $\\|" ; signature delimiter | |
2555 "---+$\\|" ; delimiters for forwarded messages | |
2556 page-delimiter "$\\|" ; spoiler warnings | |
2557 ".*wrote:$\\|" ; attribution lines | |
2558 quote-prefix-regexp "$\\|" ; empty lines in quoted text | |
2559 ; mml tags | |
2560 "<#!*/?\\(multipart\\|part\\|external\\|mml\\|secure\\)")) | |
33436
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2561 (setq paragraph-separate paragraph-start) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2562 (setq adaptive-fill-regexp |
88155 | 2563 (concat quote-prefix-regexp "\\|" adaptive-fill-regexp)) |
33436
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2564 (setq adaptive-fill-first-line-regexp |
88155 | 2565 (concat quote-prefix-regexp "\\|" |
2566 adaptive-fill-first-line-regexp))) | |
2567 (make-local-variable 'auto-fill-inhibit-regexp) | |
2568 ;;(setq auto-fill-inhibit-regexp "^[A-Z][^: \n\t]+:") | |
2569 (setq auto-fill-inhibit-regexp nil) | |
2570 (make-local-variable 'normal-auto-fill-function) | |
2571 (setq normal-auto-fill-function 'message-do-auto-fill) | |
2572 ;; KLUDGE: auto fill might already be turned on in `text-mode-hook'. | |
2573 ;; In that case, ensure that it uses the right function. The real | |
2574 ;; solution would be not to use `define-derived-mode', and run | |
2575 ;; `text-mode-hook' ourself at the end of the mode. | |
2576 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> Date: 2001-10-19. | |
2577 (when auto-fill-function | |
2578 (setq auto-fill-function normal-auto-fill-function))) | |
33436
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
2579 |
17493 | 2580 |
2581 | |
2582 ;;; | |
2583 ;;; Message mode commands | |
2584 ;;; | |
2585 | |
2586 ;;; Movement commands | |
2587 | |
2588 (defun message-goto-to () | |
2589 "Move point to the To header." | |
2590 (interactive) | |
2591 (message-position-on-field "To")) | |
2592 | |
88155 | 2593 (defun message-goto-from () |
2594 "Move point to the From header." | |
2595 (interactive) | |
2596 (message-position-on-field "From")) | |
2597 | |
17493 | 2598 (defun message-goto-subject () |
2599 "Move point to the Subject header." | |
2600 (interactive) | |
2601 (message-position-on-field "Subject")) | |
2602 | |
2603 (defun message-goto-cc () | |
2604 "Move point to the Cc header." | |
2605 (interactive) | |
2606 (message-position-on-field "Cc" "To")) | |
2607 | |
2608 (defun message-goto-bcc () | |
2609 "Move point to the Bcc header." | |
2610 (interactive) | |
2611 (message-position-on-field "Bcc" "Cc" "To")) | |
2612 | |
2613 (defun message-goto-fcc () | |
2614 "Move point to the Fcc header." | |
2615 (interactive) | |
2616 (message-position-on-field "Fcc" "To" "Newsgroups")) | |
2617 | |
2618 (defun message-goto-reply-to () | |
2619 "Move point to the Reply-To header." | |
2620 (interactive) | |
2621 (message-position-on-field "Reply-To" "Subject")) | |
2622 | |
2623 (defun message-goto-newsgroups () | |
2624 "Move point to the Newsgroups header." | |
2625 (interactive) | |
2626 (message-position-on-field "Newsgroups")) | |
2627 | |
2628 (defun message-goto-distribution () | |
2629 "Move point to the Distribution header." | |
2630 (interactive) | |
2631 (message-position-on-field "Distribution")) | |
2632 | |
2633 (defun message-goto-followup-to () | |
2634 "Move point to the Followup-To header." | |
2635 (interactive) | |
2636 (message-position-on-field "Followup-To" "Newsgroups")) | |
2637 | |
88155 | 2638 (defun message-goto-mail-followup-to () |
2639 "Move point to the Mail-Followup-To header." | |
2640 (interactive) | |
2641 (message-position-on-field "Mail-Followup-To" "To")) | |
2642 | |
17493 | 2643 (defun message-goto-keywords () |
2644 "Move point to the Keywords header." | |
2645 (interactive) | |
2646 (message-position-on-field "Keywords" "Subject")) | |
2647 | |
2648 (defun message-goto-summary () | |
2649 "Move point to the Summary header." | |
2650 (interactive) | |
2651 (message-position-on-field "Summary" "Subject")) | |
2652 | |
88155 | 2653 (defun message-goto-body (&optional interactivep) |
17493 | 2654 "Move point to the beginning of the message body." |
88155 | 2655 (interactive (list t)) |
2656 (when (and interactivep | |
2657 (looking-at "[ \t]*\n")) | |
2658 (expand-abbrev)) | |
17493 | 2659 (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
|
2660 (or (search-forward (concat "\n" mail-header-separator "\n") nil t) |
88155 | 2661 (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t))) |
17493 | 2662 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2663 (defun message-goto-eoh () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2664 "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
|
2665 (interactive) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2666 (message-goto-body) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2667 (forward-line -1)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2668 |
17493 | 2669 (defun message-goto-signature () |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2670 "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
|
2671 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
|
2672 return nil." |
17493 | 2673 (interactive) |
2674 (goto-char (point-min)) | |
2675 (if (re-search-forward message-signature-separator nil t) | |
2676 (forward-line 1) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2677 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2678 nil)) |
17493 | 2679 |
88155 | 2680 (defun message-generate-unsubscribed-mail-followup-to (&optional include-cc) |
2681 "Insert a reasonable MFT header in a post to an unsubscribed list. | |
2682 When making original posts to a mailing list you are not subscribed to, | |
2683 you have to type in a MFT header by hand. The contents, usually, are | |
2684 the addresses of the list and your own address. This function inserts | |
2685 such a header automatically. It fetches the contents of the To: header | |
2686 in the current mail buffer, and appends the current `user-mail-address'. | |
2687 | |
2688 If the optional argument INCLUDE-CC is non-nil, the addresses in the | |
2689 Cc: header are also put into the MFT." | |
2690 | |
2691 (interactive "P") | |
2692 (let* (cc tos) | |
2693 (save-restriction | |
2694 (message-narrow-to-headers) | |
2695 (message-remove-header "Mail-Followup-To") | |
2696 (setq cc (and include-cc (message-fetch-field "Cc"))) | |
2697 (setq tos (if cc | |
2698 (concat (message-fetch-field "To") "," cc) | |
2699 (message-fetch-field "To")))) | |
2700 (message-goto-mail-followup-to) | |
2701 (insert (concat tos ", " user-mail-address)))) | |
2702 | |
17493 | 2703 |
2704 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2705 (defun message-insert-to (&optional force) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2706 "Insert a To header that points to the author of the article being replied to. |
88155 | 2707 If the original author requested not to be sent mail, don't insert unless the |
2708 prefix FORCE is given." | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2709 (interactive "P") |
88155 | 2710 (let* ((mct (message-fetch-reply-field "mail-copies-to")) |
2711 (dont (and mct (or (equal (downcase mct) "never") | |
2712 (equal (downcase mct) "nobody")))) | |
2713 (to (or (message-fetch-reply-field "mail-reply-to") | |
2714 (message-fetch-reply-field "reply-to") | |
2715 (message-fetch-reply-field "from")))) | |
2716 (when (and dont to) | |
2717 (message | |
2718 (if force | |
2719 "Ignoring the user request not to have copies sent via mail" | |
2720 "Complying with the user request not to have copies sent via mail"))) | |
2721 (when (and force (not to)) | |
2722 (error "No mail address in the article")) | |
2723 (when (and to (or force (not dont))) | |
2724 (message-carefully-insert-headers (list (cons 'To to)))))) | |
2725 | |
2726 (defun message-insert-wide-reply () | |
2727 "Insert To and Cc headers as if you were doing a wide reply." | |
2728 (interactive) | |
2729 (let ((headers (message-with-reply-buffer | |
2730 (message-get-reply-headers t)))) | |
2731 (message-carefully-insert-headers headers))) | |
2732 | |
2733 (defcustom message-header-synonyms | |
2734 '((To Cc Bcc)) | |
2735 "List of lists of header synonyms. | |
2736 E.g., if this list contains a member list with elements `Cc' and `To', | |
2737 then `message-carefully-insert-headers' will not insert a `To' header | |
2738 when the message is already `Cc'ed to the recipient." | |
2739 :version "22.1" | |
2740 :group 'message-headers | |
2741 :link '(custom-manual "(message)Message Headers") | |
2742 :type '(repeat sexp)) | |
2743 | |
2744 (defun message-carefully-insert-headers (headers) | |
2745 "Insert the HEADERS, an alist, into the message buffer. | |
2746 Does not insert the headers when they are already present there | |
2747 or in the synonym headers, defined by `message-header-synonyms'." | |
2748 ;; FIXME: Should compare only the address and not the full name. Comparison | |
2749 ;; should be done case-folded (and with `string=' rather than | |
2750 ;; `string-match'). | |
2751 ;; (mail-strip-quoted-names "Foo Bar <foo@bar>, bla@fasel (Bla Fasel)") | |
2752 (dolist (header headers) | |
2753 (let* ((header-name (symbol-name (car header))) | |
2754 (new-header (cdr header)) | |
2755 (synonyms (loop for synonym in message-header-synonyms | |
2756 when (memq (car header) synonym) return synonym)) | |
2757 (old-header | |
2758 (loop for synonym in synonyms | |
2759 for old-header = (mail-fetch-field (symbol-name synonym)) | |
2760 when (and old-header (string-match new-header old-header)) | |
2761 return synonym))) | |
2762 (if old-header | |
2763 (message "already have `%s' in `%s'" new-header old-header) | |
2764 (when (and (message-position-on-field header-name) | |
2765 (setq old-header (mail-fetch-field header-name)) | |
2766 (not (string-match "\\` *\\'" old-header))) | |
2767 (insert ", ")) | |
2768 (insert new-header))))) | |
17493 | 2769 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2770 (defun message-widen-reply () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2771 "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
|
2772 (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2773 (let ((follow-to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2774 (and message-reply-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2775 (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
|
2776 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2777 (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
|
2778 (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
|
2779 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2780 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2781 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2782 (dolist (elem follow-to) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2783 (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
|
2784 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2785 (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
|
2786 (cdr elem) "\n")))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2787 |
17493 | 2788 (defun message-insert-newsgroups () |
2789 "Insert the Newsgroups header from the article being replied to." | |
2790 (interactive) | |
2791 (when (and (message-position-on-field "Newsgroups") | |
2792 (mail-fetch-field "newsgroups") | |
2793 (not (string-match "\\` *\\'" (mail-fetch-field "newsgroups")))) | |
2794 (insert ",")) | |
2795 (insert (or (message-fetch-reply-field "newsgroups") ""))) | |
2796 | |
2797 | |
2798 | |
2799 ;;; Various commands | |
2800 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2801 (defun message-delete-not-region (beg end) |
35147 | 2802 "Delete everything in the body of the current message outside of the region." |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2803 (interactive "r") |
88155 | 2804 (let (citeprefix) |
2805 (save-excursion | |
2806 (goto-char beg) | |
2807 ;; snarf citation prefix, if appropriate | |
2808 (unless (eq (point) (progn (beginning-of-line) (point))) | |
2809 (when (looking-at message-cite-prefix-regexp) | |
2810 (setq citeprefix (match-string 0)))) | |
2811 (goto-char end) | |
2812 (delete-region (point) (if (not (message-goto-signature)) | |
2813 (point) | |
2814 (forward-line -2) | |
2815 (point))) | |
2816 (insert "\n") | |
2817 (goto-char beg) | |
2818 (delete-region beg (progn (message-goto-body) | |
2819 (forward-line 2) | |
2820 (point))) | |
2821 (when citeprefix | |
2822 (insert citeprefix)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2823 (when (message-goto-signature) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2824 (forward-line -2))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2825 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2826 (defun message-kill-to-signature () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2827 "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
|
2828 (interactive) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2829 (let ((point (point))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2830 (message-goto-signature) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2831 (unless (eobp) |
88155 | 2832 (end-of-line -1)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2833 (kill-region point (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2834 (unless (bolp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2835 (insert "\n")))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2836 |
88155 | 2837 (defun message-newline-and-reformat (&optional arg not-break) |
2838 "Insert four newlines, and then reformat if inside quoted text. | |
2839 Prefix arg means justify as well." | |
2840 (interactive (list (if current-prefix-arg 'full))) | |
2841 (let (quoted point beg end leading-space bolp) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2842 (setq point (point)) |
88155 | 2843 (beginning-of-line) |
2844 (setq beg (point)) | |
2845 (setq bolp (= beg point)) | |
2846 ;; Find first line of the paragraph. | |
2847 (if not-break | |
2848 (while (and (not (eobp)) | |
2849 (not (looking-at message-cite-prefix-regexp)) | |
2850 (looking-at paragraph-start)) | |
2851 (forward-line 1))) | |
2852 ;; Find the prefix | |
2853 (when (looking-at message-cite-prefix-regexp) | |
2854 (setq quoted (match-string 0)) | |
2855 (goto-char (match-end 0)) | |
2856 (looking-at "[ \t]*") | |
2857 (setq leading-space (match-string 0))) | |
2858 (if (and quoted | |
2859 (not not-break) | |
2860 (not bolp) | |
2861 (< (- point beg) (length quoted))) | |
2862 ;; break inside the cite prefix. | |
2863 (setq quoted nil | |
2864 end nil)) | |
2865 (if quoted | |
2866 (progn | |
2867 (forward-line 1) | |
2868 (while (and (not (eobp)) | |
2869 (not (looking-at paragraph-separate)) | |
2870 (looking-at message-cite-prefix-regexp) | |
2871 (equal quoted (match-string 0))) | |
2872 (goto-char (match-end 0)) | |
2873 (looking-at "[ \t]*") | |
2874 (if (> (length leading-space) (length (match-string 0))) | |
2875 (setq leading-space (match-string 0))) | |
2876 (forward-line 1)) | |
2877 (setq end (point)) | |
2878 (goto-char beg) | |
2879 (while (and (if (bobp) nil (forward-line -1) t) | |
2880 (not (looking-at paragraph-start)) | |
2881 (looking-at message-cite-prefix-regexp) | |
2882 (equal quoted (match-string 0))) | |
2883 (setq beg (point)) | |
2884 (goto-char (match-end 0)) | |
2885 (looking-at "[ \t]*") | |
2886 (if (> (length leading-space) (length (match-string 0))) | |
2887 (setq leading-space (match-string 0))))) | |
2888 (while (and (not (eobp)) | |
2889 (not (looking-at paragraph-separate)) | |
2890 (not (looking-at message-cite-prefix-regexp))) | |
2891 (forward-line 1)) | |
2892 (setq end (point)) | |
2893 (goto-char beg) | |
2894 (while (and (if (bobp) nil (forward-line -1) t) | |
2895 (not (looking-at paragraph-start)) | |
2896 (not (looking-at message-cite-prefix-regexp))) | |
2897 (setq beg (point)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2898 (goto-char point) |
88155 | 2899 (save-restriction |
2900 (narrow-to-region beg end) | |
2901 (if not-break | |
2902 (setq point nil) | |
2903 (if bolp | |
2904 (newline) | |
2905 (newline) | |
2906 (newline)) | |
2907 (setq point (point)) | |
2908 ;; (newline 2) doesn't mark both newline's as hard, so call | |
2909 ;; newline twice. -jas | |
2910 (newline) | |
2911 (newline) | |
2912 (delete-region (point) (re-search-forward "[ \t]*")) | |
2913 (when (and quoted (not bolp)) | |
2914 (insert quoted leading-space))) | |
2915 (undo-boundary) | |
2916 (if quoted | |
2917 (let* ((adaptive-fill-regexp | |
2918 (regexp-quote (concat quoted leading-space))) | |
2919 (adaptive-fill-first-line-regexp | |
2920 adaptive-fill-regexp )) | |
2921 (fill-paragraph arg)) | |
2922 (fill-paragraph arg)) | |
2923 (if point (goto-char point))))) | |
2924 | |
2925 (defun message-fill-paragraph (&optional arg) | |
2926 "Like `fill-paragraph'." | |
2927 (interactive (list (if current-prefix-arg 'full))) | |
2928 (if (if (boundp 'filladapt-mode) filladapt-mode) | |
2929 nil | |
2930 (message-newline-and-reformat arg t) | |
2931 t)) | |
2932 | |
2933 ;; Is it better to use `mail-header-end'? | |
2934 (defun message-point-in-header-p () | |
2935 "Return t if point is in the header." | |
2936 (save-excursion | |
2937 (let ((p (point))) | |
2938 (goto-char (point-min)) | |
2939 (not (re-search-forward | |
2940 (concat "^" (regexp-quote mail-header-separator) "\n") | |
2941 p t))))) | |
2942 | |
2943 (defun message-do-auto-fill () | |
2944 "Like `do-auto-fill', but don't fill in message header." | |
2945 (unless (message-point-in-header-p) | |
2946 (do-auto-fill))) | |
49034
b6e082e00b00
(message-split-line): New function.
Kim F. Storm <storm@cua.dk>
parents:
48588
diff
changeset
|
2947 |
17493 | 2948 (defun message-insert-signature (&optional force) |
35147 | 2949 "Insert a signature. See documentation for variable `message-signature'." |
17493 | 2950 (interactive (list 0)) |
2951 (let* ((signature | |
2952 (cond | |
2953 ((and (null message-signature) | |
2954 (eq force 0)) | |
2955 (save-excursion | |
2956 (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
|
2957 (not (re-search-backward message-signature-separator nil t)))) |
17493 | 2958 ((and (null message-signature) |
2959 force) | |
2960 t) | |
88155 | 2961 ((functionp message-signature) |
17493 | 2962 (funcall message-signature)) |
2963 ((listp message-signature) | |
2964 (eval message-signature)) | |
2965 (t message-signature))) | |
2966 (signature | |
2967 (cond ((stringp signature) | |
2968 signature) | |
2969 ((and (eq t signature) | |
2970 message-signature-file | |
2971 (file-exists-p message-signature-file)) | |
2972 signature)))) | |
2973 (when signature | |
2974 (goto-char (point-max)) | |
2975 ;; Insert the signature. | |
2976 (unless (bolp) | |
2977 (insert "\n")) | |
88155 | 2978 (when message-signature-insert-empty-line |
2979 (insert "\n")) | |
2980 (insert "-- \n") | |
17493 | 2981 (if (eq signature t) |
2982 (insert-file-contents message-signature-file) | |
2983 (insert signature)) | |
2984 (goto-char (point-max)) | |
2985 (or (bolp) (insert "\n"))))) | |
2986 | |
88155 | 2987 (defun message-insert-importance-high () |
2988 "Insert header to mark message as important." | |
2989 (interactive) | |
2990 (save-excursion | |
2991 (save-restriction | |
2992 (message-narrow-to-headers) | |
2993 (message-remove-header "Importance")) | |
2994 (message-goto-eoh) | |
2995 (insert "Importance: high\n"))) | |
2996 | |
2997 (defun message-insert-importance-low () | |
2998 "Insert header to mark message as unimportant." | |
2999 (interactive) | |
3000 (save-excursion | |
3001 (save-restriction | |
3002 (message-narrow-to-headers) | |
3003 (message-remove-header "Importance")) | |
3004 (message-goto-eoh) | |
3005 (insert "Importance: low\n"))) | |
3006 | |
3007 (defun message-insert-or-toggle-importance () | |
3008 "Insert a \"Importance: high\" header, or cycle through the header values. | |
3009 The three allowed values according to RFC 1327 are `high', `normal' | |
3010 and `low'." | |
3011 (interactive) | |
3012 (save-excursion | |
3013 (let ((valid '("high" "normal" "low")) | |
3014 (new "high") | |
3015 cur) | |
3016 (save-restriction | |
3017 (message-narrow-to-headers) | |
3018 (when (setq cur (message-fetch-field "Importance")) | |
3019 (message-remove-header "Importance") | |
3020 (setq new (cond ((string= cur "high") | |
3021 "low") | |
3022 ((string= cur "low") | |
3023 "normal") | |
3024 (t | |
3025 "high"))))) | |
3026 (message-goto-eoh) | |
3027 (insert (format "Importance: %s\n" new))))) | |
3028 | |
3029 (defun message-insert-disposition-notification-to () | |
3030 "Request a disposition notification (return receipt) to this message. | |
3031 Note that this should not be used in newsgroups." | |
3032 (interactive) | |
3033 (save-excursion | |
3034 (save-restriction | |
3035 (message-narrow-to-headers) | |
3036 (message-remove-header "Disposition-Notification-To")) | |
3037 (message-goto-eoh) | |
3038 (insert (format "Disposition-Notification-To: %s\n" | |
3039 (or (message-field-value "Reply-to") | |
3040 (message-field-value "From") | |
3041 (message-make-from)))))) | |
3042 | |
17493 | 3043 (defun message-elide-region (b e) |
35147 | 3044 "Elide the text in the region. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3045 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
|
3046 text was killed." |
17493 | 3047 (interactive "r") |
3048 (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
|
3049 (insert message-elide-ellipsis)) |
17493 | 3050 |
3051 (defvar message-caesar-translation-table nil) | |
3052 | |
3053 (defun message-caesar-region (b e &optional n) | |
35147 | 3054 "Caesar rotate region B to E by N, default 13, for decrypting netnews." |
17493 | 3055 (interactive |
3056 (list | |
3057 (min (point) (or (mark t) (point))) | |
3058 (max (point) (or (mark t) (point))) | |
3059 (when current-prefix-arg | |
3060 (prefix-numeric-value current-prefix-arg)))) | |
3061 | |
3062 (setq n (if (numberp n) (mod n 26) 13)) ;canonize N | |
88155 | 3063 (unless (or (zerop n) ; no action needed for a rot of 0 |
17493 | 3064 (= b e)) ; no region to rotate |
3065 ;; We build the table, if necessary. | |
3066 (when (or (not message-caesar-translation-table) | |
3067 (/= (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
|
3068 (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
|
3069 (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
|
3070 (translate-region b e message-caesar-translation-table))) |
17493 | 3071 |
3072 (defun message-make-caesar-translation-table (n) | |
3073 "Create a rot table with offset N." | |
3074 (let ((i -1) | |
3075 (table (make-string 256 0))) | |
3076 (while (< (incf i) 256) | |
3077 (aset table i i)) | |
3078 (concat | |
3079 (substring table 0 ?A) | |
3080 (substring table (+ ?A n) (+ ?A n (- 26 n))) | |
3081 (substring table ?A (+ ?A n)) | |
3082 (substring table (+ ?A 26) ?a) | |
3083 (substring table (+ ?a n) (+ ?a n (- 26 n))) | |
3084 (substring table ?a (+ ?a n)) | |
3085 (substring table (+ ?a 26) 255)))) | |
3086 | |
3087 (defun message-caesar-buffer-body (&optional rotnum) | |
35147 | 3088 "Caesar rotate all letters in the current buffer by 13 places. |
3089 Used to encode/decode possibly offensive messages (commonly in rec.humor). | |
17493 | 3090 With prefix arg, specifies the number of places to rotate each letter forward. |
3091 Mail and USENET news headers are not rotated." | |
3092 (interactive (if current-prefix-arg | |
3093 (list (prefix-numeric-value current-prefix-arg)) | |
3094 (list nil))) | |
3095 (save-excursion | |
3096 (save-restriction | |
3097 (when (message-goto-body) | |
3098 (narrow-to-region (point) (point-max))) | |
3099 (message-caesar-region (point-min) (point-max) rotnum)))) | |
3100 | |
3101 (defun message-pipe-buffer-body (program) | |
3102 "Pipe the message body in the current buffer through PROGRAM." | |
3103 (save-excursion | |
3104 (save-restriction | |
3105 (when (message-goto-body) | |
88155 | 3106 (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
|
3107 (shell-command-on-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3108 (point-min) (point-max) program nil t)))) |
17493 | 3109 |
3110 (defun message-rename-buffer (&optional enter-string) | |
3111 "Rename the *message* buffer to \"*message* RECIPIENT\". | |
3112 If the function is run with a prefix, it will ask for a new buffer | |
3113 name, rather than giving an automatic name." | |
3114 (interactive "Pbuffer name: ") | |
3115 (save-excursion | |
3116 (save-restriction | |
3117 (goto-char (point-min)) | |
3118 (narrow-to-region (point) | |
3119 (search-forward mail-header-separator nil 'end)) | |
3120 (let* ((mail-to (or | |
3121 (if (message-news-p) (message-fetch-field "Newsgroups") | |
3122 (message-fetch-field "To")) | |
3123 "")) | |
3124 (mail-trimmed-to | |
3125 (if (string-match "," mail-to) | |
3126 (concat (substring mail-to 0 (match-beginning 0)) ", ...") | |
3127 mail-to)) | |
3128 (name-default (concat "*message* " mail-trimmed-to)) | |
3129 (name (if enter-string | |
3130 (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
|
3131 name-default))) |
17493 | 3132 (rename-buffer name t))))) |
3133 | |
3134 (defun message-fill-yanked-message (&optional justifyp) | |
3135 "Fill the paragraphs of a message yanked into this one. | |
3136 Numeric argument means justify as well." | |
3137 (interactive "P") | |
3138 (save-excursion | |
3139 (goto-char (point-min)) | |
3140 (search-forward (concat "\n" mail-header-separator "\n") nil t) | |
3141 (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
|
3142 (fill-individual-paragraphs (point) (point-max) justifyp)))) |
17493 | 3143 |
3144 (defun message-indent-citation () | |
3145 "Modify text just inserted from a message to be cited. | |
3146 The inserted text should be the region. | |
3147 When this function returns, the region is again around the modified text. | |
3148 | |
3149 Normally, indent each nonblank line `message-indentation-spaces' spaces. | |
3150 However, if `message-yank-prefix' is non-nil, insert that prefix on each line." | |
3151 (let ((start (point))) | |
3152 ;; Remove unwanted headers. | |
3153 (when message-ignored-cited-headers | |
3154 (let (all-removed) | |
3155 (save-restriction | |
3156 (narrow-to-region | |
3157 (goto-char start) | |
3158 (if (search-forward "\n\n" nil t) | |
3159 (1- (point)) | |
3160 (point))) | |
3161 (message-remove-header message-ignored-cited-headers t) | |
3162 (when (= (point-min) (point-max)) | |
3163 (setq all-removed t)) | |
3164 (goto-char (point-max))) | |
3165 (if all-removed | |
3166 (goto-char start) | |
3167 (forward-line 1)))) | |
3168 ;; Delete blank lines at the start of the buffer. | |
3169 (while (and (point-min) | |
3170 (eolp) | |
3171 (not (eobp))) | |
3172 (message-delete-line)) | |
3173 ;; Delete blank lines at the end of the buffer. | |
3174 (goto-char (point-max)) | |
3175 (unless (eolp) | |
3176 (insert "\n")) | |
3177 (while (and (zerop (forward-line -1)) | |
3178 (looking-at "$")) | |
3179 (message-delete-line)) | |
3180 ;; Do the indentation. | |
3181 (if (null message-yank-prefix) | |
3182 (indent-rigidly start (mark t) message-indentation-spaces) | |
3183 (save-excursion | |
3184 (goto-char start) | |
3185 (while (< (point) (mark t)) | |
88155 | 3186 (if (or (looking-at ">") (looking-at "^$")) |
3187 (insert message-yank-cited-prefix) | |
3188 (insert message-yank-prefix)) | |
17493 | 3189 (forward-line 1)))) |
3190 (goto-char start))) | |
3191 | |
3192 (defun message-yank-original (&optional arg) | |
3193 "Insert the message being replied to, if any. | |
3194 Puts point before the text and mark after. | |
3195 Normally indents each nonblank line ARG spaces (default 3). However, | |
3196 if `message-yank-prefix' is non-nil, insert that prefix on each line. | |
3197 | |
3198 This function uses `message-cite-function' to do the actual citing. | |
3199 | |
3200 Just \\[universal-argument] as argument means don't indent, insert no | |
3201 prefix, and don't delete any headers." | |
3202 (interactive "P") | |
3203 (let ((modified (buffer-modified-p))) | |
3204 (when (and message-reply-buffer | |
3205 message-cite-function) | |
3206 (delete-windows-on message-reply-buffer t) | |
88155 | 3207 (push-mark (save-excursion |
3208 (insert-buffer-substring message-reply-buffer) | |
3209 (point))) | |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
3210 (unless arg |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
3211 (funcall message-cite-function)) |
17493 | 3212 (message-exchange-point-and-mark) |
3213 (unless (bolp) | |
3214 (insert ?\n)) | |
3215 (unless modified | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3216 (setq message-checksum (message-checksum)))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3217 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3218 (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
|
3219 "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
|
3220 (interactive "bYank buffer: ") |
88155 | 3221 (let ((message-reply-buffer (get-buffer buffer))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3222 (save-window-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3223 (message-yank-original)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3224 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3225 (defun message-buffers () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3226 "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
|
3227 (let (buffers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3228 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3229 (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
|
3230 (set-buffer buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3231 (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
|
3232 (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
|
3233 (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
|
3234 (nreverse buffers))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3235 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3236 (defun message-cite-original-without-signature () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3237 "Cite function in the standard Message manner." |
88155 | 3238 (let* ((start (point)) |
3239 (end (mark t)) | |
3240 (functions | |
3241 (when message-indent-citation-function | |
3242 (if (listp message-indent-citation-function) | |
3243 message-indent-citation-function | |
3244 (list message-indent-citation-function)))) | |
3245 ;; This function may be called by `gnus-summary-yank-message' and | |
3246 ;; may insert a different article from the original. So, we will | |
3247 ;; modify the value of `message-reply-headers' with that article. | |
3248 (message-reply-headers | |
3249 (save-restriction | |
3250 (narrow-to-region start end) | |
3251 (message-narrow-to-head-1) | |
3252 (vector 0 | |
3253 (or (message-fetch-field "subject") "none") | |
3254 (message-fetch-field "from") | |
3255 (message-fetch-field "date") | |
3256 (message-fetch-field "message-id" t) | |
3257 (message-fetch-field "references") | |
3258 0 0 "")))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3259 (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
|
3260 ;; Allow undoing. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3261 (undo-boundary) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3262 (goto-char end) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3263 (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
|
3264 ;; 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
|
3265 (forward-line -1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3266 (while (looking-at "^[ \t]*$") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3267 (forward-line -1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3268 (forward-line 1) |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
3269 (delete-region (point) end) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
3270 (unless (search-backward "\n\n" start t) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
3271 ;; Insert a blank line if it is peeled off. |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
3272 (insert "\n"))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3273 (goto-char start) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3274 (while functions |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3275 (funcall (pop functions))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3276 (when message-citation-line-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3277 (unless (bolp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3278 (insert "\n")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3279 (funcall message-citation-line-function)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3280 |
88155 | 3281 (eval-when-compile (defvar mail-citation-hook)) ;Compiler directive |
17493 | 3282 (defun message-cite-original () |
3283 "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
|
3284 (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
|
3285 mail-citation-hook) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
3286 (run-hooks 'mail-citation-hook) |
88155 | 3287 (let* ((start (point)) |
3288 (end (mark t)) | |
3289 (functions | |
3290 (when message-indent-citation-function | |
3291 (if (listp message-indent-citation-function) | |
3292 message-indent-citation-function | |
3293 (list message-indent-citation-function)))) | |
3294 ;; This function may be called by `gnus-summary-yank-message' and | |
3295 ;; may insert a different article from the original. So, we will | |
3296 ;; modify the value of `message-reply-headers' with that article. | |
3297 (message-reply-headers | |
3298 (save-restriction | |
3299 (narrow-to-region start end) | |
3300 (message-narrow-to-head-1) | |
3301 (vector 0 | |
3302 (or (message-fetch-field "subject") "none") | |
3303 (message-fetch-field "from") | |
3304 (message-fetch-field "date") | |
3305 (message-fetch-field "message-id" t) | |
3306 (message-fetch-field "references") | |
3307 0 0 "")))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3308 (mml-quote-region start end) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
3309 (goto-char start) |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
3310 (while functions |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3311 (funcall (pop functions))) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
3312 (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
|
3313 (unless (bolp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3314 (insert "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3315 (funcall message-citation-line-function))))) |
17493 | 3316 |
3317 (defun message-insert-citation-line () | |
35147 | 3318 "Insert a simple citation line." |
17493 | 3319 (when message-reply-headers |
88155 | 3320 (insert (mail-header-from message-reply-headers) " writes:") |
3321 (newline) | |
3322 (newline))) | |
17493 | 3323 |
3324 (defun message-position-on-field (header &rest afters) | |
3325 (let ((case-fold-search t)) | |
3326 (save-restriction | |
3327 (narrow-to-region | |
3328 (goto-char (point-min)) | |
3329 (progn | |
3330 (re-search-forward | |
3331 (concat "^" (regexp-quote mail-header-separator) "$")) | |
3332 (match-beginning 0))) | |
3333 (goto-char (point-min)) | |
3334 (if (re-search-forward (concat "^" (regexp-quote header) ":") nil t) | |
3335 (progn | |
3336 (re-search-forward "^[^ \t]" nil 'move) | |
3337 (beginning-of-line) | |
3338 (skip-chars-backward "\n") | |
3339 t) | |
3340 (while (and afters | |
3341 (not (re-search-forward | |
3342 (concat "^" (regexp-quote (car afters)) ":") | |
3343 nil t))) | |
3344 (pop afters)) | |
3345 (when afters | |
3346 (re-search-forward "^[^ \t]" nil 'move) | |
3347 (beginning-of-line)) | |
3348 (insert header ": \n") | |
3349 (forward-char -1) | |
3350 nil)))) | |
3351 | |
3352 (defun message-remove-signature () | |
3353 "Remove the signature from the text between point and mark. | |
3354 The text will also be indented the normal way." | |
3355 (save-excursion | |
3356 (let ((start (point)) | |
3357 mark) | |
3358 (if (not (re-search-forward message-signature-separator (mark t) t)) | |
3359 ;; No signature here, so we just indent the cited text. | |
3360 (message-indent-citation) | |
3361 ;; Find the last non-empty line. | |
3362 (forward-line -1) | |
3363 (while (looking-at "[ \t]*$") | |
3364 (forward-line -1)) | |
3365 (forward-line 1) | |
3366 (setq mark (set-marker (make-marker) (point))) | |
3367 (goto-char start) | |
3368 (message-indent-citation) | |
3369 ;; Enable undoing the deletion. | |
3370 (undo-boundary) | |
3371 (delete-region mark (mark t)) | |
3372 (set-marker mark nil))))) | |
3373 | |
3374 | |
3375 | |
3376 ;;; | |
3377 ;;; Sending messages | |
3378 ;;; | |
3379 | |
3380 (defun message-send-and-exit (&optional arg) | |
3381 "Send message like `message-send', then, if no errors, exit from mail buffer." | |
3382 (interactive "P") | |
3383 (let ((buf (current-buffer)) | |
3384 (actions message-exit-actions)) | |
3385 (when (and (message-send arg) | |
3386 (buffer-name buf)) | |
3387 (if message-kill-buffer-on-exit | |
3388 (kill-buffer buf) | |
3389 (bury-buffer buf) | |
3390 (when (eq buf (current-buffer)) | |
3391 (message-bury buf))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3392 (message-do-actions actions) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3393 t))) |
17493 | 3394 |
3395 (defun message-dont-send () | |
88155 | 3396 "Don't send the message you have been editing. |
3397 Instead, just auto-save the buffer and then bury it." | |
17493 | 3398 (interactive) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3399 (set-buffer-modified-p t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3400 (save-buffer) |
17493 | 3401 (let ((actions message-postpone-actions)) |
3402 (message-bury (current-buffer)) | |
3403 (message-do-actions actions))) | |
3404 | |
3405 (defun message-kill-buffer () | |
3406 "Kill the current buffer." | |
3407 (interactive) | |
3408 (when (or (not (buffer-modified-p)) | |
3409 (yes-or-no-p "Message modified; kill anyway? ")) | |
88155 | 3410 (let ((actions message-kill-actions) |
3411 (draft-article message-draft-article) | |
3412 (auto-save-file-name buffer-auto-save-file-name) | |
3413 (file-name buffer-file-name) | |
3414 (modified (buffer-modified-p))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3415 (setq buffer-file-name nil) |
17493 | 3416 (kill-buffer (current-buffer)) |
88155 | 3417 (when (and (or (and auto-save-file-name |
3418 (file-exists-p auto-save-file-name)) | |
3419 (and file-name | |
3420 (file-exists-p file-name))) | |
3421 (progn | |
3422 ;; If the message buffer has lived in a dedicated window, | |
3423 ;; `kill-buffer' has killed the frame. Thus the | |
3424 ;; `yes-or-no-p' may show up in a lowered frame. Make sure | |
3425 ;; that the user can see the question by raising the | |
3426 ;; current frame: | |
3427 (raise-frame) | |
3428 (yes-or-no-p (format "Remove the backup file%s? " | |
3429 (if modified " too" ""))))) | |
3430 (ignore-errors | |
3431 (delete-file auto-save-file-name)) | |
3432 (let ((message-draft-article draft-article)) | |
3433 (message-disassociate-draft))) | |
17493 | 3434 (message-do-actions actions)))) |
3435 | |
3436 (defun message-bury (buffer) | |
35147 | 3437 "Bury this mail BUFFER." |
17493 | 3438 (let ((newbuf (other-buffer buffer))) |
3439 (bury-buffer buffer) | |
88155 | 3440 (if (and (window-dedicated-p (selected-window)) |
17493 | 3441 (not (null (delq (selected-frame) (visible-frame-list))))) |
3442 (delete-frame (selected-frame)) | |
3443 (switch-to-buffer newbuf)))) | |
3444 | |
3445 (defun message-send (&optional arg) | |
3446 "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
|
3447 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
|
3448 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
|
3449 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
|
3450 the mailer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3451 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
|
3452 It should typically alter the sending method in some way or other." |
17493 | 3453 (interactive "P") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3454 ;; 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
|
3455 (undo-boundary) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3456 (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
|
3457 (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
|
3458 (message-fix-before-sending) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3459 (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
|
3460 (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
|
3461 (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
|
3462 (success t) |
88155 | 3463 elem sent dont-barf-on-no-method |
3464 (message-options message-options)) | |
3465 (message-options-set-recipient) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3466 (while (and success |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3467 (setq elem (pop alist))) |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3468 (when (funcall (cadr elem)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3469 (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
|
3470 message-sent-message-via)) |
88155 | 3471 (message-fetch-field "supersedes") |
3472 (if (or (message-gnksa-enable-p 'multiple-copies) | |
3473 (not (eq (car elem) 'news))) | |
3474 (y-or-n-p | |
3475 (format | |
3476 "Already sent message via %s; resend? " | |
3477 (car elem))) | |
3478 (error "Denied posting -- multiple copies"))) | |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3479 (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
|
3480 (setq sent t)))) |
88155 | 3481 (unless (or sent |
3482 (not success) | |
3483 (let ((fcc (message-fetch-field "Fcc")) | |
3484 (gcc (message-fetch-field "Gcc"))) | |
3485 (when (or fcc gcc) | |
3486 (or (eq message-allow-no-recipients 'always) | |
3487 (and (not (eq message-allow-no-recipients 'never)) | |
3488 (setq dont-barf-on-no-method | |
3489 (gnus-y-or-n-p | |
3490 (format "No receiver, perform %s anyway? " | |
3491 (cond ((and fcc gcc) "Fcc and Gcc") | |
3492 (fcc "Fcc") | |
3493 (t "Gcc")))))))))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3494 (error "No methods specified to send by")) |
88155 | 3495 (when (or dont-barf-on-no-method |
3496 (and success sent)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3497 (message-do-fcc) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3498 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3499 (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
|
3500 (message "Sending...done") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3501 ;; 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
|
3502 (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
|
3503 (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
|
3504 (message-disassociate-draft) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3505 ;; 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
|
3506 (message-do-send-housekeeping) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3507 (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
|
3508 ;; Return success. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3509 t))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3510 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3511 (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
|
3512 "Send the current message via mail." |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3513 (message-send-mail arg)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3514 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3515 (defun message-send-via-news (arg) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3516 "Send the current message via news." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3517 (funcall message-send-news-function arg)) |
17493 | 3518 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3519 (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
|
3520 "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
|
3521 `(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
|
3522 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3523 ,@forms))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3524 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3525 (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
|
3526 (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
|
3527 |
88155 | 3528 (defun message-text-with-property (prop) |
3529 "Return a list of all points where the text has PROP." | |
3530 (let ((points nil) | |
3531 (point (point-min))) | |
3532 (save-excursion | |
3533 (while (< point (point-max)) | |
3534 (when (get-text-property point prop) | |
3535 (push point points)) | |
3536 (incf point))) | |
3537 (nreverse points))) | |
3538 | |
17493 | 3539 (defun message-fix-before-sending () |
3540 "Do various things to make the message nice before sending it." | |
3541 ;; Make sure there's a newline at the end of the message. | |
3542 (goto-char (point-max)) | |
3543 (unless (bolp) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3544 (insert "\n")) |
88155 | 3545 ;; Make the hidden headers visible. |
3546 (let ((points (message-text-with-property 'message-hidden))) | |
3547 (when points | |
3548 (goto-char (car points)) | |
3549 (dolist (point points) | |
3550 (add-text-properties point (1+ point) | |
3551 '(invisible nil intangible nil))))) | |
3552 ;; Make invisible text visible. | |
3553 ;; It doesn't seem as if this is useful, since the invisible property | |
3554 ;; is clobbered by an after-change hook anyhow. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3555 (message-check 'invisible-text |
88155 | 3556 (let ((points (message-text-with-property 'invisible))) |
3557 (when points | |
3558 (goto-char (car points)) | |
3559 (dolist (point points) | |
3560 (put-text-property point (1+ point) 'invisible nil) | |
3561 (message-overlay-put (message-make-overlay point (1+ point)) | |
3562 'face 'highlight)) | |
3563 (unless (yes-or-no-p | |
3564 "Invisible text found and made visible; continue sending? ") | |
3565 (error "Invisible text found and made visible"))))) | |
3566 (message-check 'illegible-text | |
3567 (let (found choice) | |
3568 (message-goto-body) | |
3569 (skip-chars-forward mm-7bit-chars) | |
3570 (while (not (eobp)) | |
3571 (when (let ((char (char-after))) | |
3572 (or (< (mm-char-int char) 128) | |
3573 (and (mm-multibyte-p) | |
3574 (memq (char-charset char) | |
3575 '(eight-bit-control eight-bit-graphic | |
3576 control-1)) | |
3577 (not (get-text-property | |
3578 (point) 'untranslated-utf-8))))) | |
3579 (message-overlay-put (message-make-overlay (point) (1+ (point))) | |
3580 'face 'highlight) | |
3581 (setq found t)) | |
3582 (forward-char) | |
3583 (skip-chars-forward mm-7bit-chars)) | |
3584 (when found | |
3585 (setq choice | |
3586 (gnus-multiple-choice | |
3587 "Non-printable characters found. Continue sending?" | |
3588 '((?d "Remove non-printable characters and send") | |
3589 (?r "Replace non-printable characters with dots and send") | |
3590 (?i "Ignore non-printable characters and send") | |
3591 (?e "Continue editing")))) | |
3592 (if (eq choice ?e) | |
3593 (error "Non-printable characters")) | |
3594 (message-goto-body) | |
3595 (skip-chars-forward mm-7bit-chars) | |
3596 (while (not (eobp)) | |
3597 (when (let ((char (char-after))) | |
3598 (or (< (mm-char-int char) 128) | |
3599 (and (mm-multibyte-p) | |
3600 ;; Fixme: Wrong for Emacs 22 and for things | |
3601 ;; like undecable utf-8. Should at least | |
3602 ;; use find-coding-systems-region. | |
3603 (memq (char-charset char) | |
3604 '(eight-bit-control eight-bit-graphic | |
3605 control-1)) | |
3606 (not (get-text-property | |
3607 (point) 'untranslated-utf-8))))) | |
3608 (if (eq choice ?i) | |
3609 (message-kill-all-overlays) | |
3610 (delete-char 1) | |
3611 (when (eq choice ?r) | |
3612 (insert ".")))) | |
3613 (forward-char) | |
3614 (skip-chars-forward mm-7bit-chars)))))) | |
17493 | 3615 |
3616 (defun message-add-action (action &rest types) | |
3617 "Add ACTION to be performed when doing an exit of type TYPES." | |
88155 | 3618 (while types |
3619 (add-to-list (intern (format "message-%s-actions" (pop types))) | |
3620 action))) | |
3621 | |
3622 (defun message-delete-action (action &rest types) | |
3623 "Delete ACTION from lists of actions performed when doing an exit of type TYPES." | |
17493 | 3624 (let (var) |
3625 (while types | |
3626 (set (setq var (intern (format "message-%s-actions" (pop types)))) | |
88155 | 3627 (delq action (symbol-value var)))))) |
17493 | 3628 |
3629 (defun message-do-actions (actions) | |
3630 "Perform all actions in ACTIONS." | |
3631 ;; Now perform actions on successful sending. | |
3632 (while actions | |
3633 (ignore-errors | |
3634 (cond | |
3635 ;; A simple function. | |
88155 | 3636 ((functionp (car actions)) |
17493 | 3637 (funcall (car actions))) |
3638 ;; Something to be evaled. | |
3639 (t | |
3640 (eval (car actions))))) | |
3641 (pop actions))) | |
3642 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3643 (defun message-send-mail-partially () |
88155 | 3644 "Send mail as message/partial." |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3645 ;; 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
|
3646 (goto-char (point-min)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3647 (re-search-forward |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3648 (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
|
3649 (replace-match "\n") |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3650 (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
|
3651 (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
|
3652 (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
|
3653 (curbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3654 (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
|
3655 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
|
3656 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3657 (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
|
3658 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3659 (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
|
3660 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3661 (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
|
3662 (push p plist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3663 (setq p (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3664 (setq total (length plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3665 (push (point-max) plist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3666 (setq plist (nreverse plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3667 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3668 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3669 (setq p (pop plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3670 (while plist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3671 (set-buffer curbuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3672 (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
|
3673 (set-buffer tembuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3674 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3675 (if header |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3676 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3677 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3678 (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
|
3679 (insert header)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3680 (message-goto-eoh) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3681 (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
|
3682 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3683 (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
|
3684 (insert header) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3685 (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
|
3686 (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
|
3687 (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
|
3688 (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
|
3689 (message-remove-header "Lines") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3690 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3691 (insert "Mime-Version: 1.0\n") |
88155 | 3692 (setq header (buffer-string))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3693 (goto-char (point-max)) |
88155 | 3694 (insert (format "Content-Type: message/partial; id=\"%s\"; number=%d; total=%d\n\n" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3695 id n total)) |
88155 | 3696 (forward-char -1) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3697 (let ((mail-header-separator "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3698 (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
|
3699 (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
|
3700 (when (memq 'Lines message-required-mail-headers) |
88155 | 3701 (insert "Lines: " (message-make-lines) "\n")) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3702 (message-goto-subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3703 (end-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3704 (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
|
3705 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3706 (mm-with-unibyte-current-buffer |
88155 | 3707 (funcall (or message-send-mail-real-function |
3708 message-send-mail-function)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3709 (setq n (+ n 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3710 (setq p (pop plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3711 (erase-buffer))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3712 (kill-buffer tembuf)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3713 |
17493 | 3714 (defun message-send-mail (&optional arg) |
3715 (require 'mail-utils) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3716 (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
|
3717 (case-fold-search nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3718 (news (message-news-p)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3719 (mailbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3720 (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
|
3721 (message-posting-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3722 (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
|
3723 (gnus-setup-posting-charset nil) |
88155 | 3724 message-posting-charset)) |
3725 (headers message-required-mail-headers)) | |
17493 | 3726 (save-restriction |
3727 (message-narrow-to-headers) | |
88155 | 3728 ;; Generate the Mail-Followup-To header if the header is not there... |
3729 (if (and (message-subscribed-p) | |
3730 (not (mail-fetch-field "mail-followup-to"))) | |
3731 (setq headers | |
3732 (cons | |
3733 (cons "Mail-Followup-To" (message-make-mail-followup-to)) | |
3734 message-required-mail-headers)) | |
3735 ;; otherwise, delete the MFT header if the field is empty | |
3736 (when (equal "" (mail-fetch-field "mail-followup-to")) | |
3737 (message-remove-header "^Mail-Followup-To:"))) | |
17493 | 3738 ;; Insert some headers. |
3739 (let ((message-deletable-headers | |
3740 (if news nil message-deletable-headers))) | |
88155 | 3741 (message-generate-headers headers)) |
17493 | 3742 ;; Let the user do all of the above. |
3743 (run-hooks 'message-header-hook)) | |
3744 (unwind-protect | |
3745 (save-excursion | |
3746 (set-buffer tembuf) | |
3747 (erase-buffer) | |
88155 | 3748 ;; Avoid copying text props (except hard newlines). |
33748
2827e4066e08
* message.el (message-send-mail): Use buffer-substring-no-properties.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33436
diff
changeset
|
3749 (insert (with-current-buffer mailbuf |
88155 | 3750 (mml-buffer-substring-no-properties-except-hard-newlines |
3751 (point-min) (point-max)))) | |
17493 | 3752 ;; Remove some headers. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3753 (message-encode-message-body) |
17493 | 3754 (save-restriction |
3755 (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
|
3756 ;; 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
|
3757 (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
|
3758 (message-generate-headers '(Lines))) |
17493 | 3759 ;; Remove some headers. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3760 (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
|
3761 (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
|
3762 (mail-encode-encoded-word-buffer))) |
17493 | 3763 (goto-char (point-max)) |
3764 ;; require one newline at the end. | |
3765 (or (= (preceding-char) ?\n) | |
3766 (insert ?\n)) | |
88155 | 3767 (message-cleanup-headers) |
3768 ;; FIXME: we're inserting the courtesy copy after encoding. | |
3769 ;; This is wrong if the courtesy copy string contains | |
3770 ;; non-ASCII characters. -- jh | |
35147 | 3771 (when |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3772 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3773 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3774 (and news |
17493 | 3775 (or (message-fetch-field "cc") |
88155 | 3776 (message-fetch-field "bcc") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3777 (message-fetch-field "to")) |
88155 | 3778 (let ((content-type (message-fetch-field |
3779 "content-type"))) | |
3780 (and | |
3781 (or | |
3782 (not content-type) | |
3783 (string= "text/plain" | |
3784 (car | |
3785 (mail-header-parse-content-type | |
3786 content-type)))) | |
3787 (not | |
3788 (string= "base64" | |
3789 (message-fetch-field | |
3790 "content-transfer-encoding"))))))) | |
17493 | 3791 (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
|
3792 (if (or (not message-send-mail-partially-limit) |
88155 | 3793 (< (buffer-size) message-send-mail-partially-limit) |
3794 (not (message-y-or-n-p | |
3795 "The message size is too large, split? " | |
3796 t | |
3797 "\ | |
3798 The message size, " | |
3799 (/ (buffer-size) 1000) "KB, is too large. | |
3800 | |
3801 Some mail gateways (MTA's) bounce large messages. To avoid the | |
3802 problem, answer `y', and the message will be split into several | |
3803 smaller pieces, the size of each is about " | |
3804 (/ message-send-mail-partially-limit 1000) | |
3805 "KB except the last | |
3806 one. | |
3807 | |
3808 However, some mail readers (MUA's) can't read split messages, i.e., | |
3809 mails in message/partially format. Answer `n', and the message will be | |
3810 sent in one piece. | |
3811 | |
3812 The size limit is controlled by `message-send-mail-partially-limit'. | |
3813 If you always want Gnus to send messages in one piece, set | |
3814 `message-send-mail-partially-limit' to nil. | |
3815 "))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3816 (mm-with-unibyte-current-buffer |
88155 | 3817 (message "Sending via mail...") |
3818 (funcall (or message-send-mail-real-function | |
3819 message-send-mail-function))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3820 (message-send-mail-partially))) |
17493 | 3821 (kill-buffer tembuf)) |
3822 (set-buffer mailbuf) | |
3823 (push 'mail message-sent-message-via))) | |
3824 | |
3825 (defun message-send-mail-with-sendmail () | |
3826 "Send off the prepared buffer with sendmail." | |
3827 (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
|
3828 (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
|
3829 " sendmail errors") |
17493 | 3830 0)) |
3831 resend-to-addresses delimline) | |
88155 | 3832 (unwind-protect |
3833 (progn | |
3834 (let ((case-fold-search t)) | |
3835 (save-restriction | |
3836 (message-narrow-to-headers) | |
3837 (setq resend-to-addresses (message-fetch-field "resent-to"))) | |
3838 ;; Change header-delimiter to be what sendmail expects. | |
3839 (goto-char (point-min)) | |
3840 (re-search-forward | |
3841 (concat "^" (regexp-quote mail-header-separator) "\n")) | |
3842 (replace-match "\n") | |
3843 (backward-char 1) | |
3844 (setq delimline (point-marker)) | |
3845 (run-hooks 'message-send-mail-hook) | |
3846 ;; Insert an extra newline if we need it to work around | |
3847 ;; Sun's bug that swallows newlines. | |
3848 (goto-char (1+ delimline)) | |
3849 (when (eval message-mailer-swallows-blank-line) | |
3850 (newline)) | |
3851 (when message-interactive | |
3852 (save-excursion | |
3853 (set-buffer errbuf) | |
3854 (erase-buffer)))) | |
3855 (let* ((default-directory "/") | |
3856 (coding-system-for-write message-send-coding-system) | |
3857 (cpr (apply | |
3858 'call-process-region | |
3859 (append | |
3860 (list (point-min) (point-max) | |
3861 (if (boundp 'sendmail-program) | |
3862 sendmail-program | |
3863 "/usr/lib/sendmail") | |
3864 nil errbuf nil "-oi") | |
3865 ;; Always specify who from, | |
3866 ;; since some systems have broken sendmails. | |
3867 ;; But some systems are more broken with -f, so | |
3868 ;; we'll let users override this. | |
3869 (if (null message-sendmail-f-is-evil) | |
3870 (list "-f" (message-sendmail-envelope-from))) | |
3871 ;; These mean "report errors by mail" | |
3872 ;; and "deliver in background". | |
3873 (if (null message-interactive) '("-oem" "-odb")) | |
3874 ;; Get the addresses from the message | |
3875 ;; unless this is a resend. | |
3876 ;; We must not do that for a resend | |
3877 ;; because we would find the original addresses. | |
3878 ;; For a resend, include the specific addresses. | |
3879 (if resend-to-addresses | |
3880 (list resend-to-addresses) | |
3881 '("-t")))))) | |
3882 (unless (or (null cpr) (and (numberp cpr) (zerop cpr))) | |
3883 (error "Sending...failed with exit value %d" cpr))) | |
3884 (when message-interactive | |
3885 (save-excursion | |
3886 (set-buffer errbuf) | |
3887 (goto-char (point-min)) | |
3888 (while (re-search-forward "\n\n* *" nil t) | |
3889 (replace-match "; ")) | |
3890 (if (not (zerop (buffer-size))) | |
3891 (error "Sending...failed to %s" | |
3892 (buffer-string)))))) | |
17493 | 3893 (when (bufferp errbuf) |
3894 (kill-buffer errbuf))))) | |
3895 | |
3896 (defun message-send-mail-with-qmail () | |
3897 "Pass the prepared message buffer to qmail-inject. | |
3898 Refer to the documentation for the variable `message-send-mail-function' | |
3899 to find out how to use this." | |
3900 ;; replace the header delimiter with a blank line | |
3901 (goto-char (point-min)) | |
3902 (re-search-forward | |
3903 (concat "^" (regexp-quote mail-header-separator) "\n")) | |
3904 (replace-match "\n") | |
3905 (run-hooks 'message-send-mail-hook) | |
3906 ;; send the message | |
3907 (case | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3908 (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
|
3909 (apply |
88155 | 3910 'call-process-region (point-min) (point-max) |
3911 message-qmail-inject-program nil nil nil | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3912 ;; 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
|
3913 ;; 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
|
3914 ;; 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
|
3915 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3916 ;; 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
|
3917 ;; 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
|
3918 ;; message from stdin. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3919 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3920 ;; 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
|
3921 ;; 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
|
3922 ;; 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
|
3923 ;; for sendmail's lost innocence. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3924 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3925 ;; 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
|
3926 ;; 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
|
3927 ;; 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
|
3928 ;; gets full control (no gestapo'ish -f's, for instance). --sj |
88155 | 3929 (if (functionp message-qmail-inject-args) |
3930 (funcall message-qmail-inject-args) | |
3931 message-qmail-inject-args))) | |
17493 | 3932 ;; qmail-inject doesn't say anything on it's stdout/stderr, |
3933 ;; we have to look at the retval instead | |
3934 (0 nil) | |
88155 | 3935 (100 (error "qmail-inject reported permanent failure")) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3936 (111 (error "qmail-inject reported transient failure")) |
17493 | 3937 ;; should never happen |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3938 (t (error "qmail-inject reported unknown failure")))) |
17493 | 3939 |
3940 (defun message-send-mail-with-mh () | |
3941 "Send the prepared message buffer with mh." | |
3942 (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
|
3943 (name (mh-new-draft-name))) |
17493 | 3944 (setq buffer-file-name name) |
3945 ;; MH wants to generate these headers itself. | |
3946 (when message-mh-deletable-headers | |
3947 (let ((headers message-mh-deletable-headers)) | |
3948 (while headers | |
3949 (goto-char (point-min)) | |
3950 (and (re-search-forward | |
3951 (concat "^" (symbol-name (car headers)) ": *") nil t) | |
3952 (message-delete-line)) | |
3953 (pop headers)))) | |
3954 (run-hooks 'message-send-mail-hook) | |
3955 ;; Pass it on to mh. | |
3956 (mh-send-letter))) | |
3957 | |
88155 | 3958 (defun message-smtpmail-send-it () |
3959 "Send the prepared message buffer with `smtpmail-send-it'. | |
3960 This only differs from `smtpmail-send-it' that this command evaluates | |
3961 `message-send-mail-hook' just before sending a message. It is useful | |
3962 if your ISP requires the POP-before-SMTP authentication. See the Gnus | |
3963 manual for details." | |
3964 (run-hooks 'message-send-mail-hook) | |
3965 (smtpmail-send-it)) | |
3966 | |
3967 (defun message-canlock-generate () | |
3968 "Return a string that is non-trivial to guess. | |
3969 Do not use this for anything important, it is cryptographically weak." | |
3970 (require 'sha1) | |
3971 (let (sha1-maximum-internal-length) | |
3972 (sha1 (concat (message-unique-id) | |
3973 (format "%x%x%x" (random) (random t) (random)) | |
3974 (prin1-to-string (recent-keys)) | |
3975 (prin1-to-string (garbage-collect)))))) | |
3976 | |
3977 (defun message-canlock-password () | |
3978 "The password used by message for cancel locks. | |
3979 This is the value of `canlock-password', if that option is non-nil. | |
3980 Otherwise, generate and save a value for `canlock-password' first." | |
3981 (unless canlock-password | |
3982 (customize-save-variable 'canlock-password (message-canlock-generate)) | |
3983 (setq canlock-password-for-verify canlock-password)) | |
3984 canlock-password) | |
3985 | |
3986 (defun message-insert-canlock () | |
3987 (when message-insert-canlock | |
3988 (message-canlock-password) | |
3989 (canlock-insert-header))) | |
3990 | |
17493 | 3991 (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
|
3992 (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
|
3993 (case-fold-search nil) |
88155 | 3994 (method (if (functionp message-post-method) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3995 (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
|
3996 message-post-method)) |
88155 | 3997 (newsgroups-field (save-restriction |
3998 (message-narrow-to-headers-or-head) | |
3999 (message-fetch-field "Newsgroups"))) | |
4000 (followup-field (save-restriction | |
4001 (message-narrow-to-headers-or-head) | |
4002 (message-fetch-field "Followup-To"))) | |
4003 ;; BUG: We really need to get the charset for each name in the | |
4004 ;; Newsgroups and Followup-To lines to allow crossposting | |
4005 ;; between group namess with incompatible character sets. | |
4006 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2001-10-08. | |
4007 (group-field-charset | |
4008 (gnus-group-name-charset method newsgroups-field)) | |
4009 (followup-field-charset | |
4010 (gnus-group-name-charset method (or followup-field ""))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4011 (rfc2047-header-encoding-alist |
88155 | 4012 (append (when group-field-charset |
4013 (list (cons "Newsgroups" group-field-charset))) | |
4014 (when followup-field-charset | |
4015 (list (cons "Followup-To" followup-field-charset))) | |
4016 rfc2047-header-encoding-alist)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4017 (messbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4018 (message-syntax-checks |
88155 | 4019 (if (and arg |
4020 (listp message-syntax-checks)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4021 (cons '(existing-newsgroups . disabled) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4022 message-syntax-checks) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4023 message-syntax-checks)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4024 (message-this-is-news t) |
88155 | 4025 (message-posting-charset |
4026 (gnus-setup-posting-charset newsgroups-field)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4027 result) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4028 (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
|
4029 nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4030 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4031 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4032 ;; Insert some headers. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4033 (message-generate-headers message-required-news-headers) |
88155 | 4034 (message-insert-canlock) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4035 ;; 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
|
4036 (run-hooks 'message-header-hook)) |
88155 | 4037 ;; Note: This check will be disabled by the ".*" default value for |
4038 ;; gnus-group-name-charset-group-alist. -- Pa 2001-10-07. | |
4039 (when (and group-field-charset | |
4040 (listp message-syntax-checks)) | |
4041 (setq message-syntax-checks | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4042 (cons '(valid-newsgroups . disabled) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4043 message-syntax-checks))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4044 (message-cleanup-headers) |
88155 | 4045 (if (not (let ((message-post-method method)) |
4046 (message-check-news-syntax))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4047 nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4048 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4049 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4050 (set-buffer tembuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4051 (buffer-disable-undo) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4052 (erase-buffer) |
88155 | 4053 ;; Avoid copying text props (except hard newlines). |
4054 (insert | |
4055 (with-current-buffer messbuf | |
4056 (mml-buffer-substring-no-properties-except-hard-newlines | |
4057 (point-min) (point-max)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4058 (message-encode-message-body) |
17493 | 4059 ;; Remove some headers. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4060 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4061 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4062 ;; 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
|
4063 (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
|
4064 (message-generate-headers '(Lines))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4065 ;; Remove some headers. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4066 (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
|
4067 (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
|
4068 (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
|
4069 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4070 ;; 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
|
4071 (or (= (preceding-char) ?\n) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4072 (insert ?\n)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4073 (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
|
4074 ;; Remove the delimiter. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4075 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4076 (re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4077 (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
|
4078 (replace-match "\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4079 (backward-char 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4080 (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
|
4081 (gnus-open-server method) |
88155 | 4082 (message "Sending news via %s..." (gnus-server-string method)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4083 (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
|
4084 (gnus-request-post method)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4085 (kill-buffer tembuf)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4086 (set-buffer messbuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4087 (if result |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4088 (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
|
4089 (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
|
4090 (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
|
4091 nil))))) |
17493 | 4092 |
4093 ;;; | |
4094 ;;; Header generation & syntax checking. | |
4095 ;;; | |
4096 | |
4097 (defun message-check-element (type) | |
35147 | 4098 "Return non-nil if this TYPE is not to be checked." |
17493 | 4099 (if (eq message-syntax-checks 'dont-check-for-anything-just-trust-me) |
4100 t | |
4101 (let ((able (assq type message-syntax-checks))) | |
4102 (and (consp able) | |
4103 (eq (cdr able) 'disabled))))) | |
4104 | |
4105 (defun message-check-news-syntax () | |
4106 "Check the syntax of the message." | |
4107 (save-excursion | |
4108 (save-restriction | |
4109 (widen) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4110 ;; 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
|
4111 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4112 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4113 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4114 (message-check-news-header-syntax)))))) |
17493 | 4115 |
4116 (defun message-check-news-header-syntax () | |
4117 (and | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4118 ;; Check Newsgroups header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4119 (message-check 'newsgroups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4120 (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
|
4121 (or |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4122 (and group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4123 (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
|
4124 (ignore |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4125 (message |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4126 "The newsgroups field is empty or missing. Posting is denied."))))) |
17493 | 4127 ;; Check the Subject header. |
4128 (message-check 'subject | |
4129 (let* ((case-fold-search t) | |
4130 (subject (message-fetch-field "subject"))) | |
4131 (or | |
4132 (and subject | |
4133 (not (string-match "\\`[ \t]*\\'" subject))) | |
4134 (ignore | |
4135 (message | |
4136 "The subject field is empty or missing. Posting is denied."))))) | |
4137 ;; Check for commands in Subject. | |
4138 (message-check 'subject-cmsg | |
4139 (if (string-match "^cmsg " (message-fetch-field "subject")) | |
4140 (y-or-n-p | |
4141 "The control code \"cmsg\" is in the subject. Really post? ") | |
4142 t)) | |
88155 | 4143 ;; Check long header lines. |
4144 (message-check 'long-header-lines | |
4145 (let ((start (point)) | |
4146 (header nil) | |
4147 (length 0) | |
4148 found) | |
4149 (while (and (not found) | |
4150 (re-search-forward "^\\([^ \t:]+\\): " nil t)) | |
4151 (if (> (- (point) (match-beginning 0)) 998) | |
4152 (setq found t | |
4153 length (- (point) (match-beginning 0))) | |
4154 (setq header (match-string-no-properties 1))) | |
4155 (setq start (match-beginning 0)) | |
4156 (forward-line 1)) | |
4157 (if found | |
4158 (y-or-n-p (format "Your %s header is too long (%d). Really post? " | |
4159 header length)) | |
4160 t))) | |
17493 | 4161 ;; Check for multiple identical headers. |
4162 (message-check 'multiple-headers | |
4163 (let (found) | |
4164 (while (and (not found) | |
4165 (re-search-forward "^[^ \t:]+: " nil t)) | |
4166 (save-excursion | |
4167 (or (re-search-forward | |
4168 (concat "^" | |
4169 (regexp-quote | |
4170 (setq found | |
4171 (buffer-substring | |
4172 (match-beginning 0) (- (match-end 0) 2)))) | |
4173 ":") | |
4174 nil t) | |
4175 (setq found nil)))) | |
4176 (if found | |
4177 (y-or-n-p (format "Multiple %s headers. Really post? " found)) | |
4178 t))) | |
4179 ;; Check for Version and Sendsys. | |
4180 (message-check 'sendsys | |
4181 (if (re-search-forward "^Sendsys:\\|^Version:" nil t) | |
4182 (y-or-n-p | |
4183 (format "The article contains a %s command. Really post? " | |
4184 (buffer-substring (match-beginning 0) | |
4185 (1- (match-end 0))))) | |
4186 t)) | |
4187 ;; See whether we can shorten Followup-To. | |
4188 (message-check 'shorten-followup-to | |
4189 (let ((newsgroups (message-fetch-field "newsgroups")) | |
4190 (followup-to (message-fetch-field "followup-to")) | |
4191 to) | |
4192 (when (and newsgroups | |
4193 (string-match "," newsgroups) | |
4194 (not followup-to) | |
4195 (not | |
4196 (zerop | |
4197 (length | |
4198 (setq to (completing-read | |
88155 | 4199 "Followups to (default no Followup-To header): " |
4200 (mapcar #'list | |
17493 | 4201 (cons "poster" |
4202 (message-tokenize-header | |
4203 newsgroups))))))))) | |
4204 (goto-char (point-min)) | |
4205 (insert "Followup-To: " to "\n")) | |
4206 t)) | |
4207 ;; Check "Shoot me". | |
4208 (message-check 'shoot | |
4209 (if (re-search-forward | |
88155 | 4210 "Message-ID.*.i-did-not-set--mail-host-address--so-tickle-me" nil t) |
17493 | 4211 (y-or-n-p "You appear to have a misconfigured system. Really post? ") |
4212 t)) | |
4213 ;; Check for Approved. | |
4214 (message-check 'approved | |
4215 (if (re-search-forward "^Approved:" nil t) | |
4216 (y-or-n-p "The article contains an Approved header. Really post? ") | |
4217 t)) | |
4218 ;; Check the Message-ID header. | |
4219 (message-check 'message-id | |
4220 (let* ((case-fold-search t) | |
4221 (message-id (message-fetch-field "message-id" t))) | |
4222 (or (not message-id) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4223 ;; Is there an @ in the ID? |
17493 | 4224 (and (string-match "@" message-id) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4225 ;; 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
|
4226 (string-match "@[^.]*\\." message-id) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4227 ;; 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
|
4228 (not (string-match "\\.>" message-id))) |
17493 | 4229 (y-or-n-p |
4230 (format "The Message-ID looks strange: \"%s\". Really post? " | |
4231 message-id))))) | |
4232 ;; Check the Newsgroups & Followup-To headers. | |
4233 (message-check 'existing-newsgroups | |
4234 (let* ((case-fold-search t) | |
4235 (newsgroups (message-fetch-field "newsgroups")) | |
4236 (followup-to (message-fetch-field "followup-to")) | |
4237 (groups (message-tokenize-header | |
4238 (if followup-to | |
4239 (concat newsgroups "," followup-to) | |
4240 newsgroups))) | |
88155 | 4241 (post-method (if (functionp message-post-method) |
4242 (funcall message-post-method) | |
4243 message-post-method)) | |
4244 ;; KLUDGE to handle nnvirtual groups. Doing this right | |
4245 ;; would probably involve a new nnoo function. | |
4246 ;; -- Per Abrahamsen <abraham@dina.kvl.dk>, 2001-10-17. | |
4247 (method (if (and (consp post-method) | |
4248 (eq (car post-method) 'nnvirtual) | |
4249 gnus-message-group-art) | |
4250 (let ((group (car (nnvirtual-find-group-art | |
4251 (car gnus-message-group-art) | |
4252 (cdr gnus-message-group-art))))) | |
4253 (gnus-find-method-for-group group)) | |
4254 post-method)) | |
4255 (known-groups | |
4256 (mapcar (lambda (n) | |
4257 (gnus-group-name-decode | |
4258 (gnus-group-real-name n) | |
4259 (gnus-group-name-charset method n))) | |
4260 (gnus-groups-from-server method))) | |
17493 | 4261 errors) |
88155 | 4262 (while groups |
4263 (when (and (not (equal (car groups) "poster")) | |
4264 (not (member (car groups) known-groups)) | |
4265 (not (member (car groups) errors))) | |
4266 (push (car groups) errors)) | |
4267 (pop groups)) | |
4268 (cond | |
4269 ;; Gnus is not running. | |
4270 ((or (not (and (boundp 'gnus-active-hashtb) | |
4271 gnus-active-hashtb)) | |
4272 (not (boundp 'gnus-read-active-file))) | |
4273 t) | |
4274 ;; We don't have all the group names. | |
4275 ((and (or (not gnus-read-active-file) | |
4276 (eq gnus-read-active-file 'some)) | |
4277 errors) | |
4278 (y-or-n-p | |
4279 (format | |
4280 "Really use %s possibly unknown group%s: %s? " | |
4281 (if (= (length errors) 1) "this" "these") | |
4282 (if (= (length errors) 1) "" "s") | |
4283 (mapconcat 'identity errors ", ")))) | |
4284 ;; There were no errors. | |
4285 ((not errors) | |
4286 t) | |
4287 ;; There are unknown groups. | |
4288 (t | |
4289 (y-or-n-p | |
4290 (format | |
4291 "Really post to %s unknown group%s: %s? " | |
4292 (if (= (length errors) 1) "this" "these") | |
4293 (if (= (length errors) 1) "" "s") | |
4294 (mapconcat 'identity errors ", "))))))) | |
4295 ;; Check continuation headers. | |
4296 (message-check 'continuation-headers | |
4297 (goto-char (point-min)) | |
4298 (let ((do-posting t)) | |
4299 (while (re-search-forward "^[^ \t\n][^:\n]*$" nil t) | |
4300 (if (y-or-n-p "Fix continuation lines? ") | |
4301 (progn | |
4302 (goto-char (match-beginning 0)) | |
4303 (insert " ")) | |
4304 (unless (y-or-n-p "Send anyway? ") | |
4305 (setq do-posting nil)))) | |
4306 do-posting)) | |
17493 | 4307 ;; Check the Newsgroups & Followup-To headers for syntax errors. |
4308 (message-check 'valid-newsgroups | |
4309 (let ((case-fold-search t) | |
4310 (headers '("Newsgroups" "Followup-To")) | |
4311 header error) | |
4312 (while (and headers (not error)) | |
4313 (when (setq header (mail-fetch-field (car headers))) | |
4314 (if (or | |
4315 (not | |
4316 (string-match | |
4317 "\\`\\([-+_&.a-zA-Z0-9]+\\)?\\(,[-+_&.a-zA-Z0-9]+\\)*\\'" | |
4318 header)) | |
4319 (memq | |
4320 nil (mapcar | |
4321 (lambda (g) | |
4322 (not (string-match "\\.\\'\\|\\.\\." g))) | |
4323 (message-tokenize-header header ",")))) | |
4324 (setq error t))) | |
4325 (unless error | |
4326 (pop headers))) | |
4327 (if (not error) | |
4328 t | |
4329 (y-or-n-p | |
4330 (format "The %s header looks odd: \"%s\". Really post? " | |
4331 (car headers) header))))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4332 (message-check 'repeated-newsgroups |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4333 (let ((case-fold-search t) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4334 (headers '("Newsgroups" "Followup-To")) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4335 header error groups group) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4336 (while (and headers |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4337 (not error)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4338 (when (setq header (mail-fetch-field (pop headers))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4339 (setq groups (message-tokenize-header header ",")) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4340 (while (setq group (pop groups)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4341 (when (member group groups) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4342 (setq error group |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4343 groups nil))))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4344 (if (not error) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4345 t |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4346 (y-or-n-p |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4347 (format "Group %s is repeated in headers. Really post? " error))))) |
17493 | 4348 ;; Check the From header. |
4349 (message-check 'from | |
4350 (let* ((case-fold-search t) | |
4351 (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
|
4352 ad) |
17493 | 4353 (cond |
4354 ((not from) | |
4355 (message "There is no From line. Posting is denied.") | |
4356 nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4357 ((or (not (string-match |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4358 "@[^\\.]*\\." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4359 (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
|
4360 from))))) ;larsi@ifi |
88155 | 4361 (string-match "\\.\\." ad) ;larsi@ifi..uio |
17493 | 4362 (string-match "@\\." ad) ;larsi@.ifi.uio |
4363 (string-match "\\.$" ad) ;larsi@ifi.uio. | |
4364 (not (string-match "^[^@]+@[^@]+$" ad)) ;larsi.ifi.uio | |
4365 (string-match "(.*).*(.*)" from)) ;(lars) (lars) | |
4366 (message | |
4367 "Denied posting -- the From looks strange: \"%s\"." from) | |
4368 nil) | |
88155 | 4369 ((let ((addresses (rfc822-addresses from))) |
4370 (while (and addresses | |
4371 (not (eq (string-to-char (car addresses)) ?\())) | |
4372 (setq addresses (cdr addresses))) | |
4373 addresses) | |
4374 (message | |
4375 "Denied posting -- bad From address: \"%s\"." from) | |
4376 nil) | |
4377 (t t)))) | |
4378 ;; Check the Reply-To header. | |
4379 (message-check 'reply-to | |
4380 (let* ((case-fold-search t) | |
4381 (reply-to (message-fetch-field "reply-to")) | |
4382 ad) | |
4383 (cond | |
4384 ((not reply-to) | |
4385 t) | |
4386 ((string-match "," reply-to) | |
4387 (y-or-n-p | |
4388 (format "Multiple Reply-To addresses: \"%s\". Really post? " | |
4389 reply-to))) | |
4390 ((or (not (string-match | |
4391 "@[^\\.]*\\." | |
4392 (setq ad (nth 1 (mail-extract-address-components | |
4393 reply-to))))) ;larsi@ifi | |
4394 (string-match "\\.\\." ad) ;larsi@ifi..uio | |
4395 (string-match "@\\." ad) ;larsi@.ifi.uio | |
4396 (string-match "\\.$" ad) ;larsi@ifi.uio. | |
4397 (not (string-match "^[^@]+@[^@]+$" ad)) ;larsi.ifi.uio | |
4398 (string-match "(.*).*(.*)" reply-to)) ;(lars) (lars) | |
4399 (y-or-n-p | |
4400 (format | |
4401 "The Reply-To looks strange: \"%s\". Really post? " | |
4402 reply-to))) | |
17493 | 4403 (t t)))))) |
4404 | |
4405 (defun message-check-news-body-syntax () | |
4406 (and | |
4407 ;; Check for long lines. | |
4408 (message-check 'long-lines | |
4409 (goto-char (point-min)) | |
4410 (re-search-forward | |
4411 (concat "^" (regexp-quote mail-header-separator) "$")) | |
88155 | 4412 (forward-line 1) |
17493 | 4413 (while (and |
88155 | 4414 (or (looking-at |
4415 "<#\\(/\\)?\\(multipart\\|part\\|external\\|mml\\)") | |
4416 (let ((p (point))) | |
4417 (end-of-line) | |
4418 (< (- (point) p) 80))) | |
17493 | 4419 (zerop (forward-line 1)))) |
4420 (or (bolp) | |
4421 (eobp) | |
4422 (y-or-n-p | |
4423 "You have lines longer than 79 characters. Really post? "))) | |
4424 ;; Check whether the article is empty. | |
4425 (message-check 'empty | |
4426 (goto-char (point-min)) | |
4427 (re-search-forward | |
4428 (concat "^" (regexp-quote mail-header-separator) "$")) | |
4429 (forward-line 1) | |
4430 (let ((b (point))) | |
4431 (goto-char (point-max)) | |
4432 (re-search-backward message-signature-separator nil t) | |
4433 (beginning-of-line) | |
4434 (or (re-search-backward "[^ \n\t]" b t) | |
88155 | 4435 (if (message-gnksa-enable-p 'empty-article) |
4436 (y-or-n-p "Empty article. Really post? ") | |
4437 (message "Denied posting -- Empty article.") | |
4438 nil)))) | |
17493 | 4439 ;; Check for control characters. |
4440 (message-check 'control-chars | |
88155 | 4441 (if (re-search-forward |
4442 (mm-string-as-multibyte "[\000-\007\013\015-\032\034-\037\200-\237]") | |
4443 nil t) | |
17493 | 4444 (y-or-n-p |
4445 "The article contains control characters. Really post? ") | |
4446 t)) | |
4447 ;; Check excessive size. | |
4448 (message-check 'size | |
4449 (if (> (buffer-size) 60000) | |
4450 (y-or-n-p | |
4451 (format "The article is %d octets long. Really post? " | |
4452 (buffer-size))) | |
4453 t)) | |
4454 ;; Check whether any new text has been added. | |
4455 (message-check 'new-text | |
4456 (or | |
4457 (not message-checksum) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4458 (not (eq (message-checksum) message-checksum)) |
88155 | 4459 (if (message-gnksa-enable-p 'quoted-text-only) |
4460 (y-or-n-p | |
4461 "It looks like no new text has been added. Really post? ") | |
4462 (message "Denied posting -- no new text has been added.") | |
4463 nil))) | |
17493 | 4464 ;; Check the length of the signature. |
4465 (message-check 'signature | |
4466 (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
|
4467 (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
|
4468 (y-or-n-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4469 (format |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4470 "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
|
4471 (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
|
4472 t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4473 ;; 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
|
4474 (message-check 'quoting-style |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4475 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4476 (let ((no-problem t)) |
88155 | 4477 (when (search-backward-regexp "^>[^\n]*\n" nil t) |
4478 (setq no-problem (search-forward-regexp "^[ \t]*[^>\n]" nil t))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4479 (if no-problem |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4480 t |
88155 | 4481 (if (message-gnksa-enable-p 'quoted-text-only) |
4482 (y-or-n-p "Your text should follow quoted text. Really post? ") | |
4483 ;; Ensure that | |
4484 (goto-char (point-min)) | |
4485 (re-search-forward | |
4486 (concat "^" (regexp-quote mail-header-separator) "$")) | |
4487 (if (search-forward-regexp "^[ \t]*[^>\n]" nil t) | |
4488 (y-or-n-p "Your text should follow quoted text. Really post? ") | |
4489 (message "Denied posting -- only quoted text.") | |
4490 nil))))))) | |
17493 | 4491 |
4492 (defun message-checksum () | |
4493 "Return a \"checksum\" for the current buffer." | |
4494 (let ((sum 0)) | |
4495 (save-excursion | |
4496 (goto-char (point-min)) | |
4497 (re-search-forward | |
4498 (concat "^" (regexp-quote mail-header-separator) "$")) | |
4499 (while (not (eobp)) | |
4500 (when (not (looking-at "[ \t\n]")) | |
88155 | 4501 (setq sum (logxor (ash sum 1) (if (natnump sum) 0 1) |
4502 (char-after)))) | |
17493 | 4503 (forward-char 1))) |
4504 sum)) | |
4505 | |
4506 (defun message-do-fcc () | |
4507 "Process Fcc headers in the current buffer." | |
4508 (let ((case-fold-search t) | |
4509 (buf (current-buffer)) | |
88155 | 4510 list file |
4511 (mml-externalize-attachments message-fcc-externalize-attachments)) | |
17493 | 4512 (save-excursion |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4513 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4514 (message-narrow-to-headers) |
88155 | 4515 (setq file (message-fetch-field "fcc" t))) |
4516 (when file | |
4517 (set-buffer (get-buffer-create " *message temp*")) | |
4518 (erase-buffer) | |
4519 (insert-buffer-substring buf) | |
4520 (message-encode-message-body) | |
4521 (save-restriction | |
4522 (message-narrow-to-headers) | |
4523 (while (setq file (message-fetch-field "fcc" t)) | |
4524 (push file list) | |
4525 (message-remove-header "fcc" nil t)) | |
4526 (let ((mail-parse-charset message-default-charset) | |
4527 (rfc2047-header-encoding-alist | |
4528 (cons '("Newsgroups" . default) | |
4529 rfc2047-header-encoding-alist))) | |
4530 (mail-encode-encoded-word-buffer))) | |
4531 (goto-char (point-min)) | |
4532 (when (re-search-forward | |
4533 (concat "^" (regexp-quote mail-header-separator) "$") | |
4534 nil t) | |
4535 (replace-match "" t t )) | |
4536 ;; Process FCC operations. | |
4537 (while list | |
4538 (setq file (pop list)) | |
4539 (if (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" file) | |
4540 ;; Pipe the article to the program in question. | |
4541 (call-process-region (point-min) (point-max) shell-file-name | |
4542 nil nil nil shell-command-switch | |
4543 (match-string 1 file)) | |
4544 ;; Save the article. | |
4545 (setq file (expand-file-name file)) | |
4546 (unless (file-exists-p (file-name-directory file)) | |
4547 (make-directory (file-name-directory file) t)) | |
4548 (if (and message-fcc-handler-function | |
4549 (not (eq message-fcc-handler-function 'rmail-output))) | |
4550 (funcall message-fcc-handler-function file) | |
4551 (if (and (file-readable-p file) (mail-file-babyl-p file)) | |
4552 (rmail-output file 1 nil t) | |
4553 (let ((mail-use-rfc822 t)) | |
4554 (rmail-output file 1 t t)))))) | |
4555 (kill-buffer (current-buffer)))))) | |
17493 | 4556 |
4557 (defun message-output (filename) | |
35147 | 4558 "Append this article to Unix/babyl mail file FILENAME." |
17493 | 4559 (if (and (file-readable-p filename) |
4560 (mail-file-babyl-p filename)) | |
4561 (gnus-output-to-rmail filename t) | |
4562 (gnus-output-to-mail filename t))) | |
4563 | |
4564 (defun message-cleanup-headers () | |
4565 "Do various automatic cleanups of the headers." | |
4566 ;; Remove empty lines in the header. | |
4567 (save-restriction | |
4568 (message-narrow-to-headers) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4569 ;; Remove blank lines. |
17493 | 4570 (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
|
4571 (replace-match "" t t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4572 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4573 ;; 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
|
4574 ;; 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
|
4575 ;; embedded line breaks. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4576 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4577 (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
|
4578 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4579 (narrow-to-region |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4580 (point) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4581 (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
|
4582 (match-beginning 0) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4583 (forward-line 1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4584 (point))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4585 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4586 (while (re-search-forward "\n[ \t]+" nil t) |
88155 | 4587 (replace-match " " t t)) ;No line breaks (too confusing) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4588 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4589 (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
|
4590 (replace-match "," t t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4591 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4592 ;; Remove trailing commas. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4593 (when (re-search-forward ",+$" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4594 (replace-match "" t t)))))) |
17493 | 4595 |
88155 | 4596 (eval-when-compile (require 'parse-time)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4597 (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
|
4598 "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
|
4599 If NOW, use that time instead." |
88155 | 4600 (require 'parse-time) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4601 (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
|
4602 (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
|
4603 (sign "+")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4604 (when (< zone 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4605 (setq sign "-") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4606 (setq zone (- zone))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4607 (concat |
88155 | 4608 ;; The day name of the %a spec is locale-specific. Pfff. |
4609 (format "%s, " (capitalize (car (rassoc (nth 6 (decode-time now)) | |
4610 parse-time-weekdays)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4611 (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
|
4612 ;; 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
|
4613 (format " %s " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4614 (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
|
4615 parse-time-months)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4616 (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
|
4617 ;; 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
|
4618 (format "%s%02d%02d" sign (/ zone 3600) (/ (% zone 3600) 60))))) |
17493 | 4619 |
4620 (defun message-make-message-id () | |
4621 "Make a unique Message-ID." | |
4622 (concat "<" (message-unique-id) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4623 (let ((psubject (save-excursion (message-fetch-field "subject"))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4624 (psupersedes |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4625 (save-excursion (message-fetch-field "supersedes")))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4626 (if (or |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4627 (and message-reply-headers |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4628 (mail-header-references message-reply-headers) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4629 (mail-header-subject message-reply-headers) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4630 psubject |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4631 (not (string= |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4632 (message-strip-subject-re |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4633 (mail-header-subject message-reply-headers)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4634 (message-strip-subject-re psubject)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4635 (and psupersedes |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4636 (string-match "_-_@" psupersedes))) |
17493 | 4637 "_-_" "")) |
4638 "@" (message-make-fqdn) ">")) | |
4639 | |
4640 (defvar message-unique-id-char nil) | |
4641 | |
4642 ;; If you ever change this function, make sure the new version | |
4643 ;; cannot generate IDs that the old version could. | |
4644 ;; You might for example insert a "." somewhere (not next to another dot | |
4645 ;; or string boundary), or modify the "fsf" string. | |
4646 (defun message-unique-id () | |
4647 ;; Don't use microseconds from (current-time), they may be unsupported. | |
4648 ;; Instead we use this randomly inited counter. | |
4649 (setq message-unique-id-char | |
4650 (% (1+ (or message-unique-id-char (logand (random t) (1- (lsh 1 20))))) | |
4651 ;; (current-time) returns 16-bit ints, | |
4652 ;; and 2^16*25 just fits into 4 digits i base 36. | |
4653 (* 25 25))) | |
4654 (let ((tm (current-time))) | |
4655 (concat | |
4656 (if (memq system-type '(ms-dos emx vax-vms)) | |
4657 (let ((user (downcase (user-login-name)))) | |
4658 (while (string-match "[^a-z0-9_]" user) | |
4659 (aset user (match-beginning 0) ?_)) | |
4660 user) | |
4661 (message-number-base36 (user-uid) -1)) | |
88155 | 4662 (message-number-base36 (+ (car tm) |
17493 | 4663 (lsh (% message-unique-id-char 25) 16)) 4) |
4664 (message-number-base36 (+ (nth 1 tm) | |
4665 (lsh (/ message-unique-id-char 25) 16)) 4) | |
88155 | 4666 ;; Append a given name, because while the generated ID is unique |
4667 ;; to this newsreader, other newsreaders might otherwise generate | |
4668 ;; the same ID via another algorithm. | |
17493 | 4669 ".fsf"))) |
4670 | |
4671 (defun message-number-base36 (num len) | |
4672 (if (if (< len 0) | |
4673 (<= num 0) | |
4674 (= len 0)) | |
4675 "" | |
4676 (concat (message-number-base36 (/ num 36) (1- len)) | |
4677 (char-to-string (aref "zyxwvutsrqponmlkjihgfedcba9876543210" | |
4678 (% num 36)))))) | |
4679 | |
4680 (defun message-make-organization () | |
4681 "Make an Organization header." | |
4682 (let* ((organization | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4683 (when message-user-organization |
88155 | 4684 (if (functionp message-user-organization) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4685 (funcall message-user-organization) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4686 message-user-organization)))) |
88155 | 4687 (with-temp-buffer |
4688 (mm-enable-multibyte) | |
17493 | 4689 (cond ((stringp organization) |
4690 (insert organization)) | |
4691 ((and (eq t organization) | |
4692 message-user-organization-file | |
4693 (file-exists-p message-user-organization-file)) | |
4694 (insert-file-contents message-user-organization-file))) | |
4695 (goto-char (point-min)) | |
4696 (while (re-search-forward "[\t\n]+" nil t) | |
4697 (replace-match "" t t)) | |
4698 (unless (zerop (buffer-size)) | |
4699 (buffer-string))))) | |
4700 | |
4701 (defun message-make-lines () | |
4702 "Count the number of lines and return numeric string." | |
4703 (save-excursion | |
4704 (save-restriction | |
4705 (widen) | |
88155 | 4706 (message-goto-body) |
17493 | 4707 (int-to-string (count-lines (point) (point-max)))))) |
4708 | |
88155 | 4709 (defun message-make-references () |
4710 "Return the References header for this message." | |
4711 (when message-reply-headers | |
4712 (let ((message-id (mail-header-message-id message-reply-headers)) | |
4713 (references (mail-header-references message-reply-headers)) | |
4714 new-references) | |
4715 (if (or references message-id) | |
4716 (concat (or references "") (and references " ") | |
4717 (or message-id "")) | |
4718 nil)))) | |
4719 | |
17493 | 4720 (defun message-make-in-reply-to () |
4721 "Return the In-Reply-To header for this message." | |
4722 (when message-reply-headers | |
88155 | 4723 (let ((from (mail-header-from message-reply-headers)) |
4724 (date (mail-header-date message-reply-headers)) | |
4725 (msg-id (mail-header-message-id message-reply-headers))) | |
4726 (when from | |
4727 (let ((name (mail-extract-address-components from))) | |
4728 (concat msg-id (if msg-id " (") | |
4729 (or (car name) | |
4730 (nth 1 name)) | |
4731 "'s message of \"" | |
4732 (if (or (not date) (string= date "")) | |
4733 "(unknown date)" date) | |
4734 "\"" (if msg-id ")"))))))) | |
17493 | 4735 |
4736 (defun message-make-distribution () | |
4737 "Make a Distribution header." | |
4738 (let ((orig-distribution (message-fetch-reply-field "distribution"))) | |
88155 | 4739 (cond ((functionp message-distribution-function) |
17493 | 4740 (funcall message-distribution-function)) |
4741 (t orig-distribution)))) | |
4742 | |
4743 (defun message-make-expires () | |
4744 "Return an Expires header based on `message-expires'." | |
4745 (let ((current (current-time)) | |
4746 (future (* 1.0 message-expires 60 60 24))) | |
4747 ;; Add the future to current. | |
4748 (setcar current (+ (car current) (round (/ future (expt 2 16))))) | |
4749 (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
|
4750 (message-make-date current))) |
17493 | 4751 |
4752 (defun message-make-path () | |
4753 "Return uucp path." | |
4754 (let ((login-name (user-login-name))) | |
4755 (cond ((null message-user-path) | |
4756 (concat (system-name) "!" login-name)) | |
4757 ((stringp message-user-path) | |
4758 ;; Support GENERICPATH. Suggested by vixie@decwrl.dec.com. | |
4759 (concat message-user-path "!" login-name)) | |
4760 (t login-name)))) | |
4761 | |
4762 (defun message-make-from () | |
4763 "Make a From header." | |
4764 (let* ((style message-from-style) | |
4765 (login (message-make-address)) | |
4766 (fullname | |
4767 (or (and (boundp 'user-full-name) | |
4768 user-full-name) | |
4769 (user-full-name)))) | |
4770 (when (string= fullname "&") | |
4771 (setq fullname (user-login-name))) | |
88155 | 4772 (with-temp-buffer |
4773 (mm-enable-multibyte) | |
17493 | 4774 (cond |
4775 ((or (null style) | |
4776 (equal fullname "")) | |
4777 (insert login)) | |
4778 ((or (eq style 'angles) | |
4779 (and (not (eq style 'parens)) | |
4780 ;; Use angles if no quoting is needed, or if parens would | |
4781 ;; need quoting too. | |
4782 (or (not (string-match "[^- !#-'*+/-9=?A-Z^-~]" fullname)) | |
4783 (let ((tmp (concat fullname nil))) | |
4784 (while (string-match "([^()]*)" tmp) | |
4785 (aset tmp (match-beginning 0) ?-) | |
4786 (aset tmp (1- (match-end 0)) ?-)) | |
4787 (string-match "[\\()]" tmp))))) | |
4788 (insert fullname) | |
4789 (goto-char (point-min)) | |
88155 | 4790 ;; Look for a character that cannot appear unquoted |
4791 ;; according to RFC 822. | |
4792 (when (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" nil 1) | |
4793 ;; Quote fullname, escaping specials. | |
4794 (goto-char (point-min)) | |
4795 (insert "\"") | |
4796 (while (re-search-forward "[\"\\]" nil 1) | |
4797 (replace-match "\\\\\\&" t)) | |
4798 (insert "\"")) | |
17493 | 4799 (insert " <" login ">")) |
4800 (t ; 'parens or default | |
4801 (insert login " (") | |
4802 (let ((fullname-start (point))) | |
4803 (insert fullname) | |
4804 (goto-char fullname-start) | |
4805 ;; RFC 822 says \ and nonmatching parentheses | |
4806 ;; must be escaped in comments. | |
4807 ;; Escape every instance of ()\ ... | |
4808 (while (re-search-forward "[()\\]" nil 1) | |
4809 (replace-match "\\\\\\&" t)) | |
4810 ;; ... then undo escaping of matching parentheses, | |
4811 ;; including matching nested parentheses. | |
4812 (goto-char fullname-start) | |
4813 (while (re-search-forward | |
4814 "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)" | |
4815 nil 1) | |
4816 (replace-match "\\1(\\3)" t) | |
4817 (goto-char fullname-start))) | |
4818 (insert ")"))) | |
4819 (buffer-string)))) | |
4820 | |
4821 (defun message-make-sender () | |
4822 "Return the \"real\" user address. | |
4823 This function tries to ignore all user modifications, and | |
4824 give as trustworthy answer as possible." | |
4825 (concat (user-login-name) "@" (system-name))) | |
4826 | |
4827 (defun message-make-address () | |
4828 "Make the address of the user." | |
4829 (or (message-user-mail-address) | |
4830 (concat (user-login-name) "@" (message-make-domain)))) | |
4831 | |
4832 (defun message-user-mail-address () | |
4833 "Return the pertinent part of `user-mail-address'." | |
88155 | 4834 (when (and user-mail-address |
4835 (string-match "@.*\\." user-mail-address)) | |
17493 | 4836 (if (string-match " " user-mail-address) |
4837 (nth 1 (mail-extract-address-components user-mail-address)) | |
4838 user-mail-address))) | |
4839 | |
88155 | 4840 (defun message-sendmail-envelope-from () |
4841 "Return the envelope from." | |
4842 (cond ((eq message-sendmail-envelope-from 'header) | |
4843 (nth 1 (mail-extract-address-components | |
4844 (message-fetch-field "from")))) | |
4845 ((stringp message-sendmail-envelope-from) | |
4846 message-sendmail-envelope-from) | |
4847 (t | |
4848 (message-make-address)))) | |
4849 | |
17493 | 4850 (defun message-make-fqdn () |
4851 "Return user's fully qualified domain name." | |
88155 | 4852 (let* ((system-name (system-name)) |
4853 (user-mail (message-user-mail-address)) | |
4854 (user-domain | |
4855 (if (and user-mail | |
4856 (string-match "@\\(.*\\)\\'" user-mail)) | |
4857 (match-string 1 user-mail))) | |
4858 (case-fold-search t)) | |
17493 | 4859 (cond |
88155 | 4860 ((and message-user-fqdn |
4861 (stringp message-user-fqdn) | |
4862 (string-match message-valid-fqdn-regexp message-user-fqdn) | |
4863 (not (string-match message-bogus-system-names message-user-fqdn))) | |
4864 message-user-fqdn) | |
4865 ;; `message-user-fqdn' seems to be valid | |
4866 ((and (string-match message-valid-fqdn-regexp system-name) | |
4867 (not (string-match message-bogus-system-names system-name))) | |
17493 | 4868 ;; `system-name' returned the right result. |
4869 system-name) | |
4870 ;; Try `mail-host-address'. | |
4871 ((and (boundp 'mail-host-address) | |
4872 (stringp mail-host-address) | |
88155 | 4873 (string-match message-valid-fqdn-regexp mail-host-address) |
4874 (not (string-match message-bogus-system-names mail-host-address))) | |
17493 | 4875 mail-host-address) |
4876 ;; We try `user-mail-address' as a backup. | |
88155 | 4877 ((and user-domain |
4878 (stringp user-domain) | |
4879 (string-match message-valid-fqdn-regexp user-domain) | |
4880 (not (string-match message-bogus-system-names user-domain))) | |
4881 user-domain) | |
17493 | 4882 ;; Default to this bogus thing. |
4883 (t | |
88155 | 4884 (concat system-name |
4885 ".i-did-not-set--mail-host-address--so-tickle-me"))))) | |
17493 | 4886 |
4887 (defun message-make-host-name () | |
4888 "Return the name of the host." | |
4889 (let ((fqdn (message-make-fqdn))) | |
4890 (string-match "^[^.]+\\." fqdn) | |
4891 (substring fqdn 0 (1- (match-end 0))))) | |
4892 | |
4893 (defun message-make-domain () | |
4894 "Return the domain name." | |
4895 (or mail-host-address | |
4896 (message-make-fqdn))) | |
4897 | |
88155 | 4898 (defun message-to-list-only () |
4899 "Send a message to the list only. | |
4900 Remove all addresses but the list address from To and Cc headers." | |
4901 (interactive) | |
4902 (let ((listaddr (message-make-mail-followup-to t))) | |
4903 (when listaddr | |
4904 (save-excursion | |
4905 (message-remove-header "to") | |
4906 (message-remove-header "cc") | |
4907 (message-position-on-field "To" "X-Draft-From") | |
4908 (insert listaddr))))) | |
4909 | |
4910 (defun message-make-mail-followup-to (&optional only-show-subscribed) | |
4911 "Return the Mail-Followup-To header. | |
4912 If passed the optional argument ONLY-SHOW-SUBSCRIBED only return the | |
4913 subscribed address (and not the additional To and Cc header contents)." | |
4914 (let* ((case-fold-search t) | |
4915 (to (message-fetch-field "To")) | |
4916 (cc (message-fetch-field "cc")) | |
4917 (msg-recipients (concat to (and to cc ", ") cc)) | |
4918 (recipients | |
4919 (mapcar 'mail-strip-quoted-names | |
4920 (message-tokenize-header msg-recipients))) | |
4921 (file-regexps | |
4922 (if message-subscribed-address-file | |
4923 (let (begin end item re) | |
4924 (save-excursion | |
4925 (with-temp-buffer | |
4926 (insert-file-contents message-subscribed-address-file) | |
4927 (while (not (eobp)) | |
4928 (setq begin (point)) | |
4929 (forward-line 1) | |
4930 (setq end (point)) | |
4931 (if (bolp) (setq end (1- end))) | |
4932 (setq item (regexp-quote (buffer-substring begin end))) | |
4933 (if re (setq re (concat re "\\|" item)) | |
4934 (setq re (concat "\\`\\(" item)))) | |
4935 (and re (list (concat re "\\)\\'")))))))) | |
4936 (mft-regexps (apply 'append message-subscribed-regexps | |
4937 (mapcar 'regexp-quote | |
4938 message-subscribed-addresses) | |
4939 file-regexps | |
4940 (mapcar 'funcall | |
4941 message-subscribed-address-functions)))) | |
4942 (save-match-data | |
4943 (let ((subscribed-lists nil) | |
4944 (list | |
4945 (loop for recipient in recipients | |
4946 when (loop for regexp in mft-regexps | |
4947 when (string-match regexp recipient) return t) | |
4948 return recipient))) | |
4949 (when list | |
4950 (if only-show-subscribed | |
4951 list | |
4952 msg-recipients)))))) | |
4953 | |
4954 (defun message-idna-to-ascii-rhs-1 (header) | |
4955 "Interactively potentially IDNA encode domain names in HEADER." | |
4956 (let ((field (message-fetch-field header)) | |
4957 rhs ace address) | |
4958 (when field | |
4959 (dolist (rhs | |
4960 (mm-delete-duplicates | |
4961 (mapcar (lambda (rhs) (or (cadr (split-string rhs "@")) "")) | |
4962 (mapcar 'downcase | |
4963 (mapcar | |
4964 'car (mail-header-parse-addresses field)))))) | |
4965 (setq ace (downcase (idna-to-ascii rhs))) | |
4966 (when (and (not (equal rhs ace)) | |
4967 (or (not (eq message-use-idna 'ask)) | |
4968 (y-or-n-p (format "Replace %s with %s in %s:? " | |
4969 rhs ace header)))) | |
4970 (goto-char (point-min)) | |
4971 (while (re-search-forward (concat "^" header ":") nil t) | |
4972 (message-narrow-to-field) | |
4973 (while (search-forward (concat "@" rhs) nil t) | |
4974 (replace-match (concat "@" ace) t t)) | |
4975 (goto-char (point-max)) | |
4976 (widen))))))) | |
4977 | |
4978 (defun message-idna-to-ascii-rhs () | |
4979 "Possibly IDNA encode non-ASCII domain names in From:, To: and Cc: headers. | |
4980 See `message-idna-encode'." | |
4981 (interactive) | |
4982 (when message-use-idna | |
4983 (save-excursion | |
4984 (save-restriction | |
4985 (message-narrow-to-head) | |
4986 (message-idna-to-ascii-rhs-1 "From") | |
4987 (message-idna-to-ascii-rhs-1 "To") | |
4988 (message-idna-to-ascii-rhs-1 "Reply-To") | |
4989 (message-idna-to-ascii-rhs-1 "Mail-Reply-To") | |
4990 (message-idna-to-ascii-rhs-1 "Mail-Followup-To") | |
4991 (message-idna-to-ascii-rhs-1 "Cc"))))) | |
4992 | |
17493 | 4993 (defun message-generate-headers (headers) |
4994 "Prepare article HEADERS. | |
4995 Headers already prepared in the buffer are not modified." | |
88155 | 4996 (setq headers (append headers message-required-headers)) |
17493 | 4997 (save-restriction |
4998 (message-narrow-to-headers) | |
4999 (let* ((Date (message-make-date)) | |
5000 (Message-ID (message-make-message-id)) | |
5001 (Organization (message-make-organization)) | |
5002 (From (message-make-from)) | |
5003 (Path (message-make-path)) | |
5004 (Subject nil) | |
5005 (Newsgroups nil) | |
5006 (In-Reply-To (message-make-in-reply-to)) | |
88155 | 5007 (References (message-make-references)) |
17493 | 5008 (To nil) |
5009 (Distribution (message-make-distribution)) | |
5010 (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
|
5011 (User-Agent message-newsreader) |
17493 | 5012 (Expires (message-make-expires)) |
5013 (case-fold-search t) | |
88155 | 5014 (optionalp nil) |
5015 header value elem header-string) | |
17493 | 5016 ;; First we remove any old generated headers. |
5017 (let ((headers message-deletable-headers)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
5018 (unless (buffer-modified-p) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
5019 (setq headers (delq 'Message-ID (copy-sequence headers)))) |
17493 | 5020 (while headers |
5021 (goto-char (point-min)) | |
5022 (and (re-search-forward | |
5023 (concat "^" (symbol-name (car headers)) ": *") nil t) | |
5024 (get-text-property (1+ (match-beginning 0)) 'message-deletable) | |
5025 (message-delete-line)) | |
5026 (pop headers))) | |
5027 ;; Go through all the required headers and see if they are in the | |
5028 ;; articles already. If they are not, or are empty, they are | |
5029 ;; inserted automatically - except for Subject, Newsgroups and | |
5030 ;; Distribution. | |
5031 (while headers | |
5032 (goto-char (point-min)) | |
5033 (setq elem (pop headers)) | |
5034 (if (consp elem) | |
5035 (if (eq (car elem) 'optional) | |
88155 | 5036 (setq header (cdr elem) |
5037 optionalp t) | |
17493 | 5038 (setq header (car elem))) |
5039 (setq header elem)) | |
88155 | 5040 (setq header-string (if (stringp header) |
5041 header | |
5042 (symbol-name header))) | |
17493 | 5043 (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
|
5044 (concat "^" |
88155 | 5045 (regexp-quote (downcase header-string)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5046 ":") |
17493 | 5047 nil t)) |
5048 (progn | |
5049 ;; The header was found. We insert a space after the | |
5050 ;; 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
|
5051 (if (/= (char-after) ? ) (insert " ") (forward-char 1)) |
88155 | 5052 ;; 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
|
5053 (looking-at "[ \t]*\n[^ \t]"))) |
17493 | 5054 ;; So we find out what value we should insert. |
5055 (setq value | |
5056 (cond | |
88155 | 5057 ((and (consp elem) |
5058 (eq (car elem) 'optional) | |
5059 (not (member header-string message-inserted-headers))) | |
17493 | 5060 ;; This is an optional header. If the cdr of this |
5061 ;; is something that is nil, then we do not insert | |
5062 ;; this header. | |
5063 (setq header (cdr elem)) | |
88155 | 5064 (or (and (functionp (cdr elem)) |
5065 (funcall (cdr elem))) | |
5066 (and (boundp (cdr elem)) | |
5067 (symbol-value (cdr elem))))) | |
17493 | 5068 ((consp elem) |
5069 ;; The element is a cons. Either the cdr is a | |
5070 ;; string to be inserted verbatim, or it is a | |
5071 ;; function, and we insert the value returned from | |
5072 ;; this function. | |
88155 | 5073 (or (and (stringp (cdr elem)) |
5074 (cdr elem)) | |
5075 (and (functionp (cdr elem)) | |
5076 (funcall (cdr elem))))) | |
5077 ((and (boundp header) | |
5078 (symbol-value header)) | |
17493 | 5079 ;; The element is a symbol. We insert the value |
5080 ;; of this symbol, if any. | |
5081 (symbol-value header)) | |
88155 | 5082 ((not (message-check-element |
5083 (intern (downcase (symbol-name header))))) | |
17493 | 5084 ;; We couldn't generate a value for this header, |
5085 ;; so we just ask the user. | |
5086 (read-from-minibuffer | |
5087 (format "Empty header for %s; enter value: " header))))) | |
5088 ;; Finally insert the header. | |
5089 (when (and value | |
5090 (not (equal value ""))) | |
5091 (save-excursion | |
5092 (if (bolp) | |
5093 (progn | |
5094 ;; This header didn't exist, so we insert it. | |
5095 (goto-char (point-max)) | |
88155 | 5096 (let ((formatter |
5097 (cdr (assq header message-header-format-alist)))) | |
5098 (if formatter | |
5099 (funcall formatter header value) | |
5100 (insert header-string ": " value)) | |
5101 ;; We check whether the value was ended by a | |
5102 ;; newline. If now, we insert one. | |
5103 (unless (bolp) | |
5104 (insert "\n")) | |
5105 (forward-line -1))) | |
17493 | 5106 ;; The value of this header was empty, so we clear |
5107 ;; totally and insert the new value. | |
5108 (delete-region (point) (gnus-point-at-eol)) | |
88155 | 5109 ;; If the header is optional, and the header was |
5110 ;; empty, we con't insert it anyway. | |
5111 (unless optionalp | |
5112 (push header-string message-inserted-headers) | |
5113 (insert value))) | |
17493 | 5114 ;; Add the deletable property to the headers that require it. |
5115 (and (memq header message-deletable-headers) | |
5116 (progn (beginning-of-line) (looking-at "[^:]+: ")) | |
5117 (add-text-properties | |
5118 (point) (match-end 0) | |
5119 '(message-deletable t face italic) (current-buffer))))))) | |
5120 ;; Insert new Sender if the From is strange. | |
5121 (let ((from (message-fetch-field "from")) | |
5122 (sender (message-fetch-field "sender")) | |
5123 (secure-sender (message-make-sender))) | |
5124 (when (and from | |
5125 (not (message-check-element 'sender)) | |
5126 (not (string= | |
5127 (downcase | |
5128 (cadr (mail-extract-address-components from))) | |
5129 (downcase secure-sender))) | |
5130 (or (null sender) | |
5131 (not | |
5132 (string= | |
5133 (downcase | |
5134 (cadr (mail-extract-address-components sender))) | |
5135 (downcase secure-sender))))) | |
5136 (goto-char (point-min)) | |
5137 ;; Rename any old Sender headers to Original-Sender. | |
5138 (when (re-search-forward "^\\(Original-\\)*Sender:" nil t) | |
5139 (beginning-of-line) | |
5140 (insert "Original-") | |
5141 (beginning-of-line)) | |
5142 (when (or (message-news-p) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5143 (string-match "@.+\\.." secure-sender)) |
88155 | 5144 (insert "Sender: " secure-sender "\n")))) |
5145 ;; Check for IDNA | |
5146 (message-idna-to-ascii-rhs)))) | |
17493 | 5147 |
5148 (defun message-insert-courtesy-copy () | |
5149 "Insert a courtesy message in mail copies of combined messages." | |
5150 (let (newsgroups) | |
5151 (save-excursion | |
5152 (save-restriction | |
5153 (message-narrow-to-headers) | |
5154 (when (setq newsgroups (message-fetch-field "newsgroups")) | |
5155 (goto-char (point-max)) | |
5156 (insert "Posted-To: " newsgroups "\n"))) | |
5157 (forward-line 1) | |
5158 (when message-courtesy-message | |
5159 (cond | |
5160 ((string-match "%s" message-courtesy-message) | |
5161 (insert (format message-courtesy-message newsgroups))) | |
5162 (t | |
5163 (insert message-courtesy-message))))))) | |
5164 | |
5165 ;;; | |
5166 ;;; Setting up a message buffer | |
5167 ;;; | |
5168 | |
5169 (defun message-fill-address (header value) | |
5170 (save-restriction | |
5171 (narrow-to-region (point) (point)) | |
5172 (insert (capitalize (symbol-name header)) | |
5173 ": " | |
5174 (if (consp value) (car value) value) | |
5175 "\n") | |
5176 (narrow-to-region (point-min) (1- (point-max))) | |
5177 (let (quoted last) | |
5178 (goto-char (point-min)) | |
5179 (while (not (eobp)) | |
5180 (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
|
5181 (if (or (eq (char-after) ?,) |
17493 | 5182 (eobp)) |
5183 (when (not quoted) | |
5184 (if (and (> (current-column) 78) | |
5185 last) | |
5186 (progn | |
5187 (save-excursion | |
5188 (goto-char last) | |
5189 (insert "\n\t")) | |
5190 (setq last (1+ (point)))) | |
5191 (setq last (1+ (point))))) | |
5192 (setq quoted (not quoted))) | |
5193 (unless (eobp) | |
5194 (forward-char 1)))) | |
5195 (goto-char (point-max)) | |
5196 (widen) | |
5197 (forward-line 1))) | |
5198 | |
88155 | 5199 (defun message-split-line () |
5200 "Split current line, moving portion beyond point vertically down. | |
5201 If the current line has `message-yank-prefix', insert it on the new line." | |
5202 (interactive "*") | |
5203 (condition-case nil | |
5204 (split-line message-yank-prefix) ;; Emacs 22.1+ supports arg. | |
5205 (error | |
5206 (split-line)))) | |
5207 | |
17493 | 5208 (defun message-fill-header (header value) |
5209 (let ((begin (point)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5210 (fill-column 78) |
17493 | 5211 (fill-prefix "\t")) |
5212 (insert (capitalize (symbol-name header)) | |
5213 ": " | |
5214 (if (consp value) (car value) value) | |
5215 "\n") | |
5216 (save-restriction | |
5217 (narrow-to-region begin (point)) | |
5218 (fill-region-as-paragraph begin (point)) | |
5219 ;; Tapdance around looong Message-IDs. | |
5220 (forward-line -1) | |
5221 (when (looking-at "[ \t]*$") | |
5222 (message-delete-line)) | |
5223 (goto-char begin) | |
5224 (re-search-forward ":" nil t) | |
5225 (when (looking-at "\n[ \t]+") | |
5226 (replace-match " " t t)) | |
5227 (goto-char (point-max))))) | |
5228 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5229 (defun message-shorten-1 (list cut surplus) |
35147 | 5230 "Cut SURPLUS elements out of LIST, beginning with CUTth one." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5231 (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
|
5232 (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
|
5233 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5234 (defun message-shorten-references (header references) |
88155 | 5235 "Trim REFERENCES to be 21 Message-ID long or less, and fold them. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5236 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
|
5237 than 988 characters long, and if they are not, trim them until they are." |
88155 | 5238 (let ((maxcount 21) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5239 (count 0) |
88155 | 5240 (cut 2) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5241 refs) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5242 (with-temp-buffer |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5243 (insert references) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5244 (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
|
5245 ;; 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
|
5246 (while (re-search-forward "<[^>]+>" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5247 (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
|
5248 (setq refs (nreverse refs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5249 count (length refs))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5250 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5251 ;; 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
|
5252 ;; 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
|
5253 ;; elements that follow. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5254 (when (> count maxcount) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5255 (let ((surplus (- count maxcount))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5256 (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
|
5257 (decf count surplus))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5258 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5259 ;; 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
|
5260 ;; 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
|
5261 ;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5262 ;; 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
|
5263 ;; 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
|
5264 (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
|
5265 (let ((maxsize 988) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5266 (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
|
5267 (1- count))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5268 (surplus 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5269 (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
|
5270 ;; 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
|
5271 (while (> totalsize maxsize) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5272 (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
|
5273 (incf surplus) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5274 (setq ptr (cdr ptr))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5275 ;; ...and do it. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5276 (when (> surplus 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5277 (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
|
5278 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5279 ;; 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
|
5280 ;; it into the buffer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5281 (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
|
5282 (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
|
5283 (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
|
5284 refstring "\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5285 (message-fill-header header refstring))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5286 |
17493 | 5287 (defun message-position-point () |
5288 "Move point to where the user probably wants to find it." | |
5289 (message-narrow-to-headers) | |
5290 (cond | |
5291 ((re-search-forward "^[^:]+:[ \t]*$" nil t) | |
5292 (search-backward ":" ) | |
5293 (widen) | |
5294 (forward-char 1) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5295 (if (eq (char-after) ? ) |
17493 | 5296 (forward-char 1) |
5297 (insert " "))) | |
5298 (t | |
5299 (goto-char (point-max)) | |
5300 (widen) | |
5301 (forward-line 1) | |
5302 (unless (looking-at "$") | |
5303 (forward-line 2))) | |
5304 (sit-for 0))) | |
5305 | |
88155 | 5306 (defcustom message-beginning-of-line t |
5307 "Whether \\<message-mode-map>\\[message-beginning-of-line]\ | |
5308 goes to beginning of header values." | |
5309 :version "22.1" | |
5310 :group 'message-buffers | |
5311 :link '(custom-manual "(message)Movement") | |
5312 :type 'boolean) | |
5313 | |
5314 (defun message-beginning-of-line (&optional n) | |
5315 "Move point to beginning of header value or to beginning of line. | |
5316 The prefix argument N is passed directly to `beginning-of-line'. | |
5317 | |
5318 This command is identical to `beginning-of-line' if point is | |
5319 outside the message header or if the option `message-beginning-of-line' | |
5320 is nil. | |
5321 | |
5322 If point is in the message header and on a (non-continued) header | |
5323 line, move point to the beginning of the header value or the beginning of line, | |
5324 whichever is closer. If point is already at beginning of line, move point to | |
5325 beginning of header value. Therefore, repeated calls will toggle point | |
5326 between beginning of field and beginning of line." | |
5327 (interactive "p") | |
5328 (let ((zrs 'zmacs-region-stays)) | |
5329 (when (and (interactive-p) (boundp zrs)) | |
5330 (set zrs t))) | |
5331 (if (and message-beginning-of-line | |
5332 (message-point-in-header-p)) | |
5333 (let* ((here (point)) | |
5334 (bol (progn (beginning-of-line n) (point))) | |
5335 (eol (gnus-point-at-eol)) | |
5336 (eoh (re-search-forward ": *" eol t))) | |
5337 (goto-char | |
5338 (if (and eoh (or (< eoh here) (= bol here))) | |
5339 eoh bol))) | |
5340 (beginning-of-line n))) | |
5341 | |
17493 | 5342 (defun message-buffer-name (type &optional to group) |
5343 "Return a new (unique) buffer name based on TYPE and TO." | |
5344 (cond | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5345 ;; 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
|
5346 ((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
|
5347 (generate-new-buffer-name |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5348 (concat "*" type |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5349 (if to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5350 (concat " to " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5351 (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
|
5352 to) "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5353 "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5354 (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
|
5355 "*"))) |
17493 | 5356 ;; Check whether `message-generate-new-buffers' is a function, |
5357 ;; and if so, call it. | |
88155 | 5358 ((functionp message-generate-new-buffers) |
17493 | 5359 (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
|
5360 ((eq message-generate-new-buffers 'unsent) |
17493 | 5361 (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
|
5362 (concat "*unsent " type |
17493 | 5363 (if to |
5364 (concat " to " | |
5365 (or (car (mail-extract-address-components to)) | |
5366 to) "") | |
5367 "") | |
5368 (if (and group (not (string= group ""))) (concat " on " group) "") | |
5369 "*"))) | |
5370 ;; Use standard name. | |
5371 (t | |
5372 (format "*%s message*" type)))) | |
5373 | |
5374 (defun message-pop-to-buffer (name) | |
5375 "Pop to buffer NAME, and warn if it already exists and is modified." | |
5376 (let ((buffer (get-buffer name))) | |
5377 (if (and buffer | |
5378 (buffer-name buffer)) | |
5379 (progn | |
5380 (set-buffer (pop-to-buffer buffer)) | |
5381 (when (and (buffer-modified-p) | |
5382 (not (y-or-n-p | |
5383 "Message already being composed; erase? "))) | |
5384 (error "Message being composed"))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5385 (set-buffer (pop-to-buffer name))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5386 (erase-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5387 (message-mode))) |
17493 | 5388 |
5389 (defun message-do-send-housekeeping () | |
5390 "Kill old message buffers." | |
5391 ;; We might have sent this buffer already. Delete it from the | |
5392 ;; list of buffers. | |
5393 (setq message-buffer-list (delq (current-buffer) message-buffer-list)) | |
5394 (while (and message-max-buffers | |
88155 | 5395 message-buffer-list |
17493 | 5396 (>= (length message-buffer-list) message-max-buffers)) |
5397 ;; Kill the oldest buffer -- unless it has been changed. | |
5398 (let ((buffer (pop message-buffer-list))) | |
5399 (when (and (buffer-name buffer) | |
5400 (not (buffer-modified-p buffer))) | |
5401 (kill-buffer buffer)))) | |
5402 ;; Rename the buffer. | |
5403 (if message-send-rename-function | |
5404 (funcall message-send-rename-function) | |
88155 | 5405 ;; Note: mail-abbrevs of XEmacs renames buffer name behind Gnus. |
5406 (when (string-match | |
5407 "\\`\\*\\(sent \\|unsent \\)?\\(.+\\)\\*[^\\*]*\\|\\`mail to " | |
5408 (buffer-name)) | |
5409 (let ((name (match-string 2 (buffer-name))) | |
5410 to group) | |
5411 (if (not (or (null name) | |
5412 (string-equal name "mail") | |
5413 (string-equal name "posting"))) | |
5414 (setq name (concat "*sent " name "*")) | |
5415 (message-narrow-to-headers) | |
5416 (setq to (message-fetch-field "to")) | |
5417 (setq group (message-fetch-field "newsgroups")) | |
5418 (widen) | |
5419 (setq name | |
5420 (cond | |
5421 (to (concat "*sent mail to " | |
5422 (or (car (mail-extract-address-components to)) | |
5423 to) "*")) | |
5424 ((and group (not (string= group ""))) | |
5425 (concat "*sent posting on " group "*")) | |
5426 (t "*sent mail*")))) | |
5427 (unless (string-equal name (buffer-name)) | |
5428 (rename-buffer name t))))) | |
17493 | 5429 ;; Push the current buffer onto the list. |
5430 (when message-max-buffers | |
5431 (setq message-buffer-list | |
5432 (nconc message-buffer-list (list (current-buffer)))))) | |
5433 | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5434 (defun message-mail-user-agent () |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5435 (let ((mua (cond |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5436 ((not message-mail-user-agent) nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5437 ((eq message-mail-user-agent t) mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5438 (t message-mail-user-agent)))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5439 (if (memq mua '(message-user-agent gnus-user-agent)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5440 nil |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5441 mua))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5442 |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5443 (defun message-setup (headers &optional replybuffer actions switch-function) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5444 (let ((mua (message-mail-user-agent)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5445 subject to field yank-action) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5446 (if (not (and message-this-is-mail mua)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5447 (message-setup-1 headers replybuffer actions) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5448 (if replybuffer |
34859
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5449 (setq yank-action (list 'insert-buffer replybuffer))) |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5450 (setq headers (copy-sequence headers)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5451 (setq field (assq 'Subject headers)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5452 (when field |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5453 (setq subject (cdr field)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5454 (setq headers (delq field headers))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5455 (setq field (assq 'To headers)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5456 (when field |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5457 (setq to (cdr field)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5458 (setq headers (delq field headers))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5459 (let ((mail-user-agent mua)) |
35147 | 5460 (compose-mail to subject |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5461 (mapcar (lambda (item) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5462 (cons |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5463 (format "%s" (car item)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5464 (cdr item))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5465 headers) |
35147 | 5466 nil switch-function yank-action actions))))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49034
diff
changeset
|
5467 |
88155 | 5468 (defun message-headers-to-generate (headers included-headers excluded-headers) |
5469 "Return a list that includes all headers from HEADERS. | |
5470 If INCLUDED-HEADERS is a list, just include those headers. If if is | |
5471 t, include all headers. In any case, headers from EXCLUDED-HEADERS | |
5472 are not included." | |
5473 (let ((result nil) | |
5474 header-name) | |
5475 (dolist (header headers) | |
5476 (setq header-name (cond | |
5477 ((and (consp header) | |
5478 (eq (car header) 'optional)) | |
5479 ;; On the form (optional . Header) | |
5480 (cdr header)) | |
5481 ((consp header) | |
5482 ;; On the form (Header . function) | |
5483 (car header)) | |
5484 (t | |
5485 ;; Just a Header. | |
5486 header))) | |
5487 (when (and (not (memq header-name excluded-headers)) | |
5488 (or (eq included-headers t) | |
5489 (memq header-name included-headers))) | |
5490 (push header result))) | |
5491 (nreverse result))) | |
5492 | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5493 (defun message-setup-1 (headers &optional replybuffer actions) |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
5494 (dolist (action actions) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
5495 (condition-case nil |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
5496 (add-to-list 'message-send-actions |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
5497 `(apply ',(car action) ',(cdr action))))) |
17493 | 5498 (setq message-reply-buffer replybuffer) |
5499 (goto-char (point-min)) | |
5500 ;; Insert all the headers. | |
5501 (mail-header-format | |
5502 (let ((h headers) | |
5503 (alist message-header-format-alist)) | |
5504 (while h | |
5505 (unless (assq (caar h) message-header-format-alist) | |
5506 (push (list (caar h)) alist)) | |
5507 (pop h)) | |
5508 alist) | |
5509 headers) | |
5510 (delete-region (point) (progn (forward-line -1) (point))) | |
5511 (when message-default-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5512 (insert message-default-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5513 (or (bolp) (insert ?\n))) |
17493 | 5514 (put-text-property |
5515 (point) | |
5516 (progn | |
5517 (insert mail-header-separator "\n") | |
5518 (1- (point))) | |
5519 'read-only nil) | |
5520 (forward-line -1) | |
5521 (when (message-news-p) | |
5522 (when message-default-news-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5523 (insert message-default-news-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5524 (or (bolp) (insert ?\n))) |
17493 | 5525 (when message-generate-headers-first |
5526 (message-generate-headers | |
88155 | 5527 (message-headers-to-generate |
5528 (append message-required-news-headers | |
5529 message-required-headers) | |
5530 message-generate-headers-first | |
5531 '(Lines Subject))))) | |
17493 | 5532 (when (message-mail-p) |
5533 (when message-default-mail-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5534 (insert message-default-mail-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5535 (or (bolp) (insert ?\n))) |
88155 | 5536 (save-restriction |
5537 (message-narrow-to-headers) | |
5538 (if message-alternative-emails | |
5539 (message-use-alternative-email-as-from))) | |
17493 | 5540 (when message-generate-headers-first |
5541 (message-generate-headers | |
88155 | 5542 (message-headers-to-generate |
5543 (append message-required-mail-headers | |
5544 message-required-headers) | |
5545 message-generate-headers-first | |
5546 '(Lines Subject))))) | |
17493 | 5547 (run-hooks 'message-signature-setup-hook) |
5548 (message-insert-signature) | |
5549 (save-restriction | |
5550 (message-narrow-to-headers) | |
5551 (run-hooks 'message-header-setup-hook)) | |
5552 (set-buffer-modified-p nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
5553 (setq buffer-undo-list nil) |
17493 | 5554 (run-hooks 'message-setup-hook) |
5555 (message-position-point) | |
5556 (undo-boundary)) | |
5557 | |
5558 (defun message-set-auto-save-file-name () | |
5559 "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
|
5560 (when message-auto-save-directory |
34057
98bd49d8cf7d
(message-auto-save-directory): Use
Dave Love <fx@gnu.org>
parents:
33982
diff
changeset
|
5561 (unless (file-directory-p |
98bd49d8cf7d
(message-auto-save-directory): Use
Dave Love <fx@gnu.org>
parents:
33982
diff
changeset
|
5562 (directory-file-name message-auto-save-directory)) |
48376
285ddf07e772
* message.el (message-set-auto-save-file-name): Use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
47947
diff
changeset
|
5563 (make-directory message-auto-save-directory t)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5564 (if (gnus-alive-p) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5565 (setq message-draft-article |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5566 (nndraft-request-associate-buffer "drafts")) |
88155 | 5567 (setq buffer-file-name (expand-file-name |
5568 (if (memq system-type | |
5569 '(ms-dos ms-windows windows-nt | |
5570 cygwin cygwin32 win32 w32 | |
5571 mswindows)) | |
5572 "message" | |
5573 "*message*") | |
5574 message-auto-save-directory)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5575 (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
|
5576 (clear-visited-file-modtime) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5577 (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
|
5578 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5579 (defun message-disassociate-draft () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5580 "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
|
5581 (when message-draft-article |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5582 (nndraft-request-expire-articles |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5583 (list message-draft-article) "drafts" nil t))) |
17493 | 5584 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5585 (defun message-insert-headers () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5586 "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
|
5587 (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5588 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5589 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5590 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5591 (when (message-news-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5592 (message-generate-headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5593 (delq 'Lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5594 (delq 'Subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5595 (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
|
5596 (when (message-mail-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5597 (message-generate-headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5598 (delq 'Lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5599 (delq 'Subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5600 (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
|
5601 |
17493 | 5602 |
5603 | |
5604 ;;; | |
5605 ;;; Commands for interfacing with message | |
5606 ;;; | |
5607 | |
5608 ;;;###autoload | |
5609 (defun message-mail (&optional to subject | |
5610 other-headers continue switch-function | |
5611 yank-action send-actions) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5612 "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
|
5613 OTHER-HEADERS is an alist of header/value pairs." |
17493 | 5614 (interactive) |
34859
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5615 (let ((message-this-is-mail t) replybuffer) |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5616 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5617 (message-pop-to-buffer (message-buffer-name "mail" to))) |
34859
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5618 ;; FIXME: message-mail should do something if YANK-ACTION is not |
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5619 ;; insert-buffer. |
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5620 (and (consp yank-action) (eq (car yank-action) 'insert-buffer) |
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5621 (setq replybuffer (nth 1 yank-action))) |
17493 | 5622 (message-setup |
5623 (nconc | |
5624 `((To . ,(or to "")) (Subject . ,(or subject ""))) | |
34859
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5625 (when other-headers other-headers)) |
41750
a96c3ddfa03e
2001-12-01 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41511
diff
changeset
|
5626 replybuffer send-actions) |
34859
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5627 ;; FIXME: Should return nil if failure. |
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
5628 t)) |
17493 | 5629 |
5630 ;;;###autoload | |
5631 (defun message-news (&optional newsgroups subject) | |
5632 "Start editing a news article to be sent." | |
5633 (interactive) | |
5634 (let ((message-this-is-news t)) | |
88155 | 5635 (message-pop-to-buffer (message-buffer-name "posting" nil newsgroups)) |
17493 | 5636 (message-setup `((Newsgroups . ,(or newsgroups "")) |
5637 (Subject . ,(or subject "")))))) | |
5638 | |
88155 | 5639 (defun message-get-reply-headers (wide &optional to-address address-headers) |
5640 (let (follow-to mct never-mct to cc author mft recipients) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5641 ;; Find all relevant headers we need. |
88155 | 5642 (save-restriction |
5643 (message-narrow-to-headers-or-head) | |
5644 ;; Gmane renames "To". Look at "Original-To", too, if it is present in | |
5645 ;; message-header-synonyms. | |
5646 (setq to (or (message-fetch-field "to") | |
5647 (and (loop for synonym in message-header-synonyms | |
5648 when (memq 'Original-To synonym) | |
5649 return t) | |
5650 (message-fetch-field "original-to"))) | |
5651 cc (message-fetch-field "cc") | |
5652 mct (message-fetch-field "mail-copies-to") | |
5653 author (or (message-fetch-field "mail-reply-to") | |
5654 (message-fetch-field "reply-to") | |
5655 (message-fetch-field "from") | |
5656 "") | |
5657 mft (and message-use-mail-followup-to | |
5658 (message-fetch-field "mail-followup-to")))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5659 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5660 ;; 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
|
5661 (when mct |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5662 (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
|
5663 (equal (downcase mct) "nobody")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5664 (setq never-mct t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5665 (setq mct nil)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5666 ((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
|
5667 (equal (downcase mct) "poster")) |
88155 | 5668 (setq mct author)))) |
5669 | |
5670 (save-match-data | |
5671 ;; Build (textual) list of new recipient addresses. | |
5672 (cond | |
5673 ((not wide) | |
5674 (setq recipients (concat ", " author))) | |
5675 (address-headers | |
5676 (dolist (header address-headers) | |
5677 (let ((value (message-fetch-field header))) | |
5678 (when value | |
5679 (setq recipients (concat recipients ", " value)))))) | |
5680 ((and mft | |
5681 (string-match "[^ \t,]" mft) | |
5682 (or (not (eq message-use-mail-followup-to 'ask)) | |
5683 (message-y-or-n-p "Obey Mail-Followup-To? " t "\ | |
5684 You should normally obey the Mail-Followup-To: header. In this | |
5685 article, it has the value of | |
5686 | |
5687 " mft " | |
5688 | |
5689 which directs your response to " (if (string-match "," mft) | |
5690 "the specified addresses" | |
5691 "that address only") ". | |
5692 | |
5693 Most commonly, Mail-Followup-To is used by a mailing list poster to | |
5694 express that responses should be sent to just the list, and not the | |
5695 poster as well. | |
5696 | |
5697 If a message is posted to several mailing lists, Mail-Followup-To may | |
5698 also be used to direct the following discussion to one list only, | |
5699 because discussions that are spread over several lists tend to be | |
5700 fragmented and very difficult to follow. | |
5701 | |
5702 Also, some source/announcement lists are not intended for discussion; | |
5703 responses here are directed to other addresses. | |
5704 | |
5705 You may customize the variable `message-use-mail-followup-to', if you | |
5706 want to get rid of this query permanently."))) | |
5707 (setq recipients (concat ", " mft))) | |
5708 (to-address | |
5709 (setq recipients (concat ", " to-address)) | |
5710 ;; If the author explicitly asked for a copy, we don't deny it to them. | |
5711 (if mct (setq recipients (concat recipients ", " mct)))) | |
5712 (t | |
5713 (setq recipients (if never-mct "" (concat ", " author))) | |
5714 (if to (setq recipients (concat recipients ", " to))) | |
5715 (if cc (setq recipients (concat recipients ", " cc))) | |
5716 (if mct (setq recipients (concat recipients ", " mct))))) | |
5717 (if (>= (length recipients) 2) | |
5718 ;; Strip the leading ", ". | |
5719 (setq recipients (substring recipients 2))) | |
5720 ;; Squeeze whitespace. | |
5721 (while (string-match "[ \t][ \t]+" recipients) | |
5722 (setq recipients (replace-match " " t t recipients))) | |
5723 ;; Remove addresses that match `rmail-dont-reply-to-names'. | |
5724 (let ((rmail-dont-reply-to-names message-dont-reply-to-names)) | |
5725 (setq recipients (rmail-dont-reply-to recipients))) | |
5726 ;; Perhaps "Mail-Copies-To: never" removed the only address? | |
5727 (if (string-equal recipients "") | |
5728 (setq recipients author)) | |
5729 ;; Convert string to a list of (("foo@bar" . "Name <Foo@BAR>") ...). | |
5730 (setq recipients | |
5731 (mapcar | |
5732 (lambda (addr) | |
5733 (cons (downcase (mail-strip-quoted-names addr)) addr)) | |
5734 (message-tokenize-header recipients))) | |
5735 ;; Remove first duplicates. (Why not all duplicates? Is this a bug?) | |
5736 (let ((s recipients)) | |
5737 (while s | |
5738 (setq recipients (delq (assoc (car (pop s)) s) recipients)))) | |
5739 | |
5740 ;; Remove hierarchical lists that are contained within each other, | |
5741 ;; if message-hierarchical-addresses is defined. | |
5742 (when message-hierarchical-addresses | |
5743 (let ((plain-addrs (mapcar 'car recipients)) | |
5744 subaddrs recip) | |
5745 (while plain-addrs | |
5746 (setq subaddrs (assoc (car plain-addrs) | |
5747 message-hierarchical-addresses) | |
5748 plain-addrs (cdr plain-addrs)) | |
5749 (when subaddrs | |
5750 (setq subaddrs (cdr subaddrs)) | |
5751 (while subaddrs | |
5752 (setq recip (assoc (car subaddrs) recipients) | |
5753 subaddrs (cdr subaddrs)) | |
5754 (if recip | |
5755 (setq recipients (delq recip recipients)))))))) | |
5756 | |
5757 ;; Build the header alist. Allow the user to be asked whether | |
5758 ;; or not to reply to all recipients in a wide reply. | |
5759 (setq follow-to (list (cons 'To (cdr (pop recipients))))) | |
5760 (when (and recipients | |
5761 (or (not message-wide-reply-confirm-recipients) | |
5762 (y-or-n-p "Reply to all recipients? "))) | |
5763 (setq recipients (mapconcat | |
5764 (lambda (addr) (cdr addr)) recipients ", ")) | |
5765 (if (string-match "^ +" recipients) | |
5766 (setq recipients (substring recipients (match-end 0)))) | |
5767 (push (cons 'Cc recipients) follow-to))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5768 follow-to)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5769 |
17493 | 5770 ;;;###autoload |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5771 (defun message-reply (&optional to-address wide) |
17493 | 5772 "Start editing a reply to the article in the current buffer." |
5773 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5774 (require 'gnus-sum) ; for gnus-list-identifiers |
17493 | 5775 (let ((cur (current-buffer)) |
5776 from subject date reply-to to cc | |
5777 references message-id follow-to | |
5778 (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
|
5779 (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
|
5780 gnus-warning) |
17493 | 5781 (save-restriction |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
5782 (message-narrow-to-head-1) |
17493 | 5783 ;; Allow customizations to have their say. |
5784 (if (not wide) | |
5785 ;; This is a regular reply. | |
88155 | 5786 (when (functionp message-reply-to-function) |
5787 (save-excursion | |
5788 (setq follow-to (funcall message-reply-to-function)))) | |
17493 | 5789 ;; This is a followup. |
88155 | 5790 (when (functionp message-wide-reply-to-function) |
5791 (save-excursion | |
5792 (setq follow-to | |
5793 (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
|
5794 (setq message-id (message-fetch-field "message-id" t) |
17493 | 5795 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
|
5796 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
|
5797 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
|
5798 subject (or (message-fetch-field "subject") "none")) |
88155 | 5799 (when gnus-list-identifiers |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5800 (setq subject (message-strip-list-identifiers subject))) |
88155 | 5801 (setq subject (concat "Re: " (message-strip-subject-re subject))) |
5802 (when message-subject-trailing-was-query | |
5803 (setq subject (message-strip-subject-trailing-was subject))) | |
5804 | |
5805 (when (and (setq gnus-warning (message-fetch-field "gnus-warning")) | |
5806 (string-match "<[^>]+>" gnus-warning)) | |
5807 (setq message-id (match-string 0 gnus-warning))) | |
5808 | |
5809 (unless follow-to | |
5810 (setq follow-to (message-get-reply-headers wide to-address)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5811 |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5812 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5813 (message-pop-to-buffer |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5814 (message-buffer-name |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5815 (if wide "wide reply" "reply") from |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
5816 (if wide to-address nil)))) |
17493 | 5817 |
5818 (setq message-reply-headers | |
5819 (vector 0 subject from date message-id references 0 0 "")) | |
5820 | |
5821 (message-setup | |
5822 `((Subject . ,subject) | |
88155 | 5823 ,@follow-to) |
17493 | 5824 cur))) |
5825 | |
5826 ;;;###autoload | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5827 (defun message-wide-reply (&optional to-address) |
17493 | 5828 "Make a \"wide\" reply to the message in the current buffer." |
5829 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5830 (message-reply to-address t)) |
17493 | 5831 |
5832 ;;;###autoload | |
5833 (defun message-followup (&optional to-newsgroups) | |
5834 "Follow up to the message in the current buffer. | |
5835 If TO-NEWSGROUPS, use that as the new Newsgroups line." | |
5836 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5837 (require 'gnus-sum) ; for gnus-list-identifiers |
17493 | 5838 (let ((cur (current-buffer)) |
88155 | 5839 from subject date reply-to mrt mct |
17493 | 5840 references message-id follow-to |
5841 (inhibit-point-motion-hooks t) | |
5842 (message-this-is-news t) | |
5843 followup-to distribution newsgroups gnus-warning posted-to) | |
5844 (save-restriction | |
5845 (narrow-to-region | |
5846 (goto-char (point-min)) | |
5847 (if (search-forward "\n\n" nil t) | |
5848 (1- (point)) | |
5849 (point-max))) | |
88155 | 5850 (when (functionp message-followup-to-function) |
17493 | 5851 (setq follow-to |
5852 (funcall message-followup-to-function))) | |
5853 (setq from (message-fetch-field "from") | |
5854 date (message-fetch-field "date") | |
5855 subject (or (message-fetch-field "subject") "none") | |
5856 references (message-fetch-field "references") | |
5857 message-id (message-fetch-field "message-id" t) | |
5858 followup-to (message-fetch-field "followup-to") | |
5859 newsgroups (message-fetch-field "newsgroups") | |
5860 posted-to (message-fetch-field "posted-to") | |
5861 reply-to (message-fetch-field "reply-to") | |
88155 | 5862 mrt (message-fetch-field "mail-reply-to") |
17493 | 5863 distribution (message-fetch-field "distribution") |
5864 mct (message-fetch-field "mail-copies-to")) | |
5865 (when (and (setq gnus-warning (message-fetch-field "gnus-warning")) | |
5866 (string-match "<[^>]+>" gnus-warning)) | |
5867 (setq message-id (match-string 0 gnus-warning))) | |
5868 ;; Remove bogus distribution. | |
5869 (when (and (stringp distribution) | |
5870 (let ((case-fold-search t)) | |
5871 (string-match "world" distribution))) | |
5872 (setq distribution nil)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5873 (if gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5874 (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
|
5875 (setq subject (concat "Re: " (message-strip-subject-re subject))) |
88155 | 5876 (when message-subject-trailing-was-query |
5877 (setq subject (message-strip-subject-trailing-was subject))) | |
17493 | 5878 (widen)) |
5879 | |
5880 (message-pop-to-buffer (message-buffer-name "followup" from newsgroups)) | |
5881 | |
88155 | 5882 (setq message-reply-headers |
5883 (vector 0 subject from date message-id references 0 0 "")) | |
5884 | |
17493 | 5885 (message-setup |
5886 `((Subject . ,subject) | |
5887 ,@(cond | |
5888 (to-newsgroups | |
5889 (list (cons 'Newsgroups to-newsgroups))) | |
5890 (follow-to follow-to) | |
5891 ((and followup-to message-use-followup-to) | |
5892 (list | |
5893 (cond | |
5894 ((equal (downcase followup-to) "poster") | |
5895 (if (or (eq message-use-followup-to 'use) | |
5896 (message-y-or-n-p "Obey Followup-To: poster? " t "\ | |
5897 You should normally obey the Followup-To: header. | |
5898 | |
5899 `Followup-To: poster' sends your response via e-mail instead of news. | |
5900 | |
5901 A typical situation where `Followup-To: poster' is used is when the poster | |
88155 | 5902 does not read the newsgroup, so he wouldn't see any replies sent to it. |
5903 | |
5904 You may customize the variable `message-use-followup-to', if you | |
5905 want to get rid of this query permanently.")) | |
17493 | 5906 (progn |
5907 (setq message-this-is-news nil) | |
88155 | 5908 (cons 'To (or mrt reply-to from ""))) |
17493 | 5909 (cons 'Newsgroups newsgroups))) |
5910 (t | |
5911 (if (or (equal followup-to newsgroups) | |
5912 (not (eq message-use-followup-to 'ask)) | |
5913 (message-y-or-n-p | |
5914 (concat "Obey Followup-To: " followup-to "? ") t "\ | |
5915 You should normally obey the Followup-To: header. | |
5916 | |
5917 `Followup-To: " followup-to "' | |
5918 directs your response to " (if (string-match "," followup-to) | |
5919 "the specified newsgroups" | |
5920 "that newsgroup only") ". | |
5921 | |
5922 If a message is posted to several newsgroups, Followup-To is often | |
5923 used to direct the following discussion to one newsgroup only, | |
5924 because discussions that are spread over several newsgroup tend to | |
5925 be fragmented and very difficult to follow. | |
5926 | |
88155 | 5927 Also, some source/announcement newsgroups are not intended for discussion; |
5928 responses here are directed to other newsgroups. | |
5929 | |
5930 You may customize the variable `message-use-followup-to', if you | |
5931 want to get rid of this query permanently.")) | |
17493 | 5932 (cons 'Newsgroups followup-to) |
5933 (cons 'Newsgroups newsgroups)))))) | |
5934 (posted-to | |
5935 `((Newsgroups . ,posted-to))) | |
5936 (t | |
5937 `((Newsgroups . ,newsgroups)))) | |
5938 ,@(and distribution (list (cons 'Distribution distribution))) | |
5939 ,@(when (and mct | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5940 (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
|
5941 (equal (downcase mct) "nobody")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5942 (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
|
5943 (equal (downcase mct) "poster")) |
88155 | 5944 (or mrt reply-to from "") |
17493 | 5945 mct))))) |
5946 | |
88155 | 5947 cur))) |
5948 | |
5949 (defun message-is-yours-p () | |
5950 "Non-nil means current article is yours. | |
5951 If you have added 'cancel-messages to `message-shoot-gnksa-feet', all articles | |
5952 are yours except those that have Cancel-Lock header not belonging to you. | |
5953 Instead of shooting GNKSA feet, you should modify `message-alternative-emails' | |
5954 regexp to match all of yours addresses." | |
5955 ;; Canlock-logic as suggested by Per Abrahamsen | |
5956 ;; <abraham@dina.kvl.dk> | |
5957 ;; | |
5958 ;; IF article has cancel-lock THEN | |
5959 ;; IF we can verify it THEN | |
5960 ;; issue cancel | |
5961 ;; ELSE | |
5962 ;; error: cancellock: article is not yours | |
5963 ;; ELSE | |
5964 ;; Use old rules, comparing sender... | |
5965 (save-excursion | |
5966 (save-restriction | |
5967 (message-narrow-to-head-1) | |
5968 (if (message-fetch-field "Cancel-Lock") | |
5969 (if (null (canlock-verify)) | |
5970 t | |
5971 (error "Failed to verify Cancel-lock: This article is not yours")) | |
5972 (let (sender from) | |
5973 (or | |
5974 (message-gnksa-enable-p 'cancel-messages) | |
5975 (and (setq sender (message-fetch-field "sender")) | |
5976 (string-equal (downcase sender) | |
5977 (downcase (message-make-sender)))) | |
5978 ;; Email address in From field equals to our address | |
5979 (and (setq from (message-fetch-field "from")) | |
5980 (string-equal | |
5981 (downcase (cadr (mail-extract-address-components from))) | |
5982 (downcase (cadr (mail-extract-address-components | |
5983 (message-make-from)))))) | |
5984 ;; Email address in From field matches | |
5985 ;; 'message-alternative-emails' regexp | |
5986 (and from | |
5987 message-alternative-emails | |
5988 (string-match | |
5989 message-alternative-emails | |
5990 (cadr (mail-extract-address-components from)))))))))) | |
17493 | 5991 |
5992 ;;;###autoload | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
5993 (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
|
5994 "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
|
5995 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
|
5996 (interactive "P") |
17493 | 5997 (unless (message-news-p) |
5998 (error "This is not a news article; canceling is impossible")) | |
88155 | 5999 (let (from newsgroups message-id distribution buf) |
6000 (save-excursion | |
6001 ;; Get header info from original article. | |
6002 (save-restriction | |
6003 (message-narrow-to-head-1) | |
6004 (setq from (message-fetch-field "from") | |
6005 newsgroups (message-fetch-field "newsgroups") | |
6006 message-id (message-fetch-field "message-id" t) | |
6007 distribution (message-fetch-field "distribution"))) | |
6008 ;; Make sure that this article was written by the user. | |
6009 (unless (message-is-yours-p) | |
6010 (error "This article is not yours")) | |
6011 (when (yes-or-no-p "Do you really want to cancel this article? ") | |
17493 | 6012 ;; Make control message. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6013 (if arg |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6014 (message-news) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6015 (setq buf (set-buffer (get-buffer-create " *message cancel*")))) |
17493 | 6016 (erase-buffer) |
6017 (insert "Newsgroups: " newsgroups "\n" | |
88155 | 6018 "From: " from "\n" |
17493 | 6019 "Subject: cmsg cancel " message-id "\n" |
6020 "Control: cancel " message-id "\n" | |
6021 (if distribution | |
6022 (concat "Distribution: " distribution "\n") | |
6023 "") | |
6024 mail-header-separator "\n" | |
6025 message-cancel-message) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6026 (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
|
6027 (unless arg |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6028 (message "Canceling your article...") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6029 (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
|
6030 '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
|
6031 (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
|
6032 (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
|
6033 (kill-buffer buf)))))) |
17493 | 6034 |
6035 ;;;###autoload | |
6036 (defun message-supersede () | |
6037 "Start composing a message to supersede the current message. | |
6038 This is done simply by taking the old article and adding a Supersedes | |
6039 header line with the old Message-ID." | |
6040 (interactive) | |
88155 | 6041 (let ((cur (current-buffer))) |
17493 | 6042 ;; Check whether the user owns the article that is to be superseded. |
88155 | 6043 (unless (message-is-yours-p) |
17493 | 6044 (error "This article is not yours")) |
6045 ;; Get a normal message buffer. | |
6046 (message-pop-to-buffer (message-buffer-name "supersede")) | |
6047 (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
|
6048 (mime-to-mml) |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6049 (message-narrow-to-head-1) |
17493 | 6050 ;; Remove unwanted headers. |
6051 (when message-ignored-supersedes-headers | |
6052 (message-remove-header message-ignored-supersedes-headers t)) | |
6053 (goto-char (point-min)) | |
6054 (if (not (re-search-forward "^Message-ID: " nil t)) | |
6055 (error "No Message-ID in this article") | |
6056 (replace-match "Supersedes: " t t)) | |
6057 (goto-char (point-max)) | |
6058 (insert mail-header-separator) | |
6059 (widen) | |
6060 (forward-line 1))) | |
6061 | |
6062 ;;;###autoload | |
6063 (defun message-recover () | |
6064 "Reread contents of current buffer from its last auto-save file." | |
6065 (interactive) | |
6066 (let ((file-name (make-auto-save-file-name))) | |
6067 (cond ((save-window-excursion | |
6068 (if (not (eq system-type 'vax-vms)) | |
6069 (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
|
6070 (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
|
6071 (fundamental-mode)) ; for Emacs 20.4+ |
17493 | 6072 (buffer-disable-undo standard-output) |
6073 (let ((default-directory "/")) | |
6074 (call-process | |
6075 "ls" nil standard-output nil "-l" file-name)))) | |
6076 (yes-or-no-p (format "Recover auto save file %s? " file-name))) | |
6077 (let ((buffer-read-only nil)) | |
6078 (erase-buffer) | |
6079 (insert-file-contents file-name nil))) | |
6080 (t (error "message-recover cancelled"))))) | |
6081 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6082 ;;; Washing Subject: |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6083 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6084 (defun message-wash-subject (subject) |
35147 | 6085 "Remove junk like \"Re:\", \"(fwd)\", etc. added to subject string SUBJECT. |
6086 Previous forwarders, replyers, etc. may add it." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6087 (with-temp-buffer |
41494
933ab100fb4a
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36856
diff
changeset
|
6088 (insert subject) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6089 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6090 ;; 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
|
6091 (while (re-search-forward |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6092 "\\([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
|
6093 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6094 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6095 ;; 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
|
6096 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6097 (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
|
6098 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6099 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6100 ;; and off the end |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6101 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6102 (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
|
6103 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6104 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6105 ;; 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
|
6106 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6107 (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
|
6108 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6109 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6110 (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
|
6111 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6112 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6113 (buffer-string))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6114 |
17493 | 6115 ;;; Forwarding messages. |
6116 | |
36856
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6117 (defvar message-forward-decoded-p nil |
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6118 "Non-nil means the original message is decoded.") |
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6119 |
88155 | 6120 (defun message-forward-subject-name-subject (subject) |
6121 "Generate a SUBJECT for a forwarded message. | |
6122 The form is: [Source] Subject, where if the original message was mail, | |
6123 Source is the name of the sender, and if the original message was | |
6124 news, Source is the list of newsgroups is was posted to." | |
6125 (let* ((group (message-fetch-field "newsgroups")) | |
6126 (from (message-fetch-field "from")) | |
6127 (prefix | |
6128 (if group | |
6129 (gnus-group-decoded-name group) | |
6130 (or (and from (car (gnus-extract-address-components from))) | |
6131 "(nowhere)")))) | |
6132 (concat "[" | |
6133 (if message-forward-decoded-p | |
6134 prefix | |
6135 (mail-decode-encoded-word-string prefix)) | |
6136 "] " subject))) | |
6137 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6138 (defun message-forward-subject-author-subject (subject) |
35147 | 6139 "Generate a SUBJECT for a forwarded message. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6140 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
|
6141 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
|
6142 the list of newsgroups is was posted to." |
88155 | 6143 (let* ((group (message-fetch-field "newsgroups")) |
6144 (prefix | |
6145 (if group | |
6146 (gnus-group-decoded-name group) | |
6147 (or (message-fetch-field "from") | |
6148 "(nowhere)")))) | |
6149 (concat "[" | |
6150 (if message-forward-decoded-p | |
6151 prefix | |
6152 (mail-decode-encoded-word-string prefix)) | |
6153 "] " subject))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6154 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6155 (defun message-forward-subject-fwd (subject) |
35147 | 6156 "Generate a SUBJECT for a forwarded message. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6157 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
|
6158 the message." |
88155 | 6159 (if (string-match "^Fwd: " subject) |
6160 subject | |
6161 (concat "Fwd: " subject))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6162 |
36856
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6163 (defun message-make-forward-subject () |
17493 | 6164 "Return a Subject header suitable for the message in the current buffer." |
6165 (save-excursion | |
6166 (save-restriction | |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6167 (message-narrow-to-head-1) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6168 (let ((funcs message-make-forward-subject-function) |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6169 (subject (message-fetch-field "Subject"))) |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6170 (setq subject |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6171 (if subject |
36856
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6172 (if message-forward-decoded-p |
35957
a35d9c07d074
2001-02-07 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35453
diff
changeset
|
6173 subject |
a35d9c07d074
2001-02-07 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35453
diff
changeset
|
6174 (mail-decode-encoded-word-string subject)) |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6175 "")) |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6176 (if message-wash-forwarded-subjects |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6177 (setq subject (message-wash-subject subject))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6178 ;; Make sure funcs is a list. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6179 (and funcs |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6180 (not (listp funcs)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6181 (setq funcs (list funcs))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6182 ;; 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
|
6183 ;; func to the next one. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6184 (while funcs |
88155 | 6185 (when (functionp (car funcs)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6186 (setq subject (funcall (car funcs) subject))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6187 (setq funcs (cdr funcs))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6188 subject)))) |
17493 | 6189 |
36856
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6190 (eval-when-compile |
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6191 (defvar gnus-article-decoded-p)) |
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6192 |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6193 |
17493 | 6194 ;;;###autoload |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6195 (defun message-forward (&optional news digest) |
17493 | 6196 "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
|
6197 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
|
6198 Optional DIGEST will use digest to forward." |
17493 | 6199 (interactive "P") |
36856
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6200 (let* ((cur (current-buffer)) |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6201 (message-forward-decoded-p |
36856
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6202 (if (local-variable-p 'gnus-article-decoded-p (current-buffer)) |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6203 gnus-article-decoded-p ;; In an article buffer. |
36856
e11fd97820c0
2001-03-17 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
36036
diff
changeset
|
6204 message-forward-decoded-p)) |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6205 (subject (message-make-forward-subject))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6206 (if news |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6207 (message-news nil subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6208 (message-mail nil subject)) |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6209 (message-forward-make-body cur digest))) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6210 |
88155 | 6211 (defun message-forward-make-body-plain (forward-buffer) |
6212 (insert | |
6213 "\n-------------------- Start of forwarded message --------------------\n") | |
6214 (let ((b (point)) e) | |
6215 (insert | |
6216 (with-temp-buffer | |
6217 (mm-disable-multibyte) | |
6218 (insert | |
6219 (with-current-buffer forward-buffer | |
6220 (mm-with-unibyte-current-buffer (buffer-string)))) | |
6221 (mm-enable-multibyte) | |
6222 (mime-to-mml) | |
6223 (goto-char (point-min)) | |
6224 (when (looking-at "From ") | |
6225 (replace-match "X-From-Line: ")) | |
6226 (buffer-string))) | |
6227 (setq e (point)) | |
6228 (insert | |
6229 "\n-------------------- End of forwarded message --------------------\n") | |
6230 (when message-forward-ignored-headers | |
6231 (save-restriction | |
6232 (narrow-to-region b e) | |
6233 (goto-char b) | |
6234 (narrow-to-region (point) | |
6235 (or (search-forward "\n\n" nil t) (point))) | |
6236 (message-remove-header message-forward-ignored-headers t))))) | |
6237 | |
6238 (defun message-forward-make-body-mime (forward-buffer) | |
6239 (insert "\n\n<#part type=message/rfc822 disposition=inline raw=t>\n") | |
6240 (let ((b (point)) e) | |
6241 (save-restriction | |
6242 (narrow-to-region (point) (point)) | |
6243 (mml-insert-buffer forward-buffer) | |
6244 (goto-char (point-min)) | |
6245 (when (looking-at "From ") | |
6246 (replace-match "X-From-Line: ")) | |
6247 (goto-char (point-max))) | |
6248 (setq e (point)) | |
6249 (insert "<#/part>\n"))) | |
6250 | |
6251 (defun message-forward-make-body-mml (forward-buffer) | |
6252 (insert "\n\n<#mml type=message/rfc822 disposition=inline>\n") | |
6253 (let ((b (point)) e) | |
6254 (if (not message-forward-decoded-p) | |
6255 (insert | |
6256 (with-temp-buffer | |
6257 (mm-disable-multibyte) | |
6258 (insert | |
6259 (with-current-buffer forward-buffer | |
6260 (mm-with-unibyte-current-buffer (buffer-string)))) | |
6261 (mm-enable-multibyte) | |
6262 (mime-to-mml) | |
6263 (goto-char (point-min)) | |
6264 (when (looking-at "From ") | |
6265 (replace-match "X-From-Line: ")) | |
6266 (buffer-string))) | |
6267 (save-restriction | |
6268 (narrow-to-region (point) (point)) | |
6269 (mml-insert-buffer forward-buffer) | |
6270 (goto-char (point-min)) | |
6271 (when (looking-at "From ") | |
6272 (replace-match "X-From-Line: ")) | |
6273 (goto-char (point-max)))) | |
6274 (setq e (point)) | |
6275 (insert "<#/mml>\n") | |
6276 (when (and (not message-forward-decoded-p) | |
6277 message-forward-ignored-headers) | |
6278 (save-restriction | |
6279 (narrow-to-region b e) | |
6280 (goto-char b) | |
6281 (narrow-to-region (point) | |
6282 (or (search-forward "\n\n" nil t) (point))) | |
6283 (message-remove-header message-forward-ignored-headers t))))) | |
6284 | |
6285 (defun message-forward-make-body-digest-plain (forward-buffer) | |
6286 (insert | |
6287 "\n-------------------- Start of forwarded message --------------------\n") | |
6288 (let ((b (point)) e) | |
6289 (mml-insert-buffer forward-buffer) | |
6290 (setq e (point)) | |
6291 (insert | |
6292 "\n-------------------- End of forwarded message --------------------\n"))) | |
6293 | |
6294 (defun message-forward-make-body-digest-mime (forward-buffer) | |
6295 (insert "\n<#multipart type=digest>\n") | |
6296 (let ((b (point)) e) | |
6297 (insert-buffer-substring forward-buffer) | |
6298 (setq e (point)) | |
6299 (insert "<#/multipart>\n") | |
6300 (save-restriction | |
6301 (narrow-to-region b e) | |
6302 (goto-char b) | |
6303 (narrow-to-region (point) | |
6304 (or (search-forward "\n\n" nil t) (point))) | |
6305 (delete-region (point-min) (point-max))))) | |
6306 | |
6307 (defun message-forward-make-body-digest (forward-buffer) | |
6308 (if message-forward-as-mime | |
6309 (message-forward-make-body-digest-mime forward-buffer) | |
6310 (message-forward-make-body-digest-plain forward-buffer))) | |
6311 | |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6312 ;;;###autoload |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6313 (defun message-forward-make-body (forward-buffer &optional digest) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6314 ;; Put point where we want it before inserting the forwarded |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6315 ;; message. |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6316 (if message-forward-before-signature |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6317 (message-goto-body) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6318 (goto-char (point-max))) |
88155 | 6319 (if digest |
6320 (message-forward-make-body-digest forward-buffer) | |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6321 (if message-forward-as-mime |
88155 | 6322 (if (and message-forward-show-mml |
6323 (not (and (eq message-forward-show-mml 'best) | |
6324 (with-current-buffer forward-buffer | |
6325 (goto-char (point-min)) | |
6326 (re-search-forward | |
6327 "Content-Type: *multipart/\\(signed\\|encrypted\\)" | |
6328 nil t))))) | |
6329 (message-forward-make-body-mml forward-buffer) | |
6330 (message-forward-make-body-mime forward-buffer)) | |
6331 (message-forward-make-body-plain forward-buffer))) | |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6332 (message-position-point)) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6333 |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6334 ;;;###autoload |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6335 (defun message-forward-rmail-make-body (forward-buffer) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6336 (save-window-excursion |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6337 (set-buffer forward-buffer) |
88155 | 6338 ;; Rmail doesn't have rmail-msg-restore-non-pruned-header in Emacs |
6339 ;; 20. FIXIT, or we drop support for rmail in Emacs 20. | |
43075
e14b8be37d7d
* message.el (message-forward-rmail-make-body): Directly use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
42475
diff
changeset
|
6340 (if (rmail-msg-is-pruned) |
e14b8be37d7d
* message.el (message-forward-rmail-make-body): Directly use
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
42475
diff
changeset
|
6341 (rmail-msg-restore-non-pruned-header))) |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6342 (message-forward-make-body forward-buffer)) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6343 |
88155 | 6344 (eval-when-compile (defvar rmail-enable-mime-composing)) |
6345 | |
6346 ;; Fixme: Should have defcustom. | |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6347 ;;;###autoload |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6348 (defun message-insinuate-rmail () |
88155 | 6349 "Let RMAIL use message to forward." |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6350 (interactive) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6351 (setq rmail-enable-mime-composing t) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
49034
diff
changeset
|
6352 (setq rmail-insert-mime-forwarded-message-function |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6353 'message-forward-rmail-make-body)) |
17493 | 6354 |
6355 ;;;###autoload | |
6356 (defun message-resend (address) | |
6357 "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
|
6358 (interactive |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6359 (list (message-read-from-minibuffer "Resend message to: "))) |
17493 | 6360 (message "Resending message to %s..." address) |
6361 (save-excursion | |
6362 (let ((cur (current-buffer)) | |
6363 beg) | |
6364 ;; We first set up a normal mail buffer. | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6365 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6366 (set-buffer (get-buffer-create " *message resend*")) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6367 (erase-buffer)) |
88155 | 6368 (let ((message-this-is-mail t) |
6369 message-setup-hook) | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6370 (message-setup `((To . ,address)))) |
17493 | 6371 ;; Insert our usual headers. |
88155 | 6372 (message-generate-headers '(From Date To Message-ID)) |
17493 | 6373 (message-narrow-to-headers) |
88155 | 6374 ;; Remove X-Draft-From header etc. |
6375 (message-remove-header message-ignored-mail-headers t) | |
17493 | 6376 ;; Rename them all to "Resent-*". |
88155 | 6377 (goto-char (point-min)) |
17493 | 6378 (while (re-search-forward "^[A-Za-z]" nil t) |
6379 (forward-char -1) | |
6380 (insert "Resent-")) | |
6381 (widen) | |
6382 (forward-line) | |
6383 (delete-region (point) (point-max)) | |
6384 (setq beg (point)) | |
6385 ;; Insert the message to be resent. | |
6386 (insert-buffer-substring cur) | |
6387 (goto-char (point-min)) | |
6388 (search-forward "\n\n") | |
6389 (forward-char -1) | |
6390 (save-restriction | |
6391 (narrow-to-region beg (point)) | |
6392 (message-remove-header message-ignored-resent-headers t) | |
6393 (goto-char (point-max))) | |
6394 (insert mail-header-separator) | |
6395 ;; 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
|
6396 (while (re-search-backward "^\\(Also-\\)*Resent-" beg t) |
17493 | 6397 (beginning-of-line) |
6398 (insert "Also-")) | |
6399 ;; Quote any "From " lines at the beginning. | |
6400 (goto-char beg) | |
6401 (when (looking-at "From ") | |
6402 (replace-match "X-From-Line: ")) | |
6403 ;; Send it. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6404 (let ((message-inhibit-body-encoding t) |
88155 | 6405 message-required-mail-headers |
6406 rfc2047-encode-encoded-words) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6407 (message-send-mail)) |
17493 | 6408 (kill-buffer (current-buffer))) |
6409 (message "Resending message to %s...done" address))) | |
6410 | |
6411 ;;;###autoload | |
6412 (defun message-bounce () | |
6413 "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
|
6414 This only makes sense if the current message is a bounce message that |
17493 | 6415 contains some mail you have written which has been bounced back to |
6416 you." | |
6417 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6418 (let ((handles (mm-dissect-buffer t)) |
17493 | 6419 boundary) |
6420 (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
|
6421 (if (stringp (car handles)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6422 ;; 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
|
6423 (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
|
6424 ;; 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
|
6425 ;; manually. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6426 (mm-insert-part handles) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6427 (undo-boundary) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6428 (goto-char (point-min)) |
88155 | 6429 (re-search-forward "\n\n+" nil t) |
6430 (setq boundary (point)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6431 ;; We remove everything before the bounced mail. |
88155 | 6432 (if (or (re-search-forward message-unsent-separator nil t) |
6433 (progn | |
6434 (search-forward "\n\n" nil 'move) | |
6435 (re-search-backward "^Return-Path:.*\n" boundary t))) | |
6436 (progn | |
6437 (forward-line 1) | |
6438 (delete-region (point-min) | |
6439 (if (re-search-forward "^[^ \n\t]+:" nil t) | |
6440 (match-beginning 0) | |
6441 (point)))) | |
6442 (goto-char boundary) | |
6443 (when (re-search-backward "^.?From .*\n" nil t) | |
6444 (delete-region (match-beginning 0) (match-end 0))))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6445 (mm-enable-multibyte) |
17493 | 6446 (save-restriction |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
6447 (message-narrow-to-head-1) |
17493 | 6448 (message-remove-header message-ignored-bounced-headers t) |
6449 (goto-char (point-max)) | |
6450 (insert mail-header-separator)) | |
6451 (message-position-point))) | |
6452 | |
6453 ;;; | |
6454 ;;; Interactive entry points for new message buffers. | |
6455 ;;; | |
6456 | |
6457 ;;;###autoload | |
6458 (defun message-mail-other-window (&optional to subject) | |
6459 "Like `message-mail' command, but display mail buffer in another window." | |
6460 (interactive) | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6461 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6462 (let ((pop-up-windows t) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6463 (special-display-buffer-names nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6464 (special-display-regexps nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6465 (same-window-buffer-names nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6466 (same-window-regexps nil)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6467 (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
|
6468 (let ((message-this-is-mail t)) |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6469 (message-setup `((To . ,(or to "")) (Subject . ,(or subject ""))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6470 nil nil 'switch-to-buffer-other-window))) |
17493 | 6471 |
6472 ;;;###autoload | |
6473 (defun message-mail-other-frame (&optional to subject) | |
6474 "Like `message-mail' command, but display mail buffer in another frame." | |
6475 (interactive) | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6476 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6477 (let ((pop-up-frames t) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6478 (special-display-buffer-names nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6479 (special-display-regexps nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6480 (same-window-buffer-names nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6481 (same-window-regexps nil)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6482 (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
|
6483 (let ((message-this-is-mail t)) |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6484 (message-setup `((To . ,(or to "")) (Subject . ,(or subject ""))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
6485 nil nil 'switch-to-buffer-other-frame))) |
17493 | 6486 |
6487 ;;;###autoload | |
6488 (defun message-news-other-window (&optional newsgroups subject) | |
6489 "Start editing a news article to be sent." | |
6490 (interactive) | |
6491 (let ((pop-up-windows t) | |
6492 (special-display-buffer-names nil) | |
6493 (special-display-regexps nil) | |
6494 (same-window-buffer-names nil) | |
6495 (same-window-regexps nil)) | |
88155 | 6496 (message-pop-to-buffer (message-buffer-name "posting" nil newsgroups))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6497 (let ((message-this-is-news t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6498 (message-setup `((Newsgroups . ,(or newsgroups "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6499 (Subject . ,(or subject "")))))) |
17493 | 6500 |
6501 ;;;###autoload | |
6502 (defun message-news-other-frame (&optional newsgroups subject) | |
6503 "Start editing a news article to be sent." | |
6504 (interactive) | |
6505 (let ((pop-up-frames t) | |
6506 (special-display-buffer-names nil) | |
6507 (special-display-regexps nil) | |
6508 (same-window-buffer-names nil) | |
6509 (same-window-regexps nil)) | |
88155 | 6510 (message-pop-to-buffer (message-buffer-name "posting" nil newsgroups))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6511 (let ((message-this-is-news t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6512 (message-setup `((Newsgroups . ,(or newsgroups "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6513 (Subject . ,(or subject "")))))) |
17493 | 6514 |
6515 ;;; underline.el | |
6516 | |
6517 ;; This code should be moved to underline.el (from which it is stolen). | |
6518 | |
6519 ;;;###autoload | |
6520 (defun bold-region (start end) | |
6521 "Bold all nonblank characters in the region. | |
6522 Works by overstriking characters. | |
6523 Called from program, takes two arguments START and END | |
6524 which specify the range to operate on." | |
6525 (interactive "r") | |
6526 (save-excursion | |
6527 (let ((end1 (make-marker))) | |
6528 (move-marker end1 (max start end)) | |
6529 (goto-char (min start end)) | |
6530 (while (< (point) end1) | |
6531 (or (looking-at "[_\^@- ]") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6532 (insert (char-after) "\b")) |
17493 | 6533 (forward-char 1))))) |
6534 | |
6535 ;;;###autoload | |
6536 (defun unbold-region (start end) | |
6537 "Remove all boldness (overstruck characters) in the region. | |
6538 Called from program, takes two arguments START and END | |
6539 which specify the range to operate on." | |
6540 (interactive "r") | |
6541 (save-excursion | |
6542 (let ((end1 (make-marker))) | |
6543 (move-marker end1 (max start end)) | |
6544 (goto-char (min start end)) | |
6545 (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
|
6546 (if (eq (char-after) (char-after (- (point) 2))) |
17493 | 6547 (delete-char -2)))))) |
6548 | |
88155 | 6549 (defun message-exchange-point-and-mark () |
6550 "Exchange point and mark, but don't activate region if it was inactive." | |
6551 (unless (prog1 | |
6552 (message-mark-active-p) | |
6553 (exchange-point-and-mark)) | |
6554 (setq mark-active nil))) | |
6555 | |
6556 (defalias 'message-make-overlay 'make-overlay) | |
6557 (defalias 'message-delete-overlay 'delete-overlay) | |
6558 (defalias 'message-overlay-put 'overlay-put) | |
6559 (defun message-kill-all-overlays () | |
6560 (if (featurep 'xemacs) | |
6561 (map-extents (lambda (extent ignore) (delete-extent extent))) | |
6562 (mapcar #'delete-overlay (overlays-in (point-min) (point-max))))) | |
17493 | 6563 |
6564 ;; Support for toolbar | |
88155 | 6565 (eval-when-compile |
6566 (defvar tool-bar-map) | |
6567 (defvar tool-bar-mode)) | |
6568 | |
6569 (defun message-tool-bar-local-item-from-menu (command icon in-map &optional from-map &rest props) | |
6570 ;; We need to make tool bar entries in local keymaps with | |
6571 ;; `tool-bar-local-item-from-menu' in Emacs >= 22 | |
6572 (if (fboundp 'tool-bar-local-item-from-menu) | |
6573 (tool-bar-local-item-from-menu command icon in-map from-map props) | |
6574 (tool-bar-add-item-from-menu command icon from-map props))) | |
6575 | |
6576 (defun message-tool-bar-map () | |
6577 (or message-tool-bar-map | |
6578 (setq message-tool-bar-map | |
6579 (and | |
6580 (condition-case nil (require 'tool-bar) (error nil)) | |
6581 (fboundp 'tool-bar-add-item-from-menu) | |
6582 tool-bar-mode | |
6583 (let ((tool-bar-map (copy-keymap tool-bar-map)) | |
6584 (load-path (mm-image-load-path))) | |
6585 ;; Zap some items which aren't so relevant and take | |
6586 ;; up space. | |
6587 (dolist (key '(print-buffer kill-buffer save-buffer | |
6588 write-file dired open-file)) | |
6589 (define-key tool-bar-map (vector key) nil)) | |
6590 (message-tool-bar-local-item-from-menu | |
6591 'message-send-and-exit "mail/send" tool-bar-map message-mode-map) | |
6592 (message-tool-bar-local-item-from-menu | |
6593 'message-kill-buffer "close" tool-bar-map message-mode-map) | |
6594 (message-tool-bar-local-item-from-menu | |
6595 'message-dont-send "cancel" tool-bar-map message-mode-map) | |
6596 (message-tool-bar-local-item-from-menu | |
6597 'mml-attach-file "attach" tool-bar-map mml-mode-map) | |
6598 (message-tool-bar-local-item-from-menu | |
6599 'ispell-message "spell" tool-bar-map message-mode-map) | |
6600 (message-tool-bar-local-item-from-menu | |
6601 'mml-preview "preview" | |
6602 tool-bar-map mml-mode-map) | |
6603 (message-tool-bar-local-item-from-menu | |
6604 'message-insert-importance-high "important" | |
6605 tool-bar-map message-mode-map) | |
6606 (message-tool-bar-local-item-from-menu | |
6607 'message-insert-importance-low "unimportant" | |
6608 tool-bar-map message-mode-map) | |
6609 (message-tool-bar-local-item-from-menu | |
6610 'message-insert-disposition-notification-to "receipt" | |
6611 tool-bar-map message-mode-map) | |
6612 tool-bar-map))))) | |
17493 | 6613 |
6614 ;;; Group name completion. | |
6615 | |
88155 | 6616 (defcustom message-newgroups-header-regexp |
17493 | 6617 "^\\(Newsgroups\\|Followup-To\\|Posted-To\\|Gcc\\):" |
88155 | 6618 "Regexp that match headers that lists groups." |
6619 :group 'message | |
6620 :type 'regexp) | |
6621 | |
6622 (defcustom message-completion-alist | |
6623 (list (cons message-newgroups-header-regexp 'message-expand-group) | |
6624 '("^\\(Resent-\\)?\\(To\\|B?Cc\\):" . message-expand-name) | |
6625 '("^\\(Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\):" | |
6626 . message-expand-name) | |
6627 '("^\\(Disposition-Notification-To\\|Return-Receipt-To\\):" | |
6628 . message-expand-name)) | |
6629 "Alist of (RE . FUN). Use FUN for completion on header lines matching RE." | |
6630 :version "22.1" | |
6631 :group 'message | |
6632 :type '(alist :key-type regexp :value-type function)) | |
6633 | |
6634 (defcustom message-tab-body-function nil | |
6635 "*Function to execute when `message-tab' (TAB) is executed in the body. | |
6636 If nil, the function bound in `text-mode-map' or `global-map' is executed." | |
6637 :version "22.1" | |
6638 :group 'message | |
6639 :link '(custom-manual "(message)Various Commands") | |
6640 :type '(choice (const nil) | |
6641 function)) | |
17493 | 6642 |
6643 (defun message-tab () | |
88155 | 6644 "Complete names according to `message-completion-alist'. |
6645 Execute function specified by `message-tab-body-function' when not in | |
6646 those headers." | |
17493 | 6647 (interactive) |
88155 | 6648 (let ((alist message-completion-alist)) |
6649 (while (and alist | |
6650 (let ((mail-abbrev-mode-regexp (caar alist))) | |
6651 (not (mail-abbrev-in-expansion-header-p)))) | |
6652 (setq alist (cdr alist))) | |
6653 (funcall (or (cdar alist) message-tab-body-function | |
6654 (lookup-key text-mode-map "\t") | |
6655 (lookup-key global-map "\t") | |
6656 'indent-relative)))) | |
6657 | |
6658 (eval-and-compile | |
6659 (condition-case nil | |
6660 (with-temp-buffer | |
6661 (let ((standard-output (current-buffer))) | |
6662 (eval '(display-completion-list nil ""))) | |
6663 (defalias 'message-display-completion-list 'display-completion-list)) | |
6664 (error ;; Don't use `wrong-number-of-arguments' here because of XEmacs. | |
6665 (defun message-display-completion-list (completions &optional ignore) | |
6666 "Display the list of completions, COMPLETIONS, using `standard-output'." | |
6667 (display-completion-list completions))))) | |
17493 | 6668 |
6669 (defun message-expand-group () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6670 "Expand the group name under point." |
17493 | 6671 (let* ((b (save-excursion |
6672 (save-restriction | |
6673 (narrow-to-region | |
6674 (save-excursion | |
6675 (beginning-of-line) | |
6676 (skip-chars-forward "^:") | |
6677 (1+ (point))) | |
6678 (point)) | |
6679 (skip-chars-backward "^, \t\n") (point)))) | |
6680 (completion-ignore-case t) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6681 (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
|
6682 (point)))) |
17493 | 6683 (hashtb (and (boundp 'gnus-active-hashtb) gnus-active-hashtb)) |
6684 (completions (all-completions string hashtb)) | |
6685 comp) | |
6686 (delete-region b (point)) | |
6687 (cond | |
6688 ((= (length completions) 1) | |
6689 (if (string= (car completions) string) | |
6690 (progn | |
6691 (insert string) | |
6692 (message "Only matching group")) | |
6693 (insert (car completions)))) | |
6694 ((and (setq comp (try-completion string hashtb)) | |
6695 (not (string= comp string))) | |
6696 (insert comp)) | |
6697 (t | |
6698 (insert string) | |
6699 (if (not comp) | |
6700 (message "No matching groups") | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6701 (save-selected-window |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6702 (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
|
6703 (buffer-disable-undo) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6704 (let ((buffer-read-only nil)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6705 (erase-buffer) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6706 (let ((standard-output (current-buffer))) |
88155 | 6707 (message-display-completion-list (sort completions 'string<) |
6708 string)) | |
6709 (setq buffer-read-only nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6710 (goto-char (point-min)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6711 (delete-region (point) (progn (forward-line 3) (point)))))))))) |
17493 | 6712 |
88155 | 6713 (defun message-expand-name () |
6714 (if (fboundp 'bbdb-complete-name) | |
6715 (bbdb-complete-name) | |
6716 (expand-abbrev))) | |
6717 | |
17493 | 6718 ;;; Help stuff. |
6719 | |
6720 (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
|
6721 "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
|
6722 If SHOW is non-nil, the arguments TEXT... are displayed in a temp buffer. |
17493 | 6723 The following arguments may contain lists of values." |
6724 (if (and show | |
6725 (setq text (message-flatten-list text))) | |
6726 (save-window-excursion | |
6727 (save-excursion | |
6728 (with-output-to-temp-buffer " *MESSAGE information message*" | |
6729 (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
|
6730 (fundamental-mode) ; for Emacs 20.4+ |
17493 | 6731 (mapcar 'princ text) |
6732 (goto-char (point-min)))) | |
6733 (funcall ask question)) | |
6734 (funcall ask question))) | |
6735 | |
6736 (defun message-flatten-list (list) | |
6737 "Return a new, flat list that contains all elements of LIST. | |
6738 | |
6739 \(message-flatten-list '(1 (2 3 (4 5 (6))) 7)) | |
6740 => (1 2 3 4 5 6 7)" | |
6741 (cond ((consp list) | |
6742 (apply 'append (mapcar 'message-flatten-list list))) | |
6743 (list | |
6744 (list list)))) | |
6745 | |
6746 (defun message-generate-new-buffer-clone-locals (name &optional varstr) | |
88155 | 6747 "Create and return a buffer with name based on NAME using `generate-new-buffer'. |
17493 | 6748 Then clone the local variables and values from the old buffer to the |
6749 new one, cloning only the locals having a substring matching the | |
88155 | 6750 regexp VARSTR." |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6751 (let ((oldbuf (current-buffer))) |
17493 | 6752 (save-excursion |
6753 (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
|
6754 (message-clone-locals oldbuf varstr) |
17493 | 6755 (current-buffer)))) |
6756 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6757 (defun message-clone-locals (buffer &optional varstr) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6758 "Clone the local variables from BUFFER to the current buffer." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6759 (let ((locals (save-excursion |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6760 (set-buffer buffer) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6761 (buffer-local-variables))) |
88155 | 6762 (regexp "^gnus\\|^nn\\|^message\\|^sendmail\\|^smtp\\|^user-mail-address")) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6763 (mapcar |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6764 (lambda (local) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6765 (when (and (consp local) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6766 (car local) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6767 (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
|
6768 (or (null varstr) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6769 (string-match varstr (symbol-name (car local))))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6770 (ignore-errors |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6771 (set (make-local-variable (car local)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6772 (cdr local))))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6773 locals))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
6774 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6775 ;;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6776 ;;; MIME functions |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6777 ;;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6778 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6779 (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
|
6780 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6781 (defun message-encode-message-body () |
35147 | 6782 (unless message-inhibit-body-encoding |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6783 (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
|
6784 message-default-charset)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6785 (case-fold-search t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6786 lines content-type-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6787 (message-goto-body) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6788 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6789 (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
|
6790 (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
|
6791 (when new |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6792 (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
|
6793 (insert new) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6794 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6795 (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
|
6796 (delete-char 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6797 (search-forward "\n\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6798 (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
|
6799 (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
|
6800 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6801 (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
|
6802 (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
|
6803 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6804 (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
|
6805 (when lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6806 (insert lines)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6807 (setq content-type-p |
88155 | 6808 (or mml-boundary |
6809 (re-search-backward "^Content-Type:" nil t)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6810 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6811 (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
|
6812 (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
|
6813 (message-remove-first-header "Content-Transfer-Encoding")) |
88155 | 6814 ;; We always make sure that the message has a Content-Type |
6815 ;; header. This is because some broken MTAs and MUAs get | |
6816 ;; awfully confused when confronted with a message with a | |
6817 ;; MIME-Version header and without a Content-Type header. For | |
6818 ;; instance, Solaris' /usr/bin/mail. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6819 (unless content-type-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6820 (goto-char (point-min)) |
41511
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6821 ;; For unknown reason, MIME-Version doesn't exist. |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6822 (when (re-search-forward "^MIME-Version:" nil t) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6823 (forward-line 1) |
19496cafe865
2001-11-25 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
41494
diff
changeset
|
6824 (insert "Content-Type: text/plain; charset=us-ascii\n")))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6825 |
88155 | 6826 (defun message-read-from-minibuffer (prompt &optional initial-contents) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6827 "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
|
6828 (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
|
6829 (let ((mail-abbrev-mode-regexp "") |
88155 | 6830 (minibuffer-setup-hook 'mail-abbrevs-setup) |
6831 (minibuffer-local-map message-minibuffer-local-map)) | |
6832 (read-from-minibuffer prompt initial-contents)) | |
6833 (let ((minibuffer-setup-hook 'mail-abbrev-minibuffer-setup-hook) | |
6834 (minibuffer-local-map message-minibuffer-local-map)) | |
6835 (read-string prompt initial-contents)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6836 |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6837 (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
|
6838 (require 'mail-utils) |
35147 | 6839 (let* ((fields '("To" "Cc")) |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6840 (emails |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6841 (split-string |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6842 (mail-strip-quoted-names |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6843 (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
|
6844 "[ \f\t\n\r\v,]+")) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6845 email) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6846 (while emails |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6847 (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
|
6848 (setq email (car emails) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6849 emails nil)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6850 (pop emails)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6851 (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
|
6852 (goto-char (point-max)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6853 (insert "From: " email "\n")))) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
6854 |
88155 | 6855 (defun message-options-get (symbol) |
6856 (cdr (assq symbol message-options))) | |
6857 | |
6858 (defun message-options-set (symbol value) | |
6859 (let ((the-cons (assq symbol message-options))) | |
6860 (if the-cons | |
6861 (if value | |
6862 (setcdr the-cons value) | |
6863 (setq message-options (delq the-cons message-options))) | |
6864 (and value | |
6865 (push (cons symbol value) message-options)))) | |
6866 value) | |
6867 | |
6868 (defun message-options-set-recipient () | |
6869 (save-restriction | |
6870 (message-narrow-to-headers-or-head) | |
6871 (message-options-set 'message-sender | |
6872 (mail-strip-quoted-names | |
6873 (message-fetch-field "from"))) | |
6874 (message-options-set 'message-recipients | |
6875 (mail-strip-quoted-names | |
6876 (let ((to (message-fetch-field "to")) | |
6877 (cc (message-fetch-field "cc")) | |
6878 (bcc (message-fetch-field "bcc"))) | |
6879 (concat | |
6880 (or to "") | |
6881 (if (and to cc) ", ") | |
6882 (or cc "") | |
6883 (if (and (or to cc) bcc) ", ") | |
6884 (or bcc ""))))))) | |
6885 | |
6886 (defun message-hide-headers () | |
6887 "Hide headers based on the `message-hidden-headers' variable." | |
6888 (let ((regexps (if (stringp message-hidden-headers) | |
6889 (list message-hidden-headers) | |
6890 message-hidden-headers)) | |
6891 (inhibit-point-motion-hooks t) | |
6892 (after-change-functions nil)) | |
6893 (when regexps | |
6894 (save-excursion | |
6895 (save-restriction | |
6896 (message-narrow-to-headers) | |
6897 (goto-char (point-min)) | |
6898 (while (not (eobp)) | |
6899 (if (not (message-hide-header-p regexps)) | |
6900 (message-next-header) | |
6901 (let ((begin (point))) | |
6902 (message-next-header) | |
6903 (add-text-properties | |
6904 begin (point) | |
6905 '(invisible t message-hidden t)))))))))) | |
6906 | |
6907 (defun message-hide-header-p (regexps) | |
6908 (let ((result nil) | |
6909 (reverse nil)) | |
6910 (when (eq (car regexps) 'not) | |
6911 (setq reverse t) | |
6912 (pop regexps)) | |
6913 (dolist (regexp regexps) | |
6914 (setq result (or result (looking-at regexp)))) | |
6915 (if reverse | |
6916 (not result) | |
6917 result))) | |
6918 | |
6919 (when (featurep 'xemacs) | |
6920 (require 'messagexmas) | |
6921 (message-xmas-redefine)) | |
6922 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6923 (provide 'message) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
6924 |
17493 | 6925 (run-hooks 'message-load-hook) |
6926 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6927 ;; Local Variables: |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6928 ;; coding: iso-8859-1 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
6929 ;; End: |
17493 | 6930 |
88155 | 6931 ;; arch-tag: 94b32cac-4504-4b6c-8181-030ebf380ee0 |
17493 | 6932 ;;; message.el ends here |