Mercurial > emacs
annotate lisp/gnus/message.el @ 35491:888971e7d606
(make-coding-system): Fix typo.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 23 Jan 2001 17:35:03 +0000 |
parents | 26726eff41ca |
children | a35d9c07d074 |
rev | line source |
---|---|
33375
d7d4bd9d131c
(message-mode) <adaptive-fill-regexp>:
Dave Love <fx@gnu.org>
parents:
33342
diff
changeset
|
1 ;;; message.el --- composing mail and news messages -*- coding: iso-latin-1 -*- |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3 ;; Free Software Foundation, Inc. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 6 ;; Keywords: mail, news |
7 | |
8 ;; This file is part of GNU Emacs. | |
9 | |
10 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
11 ;; it under the terms of the GNU General Public License as published by | |
12 ;; the Free Software Foundation; either version 2, or (at your option) | |
13 ;; any later version. | |
14 | |
15 ;; GNU Emacs is distributed in the hope that it will be useful, | |
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 ;; GNU General Public License for more details. | |
19 | |
20 ;; You should have received a copy of the GNU General Public License | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
24 | |
25 ;;; Commentary: | |
26 | |
27 ;; This mode provides mail-sending facilities from within Emacs. It | |
28 ;; consists mainly of large chunks of code from the sendmail.el, | |
29 ;; gnus-msg.el and rnewspost.el files. | |
30 | |
31 ;;; Code: | |
32 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
33 (eval-when-compile |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
34 (require 'cl) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
35 (defvar gnus-list-identifiers)) ; gnus-sum is required where necessary |
17493 | 36 (require 'mailheader) |
37 (require 'nnheader) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
38 ;; This is apparently necessary even though things are autoloaded: |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
39 (if (featurep 'xemacs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
40 (require 'mail-abbrevs)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
41 (require 'mail-parse) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
42 (require 'mml) |
17493 | 43 |
44 (defgroup message '((user-mail-address custom-variable) | |
45 (user-full-name custom-variable)) | |
46 "Mail and news message composing." | |
47 :link '(custom-manual "(message)Top") | |
48 :group 'mail | |
49 :group 'news) | |
50 | |
51 (put 'user-mail-address 'custom-type 'string) | |
52 (put 'user-full-name 'custom-type 'string) | |
53 | |
54 (defgroup message-various nil | |
55 "Various Message Variables" | |
56 :link '(custom-manual "(message)Various Message Variables") | |
57 :group 'message) | |
58 | |
59 (defgroup message-buffers nil | |
60 "Message Buffers" | |
61 :link '(custom-manual "(message)Message Buffers") | |
62 :group 'message) | |
63 | |
64 (defgroup message-sending nil | |
65 "Message Sending" | |
66 :link '(custom-manual "(message)Sending Variables") | |
67 :group 'message) | |
68 | |
69 (defgroup message-interface nil | |
70 "Message Interface" | |
71 :link '(custom-manual "(message)Interface") | |
72 :group 'message) | |
73 | |
74 (defgroup message-forwarding nil | |
75 "Message Forwarding" | |
76 :link '(custom-manual "(message)Forwarding") | |
77 :group 'message-interface) | |
78 | |
79 (defgroup message-insertion nil | |
80 "Message Insertion" | |
81 :link '(custom-manual "(message)Insertion") | |
82 :group 'message) | |
83 | |
84 (defgroup message-headers nil | |
85 "Message Headers" | |
86 :link '(custom-manual "(message)Message Headers") | |
87 :group 'message) | |
88 | |
89 (defgroup message-news nil | |
90 "Composing News Messages" | |
91 :group 'message) | |
92 | |
93 (defgroup message-mail nil | |
94 "Composing Mail Messages" | |
95 :group 'message) | |
96 | |
97 (defgroup message-faces nil | |
98 "Faces used for message composing." | |
99 :group 'message | |
100 :group 'faces) | |
101 | |
102 (defcustom message-directory "~/Mail/" | |
103 "*Directory from which all other mail file variables are derived." | |
104 :group 'message-various | |
105 :type 'directory) | |
106 | |
107 (defcustom message-max-buffers 10 | |
108 "*How many buffers to keep before starting to kill them off." | |
109 :group 'message-buffers | |
110 :type 'integer) | |
111 | |
112 (defcustom message-send-rename-function nil | |
113 "Function called to rename the buffer after sending it." | |
114 :group 'message-buffers | |
35147 | 115 :type '(choice function (const nil))) |
17493 | 116 |
117 (defcustom message-fcc-handler-function 'message-output | |
118 "*A function called to save outgoing articles. | |
119 This function will be called with the name of the file to store the | |
120 article in. The default function is `message-output' which saves in Unix | |
121 mailbox format." | |
122 :type '(radio (function-item message-output) | |
123 (function :tag "Other")) | |
124 :group 'message-sending) | |
125 | |
126 (defcustom message-courtesy-message | |
127 "The following message is a courtesy copy of an article\nthat has been posted to %s as well.\n\n" | |
128 "*This is inserted at the start of a mailed copy of a posted message. | |
129 If the string contains the format spec \"%s\", the Newsgroups | |
130 the article has been posted to will be inserted there. | |
131 If this variable is nil, no such courtesy message will be added." | |
132 :group 'message-sending | |
133 :type 'string) | |
134 | |
135 (defcustom message-ignored-bounced-headers "^\\(Received\\|Return-Path\\):" | |
136 "*Regexp that matches headers to be removed in resent bounced mail." | |
137 :group 'message-interface | |
138 :type 'regexp) | |
139 | |
140 ;;;###autoload | |
141 (defcustom message-from-style 'default | |
142 "*Specifies how \"From\" headers look. | |
143 | |
35147 | 144 If nil, they contain just the return address like: |
17493 | 145 king@grassland.com |
146 If `parens', they look like: | |
147 king@grassland.com (Elvis Parsley) | |
148 If `angles', they look like: | |
149 Elvis Parsley <king@grassland.com> | |
150 | |
151 Otherwise, most addresses look like `angles', but they look like | |
152 `parens' if `angles' would need quoting and `parens' would not." | |
153 :type '(choice (const :tag "simple" nil) | |
154 (const parens) | |
155 (const angles) | |
156 (const default)) | |
157 :group 'message-headers) | |
158 | |
159 (defcustom message-syntax-checks nil | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
160 ;; 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
|
161 "*Controls what syntax checks should not be performed on outgoing posts. |
17493 | 162 To disable checking of long signatures, for instance, add |
163 `(signature . disabled)' to this list. | |
164 | |
165 Don't touch this variable unless you really know what you're doing. | |
166 | |
35147 | 167 Checks include `subject-cmsg', `multiple-headers', `sendsys', |
168 `message-id', `from', `long-lines', `control-chars', `size', | |
169 `new-text', `quoting-style', `redirected-followup', `signature', | |
170 `approved', `sender', `empty', `empty-headers', `message-id', `from', | |
171 `subject', `shorten-followup-to', `existing-newsgroups', | |
172 `buffer-file-name', `unchanged', `newsgroups'." | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
173 :group 'message-news |
35147 | 174 :type '(repeat sexp)) ; Fixme: improve this |
17493 | 175 |
176 (defcustom message-required-news-headers | |
177 '(From Newsgroups Subject Date Message-ID | |
178 (optional . Organization) Lines | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
179 (optional . User-Agent)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
180 "*Headers to be generated or prompted for when posting an article. |
17493 | 181 RFC977 and RFC1036 require From, Date, Newsgroups, Subject, |
182 Message-ID. Organization, Lines, In-Reply-To, Expires, and | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
183 User-Agent are optional. If don't you want message to insert some |
17493 | 184 header, remove it from this list." |
185 :group 'message-news | |
186 :group 'message-headers | |
187 :type '(repeat sexp)) | |
188 | |
189 (defcustom message-required-mail-headers | |
190 '(From Subject Date (optional . In-Reply-To) Message-ID Lines | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
191 (optional . User-Agent)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
192 "*Headers to be generated or prompted for when mailing a message. |
17493 | 193 RFC822 required that From, Date, To, Subject and Message-ID be |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
194 included. Organization, Lines and User-Agent are optional." |
17493 | 195 :group 'message-mail |
196 :group 'message-headers | |
197 :type '(repeat sexp)) | |
198 | |
199 (defcustom message-deletable-headers '(Message-ID Date Lines) | |
200 "Headers to be deleted if they already exist and were generated by message previously." | |
201 :group 'message-headers | |
202 :type 'sexp) | |
203 | |
204 (defcustom message-ignored-news-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
205 "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:" |
17493 | 206 "*Regexp of headers to be removed unconditionally before posting." |
207 :group 'message-news | |
208 :group 'message-headers | |
209 :type 'regexp) | |
210 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
211 (defcustom message-ignored-mail-headers "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:" |
17493 | 212 "*Regexp of headers to be removed unconditionally before mailing." |
213 :group 'message-mail | |
214 :group 'message-headers | |
215 :type 'regexp) | |
216 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
217 (defcustom message-ignored-supersedes-headers "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|^X-Trace:\\|^X-Complaints-To:\\|Return-Path:\\|^Supersedes:\\|^NNTP-Posting-Date:\\|^X-Trace:\\|^X-Complaints-To:" |
17493 | 218 "*Header lines matching this regexp will be deleted before posting. |
219 It's best to delete old Path and Date headers before posting to avoid | |
220 any confusion." | |
221 :group 'message-interface | |
222 :type 'regexp) | |
223 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
224 (defcustom message-subject-re-regexp "^[ \t]*\\([Rr][Ee]:[ \t]*\\)*[ \t]*" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
225 "*Regexp matching \"Re: \" in the subject line." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
226 :group 'message-various |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
227 :type 'regexp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
228 |
17493 | 229 ;;;###autoload |
230 (defcustom message-signature-separator "^-- *$" | |
231 "Regexp matching the signature separator." | |
232 :type 'regexp | |
233 :group 'message-various) | |
234 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
235 (defcustom message-elide-ellipsis "\n[...]\n\n" |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
236 "*The string which is inserted for elided text." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
237 :type 'string |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
238 :group 'message-various) |
17493 | 239 |
240 (defcustom message-interactive nil | |
241 "Non-nil means when sending a message wait for and display errors. | |
242 nil means let mailer mail back a message to report errors." | |
243 :group 'message-sending | |
244 :group 'message-mail | |
245 :type 'boolean) | |
246 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
247 (defcustom message-generate-new-buffers 'unique |
35147 | 248 "*Non-nil means create a new message buffer whenever `message-setup' is called. |
17493 | 249 If this is a function, call that function with three parameters: The type, |
250 the to address and the group name. (Any of these may be nil.) The function | |
251 should return the new buffer name." | |
252 :group 'message-buffers | |
253 :type '(choice (const :tag "off" nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
254 (const :tag "unique" unique) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
255 (const :tag "unsent" unsent) |
17493 | 256 (function fun))) |
257 | |
258 (defcustom message-kill-buffer-on-exit nil | |
259 "*Non-nil means that the message buffer will be killed after sending a message." | |
260 :group 'message-buffers | |
261 :type 'boolean) | |
262 | |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
263 (eval-when-compile |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
264 (defvar gnus-local-organization)) |
17493 | 265 (defcustom message-user-organization |
266 (or (and (boundp 'gnus-local-organization) | |
267 (stringp gnus-local-organization) | |
268 gnus-local-organization) | |
269 (getenv "ORGANIZATION") | |
270 t) | |
271 "*String to be used as an Organization header. | |
272 If t, use `message-user-organization-file'." | |
273 :group 'message-headers | |
274 :type '(choice string | |
275 (const :tag "consult file" t))) | |
276 | |
277 ;;;###autoload | |
278 (defcustom message-user-organization-file "/usr/lib/news/organization" | |
279 "*Local news organization file." | |
280 :type 'file | |
281 :group 'message-headers) | |
282 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
283 (defcustom message-make-forward-subject-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
284 'message-forward-subject-author-subject |
35147 | 285 "*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
|
286 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
|
287 successive function. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
288 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
289 The provided functions are: |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
290 |
35147 | 291 * `message-forward-subject-author-subject' (Source of article (author or |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
292 newsgroup)), in brackets followed by the subject |
35147 | 293 * `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
|
294 to it." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
295 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
296 :type '(radio (function-item message-forward-subject-author-subject) |
35147 | 297 (function-item message-forward-subject-fwd) |
298 (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
|
299 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
300 (defcustom message-forward-as-mime t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
301 "*If non-nil, forward messages as an inline/rfc822 MIME section. 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
|
302 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
303 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
304 :type 'boolean) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
305 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
306 (defcustom message-forward-show-mml t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
307 "*If non-nil, forward messages are shown as mml. Otherwise, forward messages are unchanged." |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
308 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
309 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
310 :type 'boolean) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
311 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
312 (defcustom message-forward-before-signature t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
313 "*If non-nil, put forwarded message before signature, else after." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
314 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
315 :type 'boolean) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
316 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
317 (defcustom message-wash-forwarded-subjects nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
318 "*If non-nil, try to remove as much old cruft as possible from the subject of messages before generating the new subject of a forward." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
319 :group 'message-forwarding |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
320 :type 'boolean) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
321 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
322 (defcustom message-ignored-resent-headers "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:" |
17493 | 323 "*All headers that match this regexp will be deleted when resending a message." |
324 :group 'message-interface | |
325 :type 'regexp) | |
326 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
327 (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
|
328 "*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
|
329 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
330 :group 'message-forwarding |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
331 :type '(choice (const :tag "None" nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
332 regexp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
333 |
17493 | 334 (defcustom message-ignored-cited-headers "." |
335 "*Delete these headers from the messages you yank." | |
336 :group 'message-insertion | |
337 :type 'regexp) | |
338 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
339 (defcustom message-cancel-message "I am canceling my own article.\n" |
17493 | 340 "Message to be inserted in the cancel message." |
341 :group 'message-interface | |
342 :type 'string) | |
343 | |
344 ;; Useful to set in site-init.el | |
345 ;;;###autoload | |
346 (defcustom message-send-mail-function 'message-send-mail-with-sendmail | |
347 "Function to call to send the current buffer as mail. | |
348 The headers should be delimited by a line whose contents match the | |
349 variable `mail-header-separator'. | |
350 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
351 Valid values include `message-send-mail-with-sendmail' (the default), |
35147 | 352 `message-send-mail-with-mh', `message-send-mail-with-qmail', |
353 `smtpmail-send-it' and `feedmail-send-it'. | |
354 | |
355 See also `send-mail-function'." | |
17493 | 356 :type '(radio (function-item message-send-mail-with-sendmail) |
357 (function-item message-send-mail-with-mh) | |
358 (function-item message-send-mail-with-qmail) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
359 (function-item smtpmail-send-it) |
35147 | 360 (function-item feedmail-send-it) |
17493 | 361 (function :tag "Other")) |
362 :group 'message-sending | |
363 :group 'message-mail) | |
364 | |
365 (defcustom message-send-news-function 'message-send-news | |
366 "Function to call to send the current buffer as news. | |
367 The headers should be delimited by a line whose contents match the | |
368 variable `mail-header-separator'." | |
369 :group 'message-sending | |
370 :group 'message-news | |
371 :type 'function) | |
372 | |
373 (defcustom message-reply-to-function nil | |
35147 | 374 "If non-nil, function that should return a list of headers. |
17493 | 375 This function should pick out addresses from the To, Cc, and From headers |
376 and respond with new To and Cc headers." | |
377 :group 'message-interface | |
35147 | 378 :type '(choice function (const nil))) |
17493 | 379 |
380 (defcustom message-wide-reply-to-function nil | |
35147 | 381 "If non-nil, function that should return a list of headers. |
17493 | 382 This function should pick out addresses from the To, Cc, and From headers |
383 and respond with new To and Cc headers." | |
384 :group 'message-interface | |
35147 | 385 :type '(choice function (const nil))) |
17493 | 386 |
387 (defcustom message-followup-to-function nil | |
35147 | 388 "If non-nil, function that should return a list of headers. |
17493 | 389 This function should pick out addresses from the To, Cc, and From headers |
390 and respond with new To and Cc headers." | |
391 :group 'message-interface | |
35147 | 392 :type '(choice function (const nil))) |
17493 | 393 |
394 (defcustom message-use-followup-to 'ask | |
395 "*Specifies what to do with Followup-To header. | |
396 If nil, always ignore the header. If it is t, use its value, but | |
397 query before using the \"poster\" value. If it is the symbol `ask', | |
398 always query the user whether to use the value. If it is the symbol | |
399 `use', always use the value." | |
400 :group 'message-interface | |
401 :type '(choice (const :tag "ignore" nil) | |
402 (const use) | |
403 (const ask))) | |
404 | |
405 (defcustom message-sendmail-f-is-evil nil | |
35147 | 406 "*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
|
407 Doing so would be even more evil than leaving it out." |
17493 | 408 :group 'message-sending |
409 :type 'boolean) | |
410 | |
411 ;; qmail-related stuff | |
412 (defcustom message-qmail-inject-program "/var/qmail/bin/qmail-inject" | |
413 "Location of the qmail-inject program." | |
414 :group 'message-sending | |
415 :type 'file) | |
416 | |
417 (defcustom message-qmail-inject-args nil | |
418 "Arguments passed to qmail-inject programs. | |
419 This should be a list of strings, one string for each argument. | |
420 | |
421 For e.g., if you wish to set the envelope sender address so that bounces | |
422 go to the right place or to deal with listserv's usage of that address, you | |
423 might set this variable to '(\"-f\" \"you@some.where\")." | |
424 :group 'message-sending | |
425 :type '(repeat string)) | |
426 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
427 (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
|
428 "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
|
429 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
|
430 NOV lines.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
431 |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
432 (eval-when-compile |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
433 (defvar gnus-post-method) |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
434 (defvar gnus-select-method)) |
17493 | 435 (defcustom message-post-method |
436 (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
|
437 (listp gnus-post-method) |
17493 | 438 gnus-post-method) |
439 gnus-post-method) | |
440 ((boundp 'gnus-select-method) | |
441 gnus-select-method) | |
442 (t '(nnspool ""))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
443 "*Method used to post news. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
444 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
|
445 variable isn't used." |
17493 | 446 :group 'message-news |
447 :group 'message-sending | |
448 ;; This should be the `gnus-select-method' widget, but that might | |
449 ;; create a dependence to `gnus.el'. | |
450 :type 'sexp) | |
451 | |
452 (defcustom message-generate-headers-first nil | |
453 "*If non-nil, generate all possible headers before composing." | |
454 :group 'message-headers | |
455 :type 'boolean) | |
456 | |
457 (defcustom message-setup-hook nil | |
458 "Normal hook, run each time a new outgoing message is initialized. | |
459 The function `message-setup' runs this hook." | |
460 :group 'message-various | |
461 :type 'hook) | |
462 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
463 (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
|
464 "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
|
465 :group 'message-various |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
466 :type 'hook) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
467 |
17493 | 468 (defcustom message-signature-setup-hook nil |
469 "Normal hook, run each time a new outgoing message is initialized. | |
470 It is run after the headers have been inserted and before | |
471 the signature is inserted." | |
472 :group 'message-various | |
473 :type 'hook) | |
474 | |
475 (defcustom message-mode-hook nil | |
476 "Hook run in message mode buffers." | |
477 :group 'message-various | |
478 :type 'hook) | |
479 | |
480 (defcustom message-header-hook nil | |
481 "Hook run in a message mode buffer narrowed to the headers." | |
482 :group 'message-various | |
483 :type 'hook) | |
484 | |
485 (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
|
486 "Hook called narrowed to the headers when setting up a message buffer." |
17493 | 487 :group 'message-various |
488 :type 'hook) | |
489 | |
490 ;;;###autoload | |
491 (defcustom message-citation-line-function 'message-insert-citation-line | |
492 "*Function called to insert the \"Whomever writes:\" line." | |
493 :type 'function | |
494 :group 'message-insertion) | |
495 | |
496 ;;;###autoload | |
497 (defcustom message-yank-prefix "> " | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
498 "*Prefix inserted on the lines of yanked messages." |
17493 | 499 :type 'string |
500 :group 'message-insertion) | |
501 | |
502 (defcustom message-indentation-spaces 3 | |
503 "*Number of spaces to insert at the beginning of each cited line. | |
504 Used by `message-yank-original' via `message-yank-cite'." | |
505 :group 'message-insertion | |
506 :type 'integer) | |
507 | |
508 ;;;###autoload | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
509 (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
|
510 "*Function for citing an original message. |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
511 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
|
512 `message-cite-original-without-signature'. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
513 Note that `message-cite-original' uses `mail-citation-hook' if that is non-nil." |
17493 | 514 :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
|
515 (function-item message-cite-original-without-signature) |
17493 | 516 (function-item sc-cite-original) |
517 (function :tag "Other")) | |
518 :group 'message-insertion) | |
519 | |
520 ;;;###autoload | |
521 (defcustom message-indent-citation-function 'message-indent-citation | |
522 "*Function for modifying a citation just inserted in the mail buffer. | |
523 This can also be a list of functions. Each function can find the | |
524 citation between (point) and (mark t). And each function should leave | |
525 point and mark around the citation text as modified." | |
526 :type 'function | |
527 :group 'message-insertion) | |
528 | |
529 (defvar message-abbrevs-loaded nil) | |
530 | |
531 ;;;###autoload | |
532 (defcustom message-signature t | |
533 "*String to be inserted at the end of the message buffer. | |
534 If t, the `message-signature-file' file will be inserted instead. | |
535 If a function, the result from the function will be used instead. | |
536 If a form, the result from the form will be used instead." | |
537 :type 'sexp | |
538 :group 'message-insertion) | |
539 | |
540 ;;;###autoload | |
541 (defcustom message-signature-file "~/.signature" | |
542 "*File containing the text inserted at end of message buffer." | |
543 :type 'file | |
544 :group 'message-insertion) | |
545 | |
546 (defcustom message-distribution-function nil | |
547 "*Function called to return a Distribution header." | |
548 :group 'message-news | |
549 :group 'message-headers | |
35147 | 550 :type '(choice function (const nil))) |
17493 | 551 |
552 (defcustom message-expires 14 | |
553 "Number of days before your article expires." | |
554 :group 'message-news | |
555 :group 'message-headers | |
556 :link '(custom-manual "(message)News Headers") | |
557 :type 'integer) | |
558 | |
559 (defcustom message-user-path nil | |
560 "If nil, use the NNTP server name in the Path header. | |
561 If stringp, use this; if non-nil, use no host name (user name only)." | |
562 :group 'message-news | |
563 :group 'message-headers | |
564 :link '(custom-manual "(message)News Headers") | |
565 :type '(choice (const :tag "nntp" nil) | |
566 (string :tag "name") | |
567 (sexp :tag "none" :format "%t" t))) | |
568 | |
569 (defvar message-reply-buffer nil) | |
570 (defvar message-reply-headers nil) | |
571 (defvar message-newsreader nil) | |
572 (defvar message-mailer nil) | |
573 (defvar message-sent-message-via nil) | |
574 (defvar message-checksum nil) | |
575 (defvar message-send-actions nil | |
576 "A list of actions to be performed upon successful sending of a message.") | |
577 (defvar message-exit-actions nil | |
578 "A list of actions to be performed upon exiting after sending a message.") | |
579 (defvar message-kill-actions nil | |
580 "A list of actions to be performed before killing a message buffer.") | |
581 (defvar message-postpone-actions nil | |
582 "A list of actions to be performed after postponing a message.") | |
583 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
584 (define-widget 'message-header-lines 'text |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
585 "All header lines must be LFD terminated." |
33982
ff339ba39162
(message-header-lines): Fontify tag.
Miles Bader <miles@gnu.org>
parents:
33768
diff
changeset
|
586 :format "%{%t%}:%n%v" |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
587 :valid-regexp "^\\'" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
588 :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
|
589 |
17493 | 590 (defcustom message-default-headers "" |
591 "*A string containing header lines to be inserted in outgoing messages. | |
592 It is inserted before you edit the message, so you can edit or delete | |
593 these lines." | |
594 :group 'message-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
595 :type 'message-header-lines) |
17493 | 596 |
597 (defcustom message-default-mail-headers "" | |
598 "*A string of header lines to be inserted in outgoing mails." | |
599 :group 'message-headers | |
600 :group 'message-mail | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
601 :type 'message-header-lines) |
17493 | 602 |
603 (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
|
604 "*A string of header lines to be inserted in outgoing news articles." |
17493 | 605 :group 'message-headers |
606 :group 'message-news | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
607 :type 'message-header-lines) |
17493 | 608 |
609 ;; Note: could use /usr/ucb/mail instead of sendmail; | |
610 ;; options -t, and -v if not interactive. | |
611 (defcustom message-mailer-swallows-blank-line | |
612 (if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)" | |
613 system-configuration) | |
614 (file-readable-p "/etc/sendmail.cf") | |
615 (let ((buffer (get-buffer-create " *temp*"))) | |
616 (unwind-protect | |
617 (save-excursion | |
618 (set-buffer buffer) | |
619 (insert-file-contents "/etc/sendmail.cf") | |
620 (goto-char (point-min)) | |
621 (let ((case-fold-search nil)) | |
622 (re-search-forward "^OR\\>" nil t))) | |
623 (kill-buffer buffer)))) | |
624 ;; According to RFC822, "The field-name must be composed of printable | |
625 ;; ASCII characters (i. e., characters that have decimal values between | |
626 ;; 33 and 126, except colon)", i. e., any chars except ctl chars, | |
627 ;; space, or colon. | |
628 '(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
|
629 "*Set this non-nil if the system's mailer runs the header and body together. |
17493 | 630 \(This problem exists on Sunos 4 when sendmail is run in remote mode.) |
631 The value should be an expression to test whether the problem will | |
632 actually occur." | |
633 :group 'message-sending | |
634 :type 'sexp) | |
635 | |
19481
4d492290e085
(message-user-agent): Add autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
636 ;;;###autoload |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
637 (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
|
638 '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
|
639 'message-kill-buffer 'message-send-hook) |
17493 | 640 |
641 (defvar message-mh-deletable-headers '(Message-ID Date Lines Sender) | |
642 "If non-nil, delete the deletable headers before feeding to mh.") | |
643 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
644 (defvar message-send-method-alist |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
645 '((news message-news-p message-send-via-news) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
646 (mail message-mail-p message-send-via-mail)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
647 "Alist of ways to send outgoing messages. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
648 Each element has the form |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
649 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
650 \(TYPE PREDICATE FUNCTION) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
651 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
652 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
|
653 called without any parameters to determine whether the message is |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
654 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
|
655 PREDICATE returns non-nil. FUNCTION is called with one parameter -- |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
656 the prefix.") |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
657 |
34058
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
658 (defcustom message-mail-alias-type 'abbrev |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
659 "*What alias expansion type to use in Message buffers. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
660 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
|
661 mail aliases off." |
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
662 :group 'message |
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
663 :link '(custom-manual "(message)Mail Aliases") |
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
664 :type '(choice (const :tag "Use Mailabbrev" abbrev) |
9f5e2364ef2b
(message-mail-alias-type): Customize.
Dave Love <fx@gnu.org>
parents:
34057
diff
changeset
|
665 (const :tag "No expansion" nil))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
666 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
667 (defcustom message-auto-save-directory |
34057
98bd49d8cf7d
(message-auto-save-directory): Use
Dave Love <fx@gnu.org>
parents:
33982
diff
changeset
|
668 (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
|
669 "*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
|
670 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
|
671 :group 'message-buffers |
35147 | 672 :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
|
673 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
674 (defcustom message-buffer-naming-style 'unique |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
675 "*The way new message buffers are named. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
676 Valid valued are `unique' and `unsent'." |
33400
42c1ba3caf9c
(message-forward-as-mime, message-forward-ignored-headers)
Dave Love <fx@gnu.org>
parents:
33375
diff
changeset
|
677 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
678 :group 'message-buffers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
679 :type '(choice (const :tag "unique" unique) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
680 (const :tag "unsent" unsent))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
681 |
35147 | 682 (defcustom message-default-charset |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
683 (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
|
684 "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
|
685 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
|
686 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
687 :group 'message |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
688 :type 'symbol) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
689 |
35147 | 690 (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
|
691 (and (boundp 'rmail-dont-reply-to-names) rmail-dont-reply-to-names) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
692 "*A regexp specifying names to prune when doing wide replies. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
693 A value of nil means exclude your own name only." |
33400
42c1ba3caf9c
(message-forward-as-mime, message-forward-ignored-headers)
Dave Love <fx@gnu.org>
parents:
33375
diff
changeset
|
694 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
695 :group 'message |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
696 :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
|
697 regexp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
698 |
17493 | 699 ;;; Internal variables. |
700 ;;; Well, not really internal. | |
701 | |
702 (defvar message-mode-syntax-table | |
703 (let ((table (copy-syntax-table text-mode-syntax-table))) | |
704 (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
|
705 (modify-syntax-entry ?> ". " table) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
706 (modify-syntax-entry ?< ". " table) |
17493 | 707 table) |
708 "Syntax table used while in Message mode.") | |
709 | |
710 (defvar message-mode-abbrev-table text-mode-abbrev-table | |
711 "Abbrev table used in Message mode buffers. | |
712 Defaults to `text-mode-abbrev-table'.") | |
713 | |
714 (defface message-header-to-face | |
715 '((((class color) | |
716 (background dark)) | |
717 (:foreground "green2" :bold t)) | |
718 (((class color) | |
719 (background light)) | |
720 (:foreground "MidnightBlue" :bold t)) | |
721 (t | |
722 (:bold t :italic t))) | |
723 "Face used for displaying From headers." | |
724 :group 'message-faces) | |
725 | |
726 (defface message-header-cc-face | |
727 '((((class color) | |
728 (background dark)) | |
729 (:foreground "green4" :bold t)) | |
730 (((class color) | |
731 (background light)) | |
732 (:foreground "MidnightBlue")) | |
733 (t | |
734 (:bold t))) | |
735 "Face used for displaying Cc headers." | |
736 :group 'message-faces) | |
737 | |
738 (defface message-header-subject-face | |
739 '((((class color) | |
740 (background dark)) | |
741 (:foreground "green3")) | |
742 (((class color) | |
743 (background light)) | |
744 (:foreground "navy blue" :bold t)) | |
745 (t | |
746 (:bold t))) | |
747 "Face used for displaying subject headers." | |
748 :group 'message-faces) | |
749 | |
750 (defface message-header-newsgroups-face | |
751 '((((class color) | |
752 (background dark)) | |
753 (:foreground "yellow" :bold t :italic t)) | |
754 (((class color) | |
755 (background light)) | |
756 (:foreground "blue4" :bold t :italic t)) | |
757 (t | |
758 (:bold t :italic t))) | |
759 "Face used for displaying newsgroups headers." | |
760 :group 'message-faces) | |
761 | |
762 (defface message-header-other-face | |
763 '((((class color) | |
764 (background dark)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
765 (:foreground "#b00000")) |
17493 | 766 (((class color) |
767 (background light)) | |
768 (:foreground "steel blue")) | |
769 (t | |
770 (:bold t :italic t))) | |
771 "Face used for displaying newsgroups headers." | |
772 :group 'message-faces) | |
773 | |
774 (defface message-header-name-face | |
775 '((((class color) | |
776 (background dark)) | |
777 (:foreground "DarkGreen")) | |
778 (((class color) | |
779 (background light)) | |
780 (:foreground "cornflower blue")) | |
781 (t | |
782 (:bold t))) | |
783 "Face used for displaying header names." | |
784 :group 'message-faces) | |
785 | |
786 (defface message-header-xheader-face | |
787 '((((class color) | |
788 (background dark)) | |
789 (:foreground "blue")) | |
790 (((class color) | |
791 (background light)) | |
792 (:foreground "blue")) | |
793 (t | |
794 (:bold t))) | |
795 "Face used for displaying X-Header headers." | |
796 :group 'message-faces) | |
797 | |
798 (defface message-separator-face | |
799 '((((class color) | |
800 (background dark)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
801 (:foreground "blue3")) |
17493 | 802 (((class color) |
803 (background light)) | |
804 (:foreground "brown")) | |
805 (t | |
806 (:bold t))) | |
807 "Face used for displaying the separator." | |
808 :group 'message-faces) | |
809 | |
810 (defface message-cited-text-face | |
811 '((((class color) | |
812 (background dark)) | |
813 (:foreground "red")) | |
814 (((class color) | |
815 (background light)) | |
816 (:foreground "red")) | |
817 (t | |
818 (:bold t))) | |
819 "Face used for displaying cited text names." | |
820 :group 'message-faces) | |
821 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
822 (defface message-mml-face |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
823 '((((class color) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
824 (background dark)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
825 (:foreground "ForestGreen")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
826 (((class color) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
827 (background light)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
828 (:foreground "ForestGreen")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
829 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
830 (:bold t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
831 "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
|
832 :group 'message-faces) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
833 |
17493 | 834 (defvar message-font-lock-keywords |
33156
e07128cd595f
(message-font-lock-keywords): Use [:alpha:] for
Dave Love <fx@gnu.org>
parents:
32967
diff
changeset
|
835 (let* ((cite-prefix "[:alpha:]") |
17493 | 836 (cite-suffix (concat cite-prefix "0-9_.@-")) |
33199
92f44ab47ab5
(message-font-lock-keywords): Match a final newline
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
33156
diff
changeset
|
837 (content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?")) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
838 `((,(concat "^\\([Tt]o:\\)" content) |
17493 | 839 (1 'message-header-name-face) |
840 (2 'message-header-to-face nil t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
841 (,(concat "^\\(^[GBF]?[Cc][Cc]:\\|^[Rr]eply-[Tt]o:\\)" content) |
17493 | 842 (1 'message-header-name-face) |
843 (2 'message-header-cc-face nil t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
844 (,(concat "^\\([Ss]ubject:\\)" content) |
17493 | 845 (1 'message-header-name-face) |
846 (2 'message-header-subject-face nil t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
847 (,(concat "^\\([Nn]ewsgroups:\\|Followup-[Tt]o:\\)" content) |
17493 | 848 (1 'message-header-name-face) |
849 (2 'message-header-newsgroups-face nil t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
850 (,(concat "^\\([A-Z][^: \n\t]+:\\)" content) |
17493 | 851 (1 'message-header-name-face) |
852 (2 'message-header-other-face nil t)) | |
853 (,(concat "^\\(X-[A-Za-z0-9-]+\\|In-Reply-To\\):" content) | |
854 (1 'message-header-name-face) | |
855 (2 'message-header-name-face)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
856 ,@(if (and mail-header-separator |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
857 (not (equal mail-header-separator ""))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
858 `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
859 1 'message-separator-face)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
860 nil) |
17493 | 861 (,(concat "^[ \t]*" |
862 "\\([" cite-prefix "]+[" cite-suffix "]*\\)?" | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
863 "[:>|}].*") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
864 (0 'message-cited-text-face)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
865 ("<#/?\\(multipart\\|part\\|external\\|mml\\).*>" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
866 (0 'message-mml-face)))) |
17493 | 867 "Additional expressions to highlight in Message mode.") |
868 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
869 ;; 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
|
870 ;; `font-lock-defaults' buffer-local variable. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
871 (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
|
872 |
17493 | 873 (defvar message-face-alist |
874 '((bold . bold-region) | |
875 (underline . underline-region) | |
876 (default . (lambda (b e) | |
877 (unbold-region b e) | |
878 (ununderline-region b e)))) | |
879 "Alist of mail and news faces for facemenu. | |
880 The cdr of ech entry is a function for applying the face to a region.") | |
881 | |
882 (defcustom message-send-hook nil | |
883 "Hook run before sending messages." | |
884 :group 'message-various | |
885 :options '(ispell-message) | |
886 :type 'hook) | |
887 | |
888 (defcustom message-send-mail-hook nil | |
889 "Hook run before sending mail messages." | |
890 :group 'message-various | |
891 :type 'hook) | |
892 | |
893 (defcustom message-send-news-hook nil | |
894 "Hook run before sending news messages." | |
895 :group 'message-various | |
896 :type 'hook) | |
897 | |
898 (defcustom message-sent-hook nil | |
899 "Hook run after sending messages." | |
900 :group 'message-various | |
901 :type 'hook) | |
902 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
903 (defvar message-send-coding-system 'binary |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
904 "Coding system to encode outgoing mail.") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
905 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
906 (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
|
907 mm-auto-save-coding-system |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
908 "Coding system to compose mail.") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
909 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
910 (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
|
911 "The limitation of messages sent as message/partial. |
35147 | 912 The lower bound of message size in characters, beyond which the message |
913 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
|
914 :version "21.1" |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
915 :group 'message-buffers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
916 :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
|
917 (integer 1000000))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
918 |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
919 (defcustom message-alternative-emails nil |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
920 "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
|
921 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
|
922 :group 'message-headers |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
923 :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
|
924 regexp)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
925 |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
926 (defcustom message-mail-user-agent nil |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
927 "Like `mail-user-agent'. |
35147 | 928 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
|
929 `mail-user-agent'." |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
930 :type '(radio (const :tag "Gnus native" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
931 :format "%t\n" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
932 nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
933 (const :tag "`mail-user-agent'" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
934 :format "%t\n" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
935 t) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
936 (function-item :tag "Default Emacs mail" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
937 :format "%t\n" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
938 sendmail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
939 (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
|
940 :format "%t\n" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
941 mh-e-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
942 (function :tag "Other")) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
943 :version "21.1" |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
944 :group 'message) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
945 |
17493 | 946 ;;; Internal variables. |
947 | |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
948 (defvar message-sending-message "Sending...") |
17493 | 949 (defvar message-buffer-list nil) |
950 (defvar message-this-is-news nil) | |
951 (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
|
952 (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
|
953 (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
|
954 (defvar message-posting-charset nil) |
17493 | 955 |
956 ;; Byte-compiler warning | |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
957 (eval-when-compile |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
958 (defvar gnus-active-hashtb) |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
959 (defvar gnus-read-active-file)) |
17493 | 960 |
961 ;;; 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
|
962 ;;; (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
|
963 ;;; of rmail.el's rmail-unix-mail-delimiter. |
17493 | 964 (defvar message-unix-mail-delimiter |
965 (let ((time-zone-regexp | |
966 (concat "\\([A-Z]?[A-Z]?[A-Z][A-Z]\\( DST\\)?" | |
967 "\\|[-+]?[0-9][0-9][0-9][0-9]" | |
968 "\\|" | |
969 "\\) *"))) | |
970 (concat | |
971 "From " | |
972 | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
973 ;; 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
|
974 ;; 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
|
975 ;; `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
|
976 ;; `<@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
|
977 ;; can be removed, e.g. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
978 ;; From: joe@y.z (Joe K |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
979 ;; User) |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
980 ;; can yield `From joe@y.z (Joe K Fri Mar 22 08:11:15 1996', and |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
981 ;; From: Joe User |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
982 ;; <joe@y.z> |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
983 ;; 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
|
984 ;; 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
|
985 ;; From: "Joe User"{space}{tab} |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
986 ;; <joe@y.z> |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
987 ;; 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
|
988 ;; 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
|
989 ;; 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
|
990 ;; 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
|
991 ;; obviously bogus, but after that anything goes. |
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
992 "\\([^\0-\b\n-\r\^?].*\\)? " |
17493 | 993 |
994 ;; 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
|
995 "\\([^\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
|
996 "\\([^\0-\r \^?]+\\) +" ; month |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
997 "\\([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
|
998 "\\([0-2][0-9]:[0-5][0-9]\\(:[0-6][0-9]\\)?\\) *" ; time of day |
17493 | 999 |
1000 ;; Perhaps a time zone, specified by an abbreviation, or by a | |
1001 ;; numeric offset. | |
1002 time-zone-regexp | |
1003 | |
1004 ;; The year. | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1005 " \\([0-9][0-9]+\\) *" |
17493 | 1006 |
1007 ;; On some systems the time zone can appear after the year, too. | |
1008 time-zone-regexp | |
1009 | |
1010 ;; Old uucp cruft. | |
1011 "\\(remote from .*\\)?" | |
1012 | |
19762
f6ca32374b0b
(message-unix-mail-delimiter): Initialize
Richard M. Stallman <rms@gnu.org>
parents:
19525
diff
changeset
|
1013 "\n")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1014 "Regexp matching the delimiter of messages in UNIX mail format.") |
17493 | 1015 |
1016 (defvar message-unsent-separator | |
1017 (concat "^ *---+ +Unsent message follows +---+ *$\\|" | |
1018 "^ *---+ +Returned message +---+ *$\\|" | |
1019 "^Start of returned message$\\|" | |
1020 "^ *---+ +Original message +---+ *$\\|" | |
1021 "^ *--+ +begin message +--+ *$\\|" | |
1022 "^ *---+ +Original message follows +---+ *$\\|" | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1023 "^ *---+ +Undelivered message follows +---+ *$\\|" |
17493 | 1024 "^|? *---+ +Message text follows: +---+ *|?$") |
1025 "A regexp that matches the separator before the text of a failed message.") | |
1026 | |
1027 (defvar message-header-format-alist | |
1028 `((Newsgroups) | |
1029 (To . message-fill-address) | |
1030 (Cc . message-fill-address) | |
1031 (Subject) | |
1032 (In-Reply-To) | |
1033 (Fcc) | |
1034 (Bcc) | |
1035 (Date) | |
1036 (Organization) | |
1037 (Distribution) | |
1038 (Lines) | |
1039 (Expires) | |
1040 (Message-ID) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1041 (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
|
1042 (User-Agent)) |
17493 | 1043 "Alist used for formatting headers.") |
1044 | |
1045 (eval-and-compile | |
1046 (autoload 'message-setup-toolbar "messagexmas") | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1047 (autoload 'mh-new-draft-name "mh-comp") |
17493 | 1048 (autoload 'mh-send-letter "mh-comp") |
1049 (autoload 'gnus-point-at-eol "gnus-util") | |
1050 (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
|
1051 (autoload 'gnus-output-to-rmail "gnus-util") |
17493 | 1052 (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
|
1053 (autoload 'mail-abbrev-in-expansion-header-p "mailabbrev") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1054 (autoload 'nndraft-request-associate-buffer "nndraft") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1055 (autoload 'nndraft-request-expire-articles "nndraft") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1056 (autoload 'gnus-open-server "gnus-int") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1057 (autoload 'gnus-request-post "gnus-int") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1058 (autoload 'gnus-alive-p "gnus-util") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1059 (autoload 'gnus-group-name-charset "gnus-group") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1060 (autoload 'rmail-output "rmail")) |
17493 | 1061 |
1062 | |
1063 | |
1064 ;;; | |
1065 ;;; Utility functions. | |
1066 ;;; | |
1067 | |
1068 (defmacro message-y-or-n-p (question show &rest text) | |
35147 | 1069 "Ask QUESTION, displaying remaining args in a temporary buffer if SHOW." |
17493 | 1070 `(message-talkative-question 'y-or-n-p ,question ,show ,@text)) |
1071 | |
1072 (defmacro message-delete-line (&optional n) | |
35147 | 1073 "Delete the current line (and the next N lines)." |
17493 | 1074 `(delete-region (progn (beginning-of-line) (point)) |
1075 (progn (forward-line ,(or n 1)) (point)))) | |
1076 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1077 (defun message-unquote-tokens (elems) |
35147 | 1078 "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
|
1079 (mapcar (lambda (item) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1080 (while (string-match "^\\(.*\\)\"\\(.*\\)$" item) |
35147 | 1081 (setq item (concat (match-string 1 item) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1082 (match-string 2 item)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1083 item) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1084 elems)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1085 |
17493 | 1086 (defun message-tokenize-header (header &optional separator) |
1087 "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
|
1088 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
|
1089 is used by default." |
17493 | 1090 (if (not header) |
1091 nil | |
1092 (let ((regexp (format "[%s]+" (or separator ","))) | |
1093 (beg 1) | |
1094 (first t) | |
1095 quoted elems paren) | |
1096 (save-excursion | |
1097 (message-set-work-buffer) | |
1098 (insert header) | |
1099 (goto-char (point-min)) | |
1100 (while (not (eobp)) | |
1101 (if first | |
1102 (setq first nil) | |
1103 (forward-char 1)) | |
1104 (cond ((and (> (point) beg) | |
1105 (or (eobp) | |
1106 (and (looking-at regexp) | |
1107 (not quoted) | |
1108 (not paren)))) | |
1109 (push (buffer-substring beg (point)) elems) | |
1110 (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
|
1111 ((eq (char-after) ?\") |
17493 | 1112 (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
|
1113 ((and (eq (char-after) ?\() |
17493 | 1114 (not quoted)) |
1115 (setq paren t)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1116 ((and (eq (char-after) ?\)) |
17493 | 1117 (not quoted)) |
1118 (setq paren nil)))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1119 (nreverse elems))))) |
17493 | 1120 |
1121 (defun message-mail-file-mbox-p (file) | |
1122 "Say whether FILE looks like a Unix mbox file." | |
1123 (when (and (file-exists-p file) | |
1124 (file-readable-p file) | |
1125 (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
|
1126 (with-temp-buffer |
17493 | 1127 (nnheader-insert-file-contents file) |
1128 (goto-char (point-min)) | |
1129 (looking-at message-unix-mail-delimiter)))) | |
1130 | |
1131 (defun message-fetch-field (header &optional not-all) | |
1132 "The same as `mail-fetch-field', only remove all newlines." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1133 (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
|
1134 (case-fold-search t) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1135 (value (mail-fetch-field header nil (not not-all)))) |
17493 | 1136 (when value |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1137 (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
|
1138 (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
|
1139 (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
|
1140 value))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1141 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1142 (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
|
1143 "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
|
1144 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1145 (narrow-to-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1146 (point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1147 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1148 (forward-line 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1149 (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
|
1150 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1151 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1152 (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1153 (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1154 (goto-char (point-min))) |
17493 | 1155 |
1156 (defun message-add-header (&rest headers) | |
1157 "Add the HEADERS to the message header, skipping those already present." | |
1158 (while headers | |
1159 (let (hclean) | |
1160 (unless (string-match "^\\([^:]+\\):[ \t]*[^ \t]" (car headers)) | |
1161 (error "Invalid header `%s'" (car headers))) | |
1162 (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
|
1163 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1164 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1165 (unless (re-search-forward (concat "^" (regexp-quote hclean) ":") nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1166 (insert (car headers) ?\n)))) |
17493 | 1167 (setq headers (cdr headers)))) |
1168 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1169 |
17493 | 1170 (defun message-fetch-reply-field (header) |
35147 | 1171 "Fetch field HEADER from the message we're replying to." |
17493 | 1172 (when (and message-reply-buffer |
1173 (buffer-name message-reply-buffer)) | |
1174 (save-excursion | |
1175 (set-buffer message-reply-buffer) | |
1176 (message-fetch-field header)))) | |
1177 | |
1178 (defun message-set-work-buffer () | |
1179 (if (get-buffer " *message work*") | |
1180 (progn | |
1181 (set-buffer " *message work*") | |
1182 (erase-buffer)) | |
1183 (set-buffer (get-buffer-create " *message work*")) | |
1184 (kill-all-local-variables) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1185 (mm-enable-multibyte))) |
17493 | 1186 |
1187 (defun message-functionp (form) | |
1188 "Return non-nil if FORM is funcallable." | |
1189 (or (and (symbolp form) (fboundp form)) | |
1190 (and (listp form) (eq (car form) 'lambda)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1191 (byte-code-function-p form))) |
17493 | 1192 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1193 (defun message-strip-list-identifiers (subject) |
35147 | 1194 "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
|
1195 (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
|
1196 (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
|
1197 gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1198 (mapconcat 'identity gnus-list-identifiers " *\\|")))) |
35147 | 1199 (if (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1200 " *\\)\\)+\\(Re: +\\)?\\)") subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1201 (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
|
1202 (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
|
1203 (match-string 5 subject)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1204 (substring subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1205 (match-end 1))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1206 subject))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1207 |
17493 | 1208 (defun message-strip-subject-re (subject) |
35147 | 1209 "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
|
1210 (if (string-match message-subject-re-regexp subject) |
17493 | 1211 (substring subject (match-end 0)) |
1212 subject)) | |
1213 | |
1214 (defun message-remove-header (header &optional is-regexp first reverse) | |
1215 "Remove HEADER in the narrowed buffer. | |
35147 | 1216 If IS-REGEXP, HEADER is a regular expression. |
17493 | 1217 If FIRST, only remove the first instance of the header. |
1218 Return the number of headers removed." | |
1219 (goto-char (point-min)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1220 (let ((regexp (if is-regexp header (concat "^" (regexp-quote header) ":"))) |
17493 | 1221 (number 0) |
1222 (case-fold-search t) | |
1223 last) | |
1224 (while (and (not (eobp)) | |
1225 (not last)) | |
1226 (if (if reverse | |
1227 (not (looking-at regexp)) | |
1228 (looking-at regexp)) | |
1229 (progn | |
1230 (incf number) | |
1231 (when first | |
1232 (setq last t)) | |
1233 (delete-region | |
1234 (point) | |
1235 ;; There might be a continuation header, so we have to search | |
1236 ;; until we find a new non-continuation line. | |
1237 (progn | |
1238 (forward-line 1) | |
1239 (if (re-search-forward "^[^ \t]" nil t) | |
1240 (goto-char (match-beginning 0)) | |
1241 (point-max))))) | |
1242 (forward-line 1) | |
1243 (if (re-search-forward "^[^ \t]" nil t) | |
1244 (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
|
1245 (goto-char (point-max))))) |
17493 | 1246 number)) |
1247 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1248 (defun message-remove-first-header (header) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1249 "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
|
1250 (let ((count 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1251 (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
|
1252 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1253 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1254 (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
|
1255 (incf count))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1256 (while (> count 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1257 (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
|
1258 (decf count)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1259 |
17493 | 1260 (defun message-narrow-to-headers () |
1261 "Narrow the buffer to the head of the message." | |
1262 (widen) | |
1263 (narrow-to-region | |
1264 (goto-char (point-min)) | |
1265 (if (re-search-forward | |
1266 (concat "^" (regexp-quote mail-header-separator) "\n") nil t) | |
1267 (match-beginning 0) | |
1268 (point-max))) | |
1269 (goto-char (point-min))) | |
1270 | |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
1271 (defun message-narrow-to-head-1 () |
35147 | 1272 "Like `message-narrow-to-head'. Don't widen." |
17493 | 1273 (narrow-to-region |
1274 (goto-char (point-min)) | |
1275 (if (search-forward "\n\n" nil 1) | |
1276 (1- (point)) | |
1277 (point-max))) | |
1278 (goto-char (point-min))) | |
1279 | |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
1280 (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
|
1281 "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
|
1282 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
|
1283 (widen) |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
1284 (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
|
1285 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1286 (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
|
1287 "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
|
1288 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1289 (narrow-to-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1290 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1291 (cond |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1292 ((re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1293 (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
|
1294 (match-beginning 0)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1295 ((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
|
1296 (1- (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1297 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1298 (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1299 (goto-char (point-min))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1300 |
17493 | 1301 (defun message-news-p () |
1302 "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
|
1303 (and (not message-this-is-mail) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1304 (or message-this-is-news |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1305 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1306 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1307 (message-narrow-to-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1308 (and (message-fetch-field "newsgroups") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1309 (not (message-fetch-field "posted-to")))))))) |
17493 | 1310 |
1311 (defun message-mail-p () | |
1312 "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
|
1313 (and (not message-this-is-news) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1314 (or message-this-is-mail |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1315 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1316 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1317 (message-narrow-to-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1318 (or (message-fetch-field "to") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1319 (message-fetch-field "cc") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1320 (message-fetch-field "bcc"))))))) |
17493 | 1321 |
1322 (defun message-next-header () | |
1323 "Go to the beginning of the next header." | |
1324 (beginning-of-line) | |
1325 (or (eobp) (forward-char 1)) | |
1326 (not (if (re-search-forward "^[^ \t]" nil t) | |
1327 (beginning-of-line) | |
1328 (goto-char (point-max))))) | |
1329 | |
1330 (defun message-sort-headers-1 () | |
1331 "Sort the buffer as headers using `message-rank' text props." | |
1332 (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
|
1333 (require 'sort) |
17493 | 1334 (sort-subr |
1335 nil 'message-next-header | |
1336 (lambda () | |
1337 (message-next-header) | |
1338 (unless (bobp) | |
1339 (forward-char -1))) | |
1340 (lambda () | |
1341 (or (get-text-property (point) 'message-rank) | |
1342 10000)))) | |
1343 | |
1344 (defun message-sort-headers () | |
1345 "Sort the headers of the current message according to `message-header-format-alist'." | |
1346 (interactive) | |
1347 (save-excursion | |
1348 (save-restriction | |
1349 (let ((max (1+ (length message-header-format-alist))) | |
1350 rank) | |
1351 (message-narrow-to-headers) | |
1352 (while (re-search-forward "^[^ \n]+:" nil t) | |
1353 (put-text-property | |
1354 (match-beginning 0) (1+ (match-beginning 0)) | |
1355 'message-rank | |
1356 (if (setq rank (length (memq (assq (intern (buffer-substring | |
1357 (match-beginning 0) | |
1358 (1- (match-end 0)))) | |
1359 message-header-format-alist) | |
1360 message-header-format-alist))) | |
1361 (- max rank) | |
1362 (1+ max))))) | |
1363 (message-sort-headers-1)))) | |
1364 | |
1365 | |
1366 | |
1367 ;;; | |
1368 ;;; Message mode | |
1369 ;;; | |
1370 | |
1371 ;;; Set up keymap. | |
1372 | |
1373 (defvar message-mode-map nil) | |
1374 | |
1375 (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
|
1376 (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
|
1377 (set-keymap-parent message-mode-map text-mode-map) |
17493 | 1378 (define-key message-mode-map "\C-c?" 'describe-mode) |
1379 | |
1380 (define-key message-mode-map "\C-c\C-f\C-t" 'message-goto-to) | |
1381 (define-key message-mode-map "\C-c\C-f\C-b" 'message-goto-bcc) | |
1382 (define-key message-mode-map "\C-c\C-f\C-w" 'message-goto-fcc) | |
1383 (define-key message-mode-map "\C-c\C-f\C-c" 'message-goto-cc) | |
1384 (define-key message-mode-map "\C-c\C-f\C-s" 'message-goto-subject) | |
1385 (define-key message-mode-map "\C-c\C-f\C-r" 'message-goto-reply-to) | |
1386 (define-key message-mode-map "\C-c\C-f\C-n" 'message-goto-newsgroups) | |
1387 (define-key message-mode-map "\C-c\C-f\C-d" 'message-goto-distribution) | |
1388 (define-key message-mode-map "\C-c\C-f\C-f" 'message-goto-followup-to) | |
1389 (define-key message-mode-map "\C-c\C-f\C-k" 'message-goto-keywords) | |
1390 (define-key message-mode-map "\C-c\C-f\C-u" 'message-goto-summary) | |
1391 (define-key message-mode-map "\C-c\C-b" 'message-goto-body) | |
1392 (define-key message-mode-map "\C-c\C-i" 'message-goto-signature) | |
1393 | |
1394 (define-key message-mode-map "\C-c\C-t" 'message-insert-to) | |
1395 (define-key message-mode-map "\C-c\C-n" 'message-insert-newsgroups) | |
1396 | |
1397 (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
|
1398 (define-key message-mode-map "\C-c\M-\C-y" 'message-yank-buffer) |
17493 | 1399 (define-key message-mode-map "\C-c\C-q" 'message-fill-yanked-message) |
1400 (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
|
1401 (define-key message-mode-map "\C-c\M-h" 'message-insert-headers) |
17493 | 1402 (define-key message-mode-map "\C-c\C-r" 'message-caesar-buffer-body) |
1403 (define-key message-mode-map "\C-c\C-o" 'message-sort-headers) | |
1404 (define-key message-mode-map "\C-c\M-r" 'message-rename-buffer) | |
1405 | |
1406 (define-key message-mode-map "\C-c\C-c" 'message-send-and-exit) | |
1407 (define-key message-mode-map "\C-c\C-s" 'message-send) | |
1408 (define-key message-mode-map "\C-c\C-k" 'message-kill-buffer) | |
1409 (define-key message-mode-map "\C-c\C-d" 'message-dont-send) | |
1410 | |
1411 (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
|
1412 (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
|
1413 (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
|
1414 (define-key message-mode-map "\M-\r" 'message-newline-and-reformat) |
17493 | 1415 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1416 (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
|
1417 |
17493 | 1418 (define-key message-mode-map "\t" 'message-tab)) |
1419 | |
1420 (easy-menu-define | |
1421 message-mode-menu message-mode-map "Message Menu." | |
1422 '("Message" | |
1423 ["Sort Headers" message-sort-headers t] | |
1424 ["Yank Original" message-yank-original t] | |
1425 ["Fill Yanked Message" message-fill-yanked-message t] | |
1426 ["Insert Signature" message-insert-signature t] | |
1427 ["Caesar (rot13) Message" message-caesar-buffer-body t] | |
1428 ["Caesar (rot13) Region" message-caesar-region (mark t)] | |
1429 ["Elide Region" message-elide-region (mark t)] | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1430 ["Delete Outside Region" message-delete-not-region (mark t)] |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1431 ["Kill To Signature" message-kill-to-signature t] |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1432 ["Newline and Reformat" message-newline-and-reformat t] |
17493 | 1433 ["Rename buffer" message-rename-buffer t] |
32964
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1434 ["Spellcheck" ispell-message |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1435 :help "Spellcheck this message"] |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1436 ["Attach file as MIME" mml-attach-file |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1437 :help "Attach a file at point"] |
17493 | 1438 "----" |
32964
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1439 ["Send Message" message-send-and-exit |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1440 :help "Send this message"] |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1441 ["Abort Message" message-dont-send |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1442 :help "File this draft message and exit"] |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1443 ["Kill Message" message-kill-buffer |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1444 :help "Delete this message without sending"])) |
17493 | 1445 |
1446 (easy-menu-define | |
1447 message-mode-field-menu message-mode-map "" | |
1448 '("Field" | |
1449 ["Fetch To" message-insert-to t] | |
1450 ["Fetch Newsgroups" message-insert-newsgroups t] | |
1451 "----" | |
1452 ["To" message-goto-to t] | |
1453 ["Subject" message-goto-subject t] | |
1454 ["Cc" message-goto-cc t] | |
1455 ["Reply-To" message-goto-reply-to t] | |
1456 ["Summary" message-goto-summary t] | |
1457 ["Keywords" message-goto-keywords t] | |
1458 ["Newsgroups" message-goto-newsgroups t] | |
1459 ["Followup-To" message-goto-followup-to t] | |
1460 ["Distribution" message-goto-distribution t] | |
1461 ["Body" message-goto-body t] | |
1462 ["Signature" message-goto-signature t])) | |
1463 | |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
1464 (eval-when-compile |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
1465 (defvar facemenu-add-face-function) |
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
1466 (defvar facemenu-remove-face-function)) |
17493 | 1467 |
1468 ;;;###autoload | |
1469 (defun message-mode () | |
1470 "Major mode for editing mail and news to be sent. | |
35147 | 1471 Like Text Mode but with these additional commands:\\<message-mode-map> |
1472 C-c C-s `message-send' (send the message) C-c C-c `message-send-and-exit' | |
1473 C-c C-d Postpone sending the message C-c C-k Kill the message | |
17493 | 1474 C-c C-f move to a header field (and create it if there isn't): |
1475 C-c C-f C-t move to To C-c C-f C-s move to Subject | |
1476 C-c C-f C-c move to Cc C-c C-f C-b move to Bcc | |
1477 C-c C-f C-w move to Fcc C-c C-f C-r move to Reply-To | |
1478 C-c C-f C-u move to Summary C-c C-f C-n move to Newsgroups | |
1479 C-c C-f C-k move to Keywords C-c C-f C-d move to Distribution | |
1480 C-c C-f C-f move to Followup-To | |
35147 | 1481 C-c C-t `message-insert-to' (add a To header to a news followup) |
1482 C-c C-n `message-insert-newsgroups' (add a Newsgroup header to a news reply) | |
1483 C-c C-b `message-goto-body' (move to beginning of message text). | |
1484 C-c C-i `message-goto-signature' (move to the beginning of the signature). | |
1485 C-c C-w `message-insert-signature' (insert `message-signature-file' file). | |
1486 C-c C-y `message-yank-original' (insert current message, if any). | |
1487 C-c C-q `message-fill-yanked-message' (fill what was yanked). | |
1488 C-c C-e `message-elide-region' (elide the text between point and mark). | |
1489 C-c C-v `message-delete-not-region' (remove the text outside the region). | |
1490 C-c C-z `message-kill-to-signature' (kill the text up to the signature). | |
1491 C-c C-r `message-caesar-buffer-body' (rot13 the message body). | |
1492 C-c C-a `mml-attach-file' (attach a file as MIME). | |
1493 M-RET `message-newline-and-reformat' (break the line and reformat)." | |
17493 | 1494 (interactive) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1495 (if (local-variable-p 'mml-buffer-list (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1496 (mml-destroy-buffers)) |
17493 | 1497 (kill-all-local-variables) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1498 (set (make-local-variable 'message-reply-buffer) nil) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1499 (make-local-variable 'message-send-actions) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1500 (make-local-variable 'message-exit-actions) |
17493 | 1501 (make-local-variable 'message-kill-actions) |
1502 (make-local-variable 'message-postpone-actions) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1503 (make-local-variable 'message-draft-article) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1504 (make-local-hook 'kill-buffer-hook) |
17493 | 1505 (set-syntax-table message-mode-syntax-table) |
1506 (use-local-map message-mode-map) | |
1507 (setq local-abbrev-table message-mode-abbrev-table) | |
1508 (setq major-mode 'message-mode) | |
1509 (setq mode-name "Message") | |
1510 (setq buffer-offer-save t) | |
1511 (make-local-variable 'facemenu-add-face-function) | |
1512 (make-local-variable 'facemenu-remove-face-function) | |
1513 (setq facemenu-add-face-function | |
1514 (lambda (face end) | |
1515 (let ((face-fun (cdr (assq face message-face-alist)))) | |
1516 (if face-fun | |
1517 (funcall face-fun (point) end) | |
1518 (error "Face %s not configured for %s mode" face mode-name))) | |
1519 "") | |
1520 facemenu-remove-face-function t) | |
1521 (make-local-variable 'message-reply-headers) | |
1522 (setq message-reply-headers nil) | |
1523 (make-local-variable 'message-newsreader) | |
1524 (make-local-variable 'message-mailer) | |
1525 (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
|
1526 (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
|
1527 (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
|
1528 (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
|
1529 (message-setup-fill-variables) |
34766 | 1530 ;; Allow using comment commands to add/remove quoting. |
34762
d8e4421fc16f
(message-mode): Set `comment-start' to the yank prefix.
Miles Bader <miles@gnu.org>
parents:
34752
diff
changeset
|
1531 (set (make-local-variable 'comment-start) message-yank-prefix) |
17493 | 1532 ;;(when (fboundp 'mail-hist-define-keys) |
1533 ;; (mail-hist-define-keys)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1534 (if (featurep 'xemacs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1535 (message-setup-toolbar) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1536 (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
|
1537 '(message-font-lock-keywords t)) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1538 (if (boundp 'message-tool-bar-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
1539 (set (make-local-variable 'tool-bar-map) message-tool-bar-map))) |
17493 | 1540 (easy-menu-add message-mode-menu message-mode-map) |
1541 (easy-menu-add message-mode-field-menu message-mode-map) | |
1542 ;; Allow mail alias things. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1543 (when (eq message-mail-alias-type 'abbrev) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1544 (if (fboundp 'mail-abbrevs-setup) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1545 (mail-abbrevs-setup) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1546 (mail-aliases-setup))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1547 (message-set-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
|
1548 (mm-enable-multibyte) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1549 (make-local-variable 'indent-tabs-mode) ;Turn off tabs for indentation. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1550 (setq indent-tabs-mode nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1551 (mml-mode) |
17493 | 1552 (run-hooks 'text-mode-hook 'message-mode-hook)) |
1553 | |
33436
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1554 (defun message-setup-fill-variables () |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1555 "Setup message fill variables." |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1556 (make-local-variable 'paragraph-separate) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1557 (make-local-variable 'paragraph-start) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1558 (make-local-variable 'adaptive-fill-regexp) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1559 (unless (boundp 'adaptive-fill-first-line-regexp) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1560 (setq adaptive-fill-first-line-regexp nil)) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1561 (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
|
1562 (make-local-variable 'auto-fill-inhibit-regexp) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1563 (let ((quote-prefix-regexp |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1564 (concat |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1565 "[ \t]*" ; possible initial space |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1566 "\\(\\(" (regexp-quote message-yank-prefix) "\\|" ; user's prefix |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1567 "\\w+>\\|" ; supercite-style prefix |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1568 "[|:>]" ; standard prefix |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1569 "\\)[ \t]*\\)+"))) ; possible space after each prefix |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1570 (setq paragraph-start |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1571 (concat |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1572 (regexp-quote mail-header-separator) "$\\|" |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1573 "[ \t]*$\\|" ; blank lines |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1574 "-- $\\|" ; signature delimiter |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1575 "---+$\\|" ; delimiters for forwarded messages |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1576 page-delimiter "$\\|" ; spoiler warnings |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1577 ".*wrote:$\\|" ; attribution lines |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1578 quote-prefix-regexp "$")) ; empty lines in quoted text |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1579 (setq paragraph-separate paragraph-start) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1580 (setq adaptive-fill-regexp |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1581 (concat quote-prefix-regexp "\\|" adaptive-fill-regexp)) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1582 (setq adaptive-fill-first-line-regexp |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1583 (concat quote-prefix-regexp "\\|" |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1584 adaptive-fill-first-line-regexp)) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1585 (setq auto-fill-inhibit-regexp "^[A-Z][^: \n\t]+:"))) |
a324254af725
From Emerick Rogul <emerick@csa.bu.edu>.
Dave Love <fx@gnu.org>
parents:
33400
diff
changeset
|
1586 |
17493 | 1587 |
1588 | |
1589 ;;; | |
1590 ;;; Message mode commands | |
1591 ;;; | |
1592 | |
1593 ;;; Movement commands | |
1594 | |
1595 (defun message-goto-to () | |
1596 "Move point to the To header." | |
1597 (interactive) | |
1598 (message-position-on-field "To")) | |
1599 | |
1600 (defun message-goto-subject () | |
1601 "Move point to the Subject header." | |
1602 (interactive) | |
1603 (message-position-on-field "Subject")) | |
1604 | |
1605 (defun message-goto-cc () | |
1606 "Move point to the Cc header." | |
1607 (interactive) | |
1608 (message-position-on-field "Cc" "To")) | |
1609 | |
1610 (defun message-goto-bcc () | |
1611 "Move point to the Bcc header." | |
1612 (interactive) | |
1613 (message-position-on-field "Bcc" "Cc" "To")) | |
1614 | |
1615 (defun message-goto-fcc () | |
1616 "Move point to the Fcc header." | |
1617 (interactive) | |
1618 (message-position-on-field "Fcc" "To" "Newsgroups")) | |
1619 | |
1620 (defun message-goto-reply-to () | |
1621 "Move point to the Reply-To header." | |
1622 (interactive) | |
1623 (message-position-on-field "Reply-To" "Subject")) | |
1624 | |
1625 (defun message-goto-newsgroups () | |
1626 "Move point to the Newsgroups header." | |
1627 (interactive) | |
1628 (message-position-on-field "Newsgroups")) | |
1629 | |
1630 (defun message-goto-distribution () | |
1631 "Move point to the Distribution header." | |
1632 (interactive) | |
1633 (message-position-on-field "Distribution")) | |
1634 | |
1635 (defun message-goto-followup-to () | |
1636 "Move point to the Followup-To header." | |
1637 (interactive) | |
1638 (message-position-on-field "Followup-To" "Newsgroups")) | |
1639 | |
1640 (defun message-goto-keywords () | |
1641 "Move point to the Keywords header." | |
1642 (interactive) | |
1643 (message-position-on-field "Keywords" "Subject")) | |
1644 | |
1645 (defun message-goto-summary () | |
1646 "Move point to the Summary header." | |
1647 (interactive) | |
1648 (message-position-on-field "Summary" "Subject")) | |
1649 | |
1650 (defun message-goto-body () | |
1651 "Move point to the beginning of the message body." | |
1652 (interactive) | |
1653 (if (looking-at "[ \t]*\n") (expand-abbrev)) | |
1654 (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
|
1655 (or (search-forward (concat "\n" mail-header-separator "\n") nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1656 (search-forward "\n\n" nil t))) |
17493 | 1657 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1658 (defun message-goto-eoh () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1659 "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
|
1660 (interactive) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1661 (message-goto-body) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1662 (forward-line -1)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1663 |
17493 | 1664 (defun message-goto-signature () |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1665 "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
|
1666 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
|
1667 return nil." |
17493 | 1668 (interactive) |
1669 (goto-char (point-min)) | |
1670 (if (re-search-forward message-signature-separator nil t) | |
1671 (forward-line 1) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1672 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1673 nil)) |
17493 | 1674 |
1675 | |
1676 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1677 (defun message-insert-to (&optional force) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1678 "Insert a To header that points to the author of the article being replied to. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1679 If the original author requested not to be sent mail, the function signals |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1680 an error. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1681 With the prefix argument FORCE, insert the header anyway." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1682 (interactive "P") |
17493 | 1683 (let ((co (message-fetch-reply-field "mail-copies-to"))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1684 (when (and (null force) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
1685 co |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1686 (or (equal (downcase co) "never") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1687 (equal (downcase co) "nobody"))) |
17493 | 1688 (error "The user has requested not to have copies sent via mail"))) |
1689 (when (and (message-position-on-field "To") | |
1690 (mail-fetch-field "to") | |
1691 (not (string-match "\\` *\\'" (mail-fetch-field "to")))) | |
1692 (insert ", ")) | |
1693 (insert (or (message-fetch-reply-field "reply-to") | |
1694 (message-fetch-reply-field "from") ""))) | |
1695 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1696 (defun message-widen-reply () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1697 "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
|
1698 (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1699 (let ((follow-to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1700 (and message-reply-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1701 (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
|
1702 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1703 (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
|
1704 (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
|
1705 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1706 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1707 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1708 (dolist (elem follow-to) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1709 (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
|
1710 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1711 (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
|
1712 (cdr elem) "\n")))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1713 |
17493 | 1714 (defun message-insert-newsgroups () |
1715 "Insert the Newsgroups header from the article being replied to." | |
1716 (interactive) | |
1717 (when (and (message-position-on-field "Newsgroups") | |
1718 (mail-fetch-field "newsgroups") | |
1719 (not (string-match "\\` *\\'" (mail-fetch-field "newsgroups")))) | |
1720 (insert ",")) | |
1721 (insert (or (message-fetch-reply-field "newsgroups") ""))) | |
1722 | |
1723 | |
1724 | |
1725 ;;; Various commands | |
1726 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1727 (defun message-delete-not-region (beg end) |
35147 | 1728 "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
|
1729 (interactive "r") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1730 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1731 (goto-char end) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1732 (delete-region (point) (if (not (message-goto-signature)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1733 (point) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1734 (forward-line -2) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1735 (point))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1736 (insert "\n") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1737 (goto-char beg) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1738 (delete-region beg (progn (message-goto-body) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1739 (forward-line 2) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1740 (point)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1741 (when (message-goto-signature) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1742 (forward-line -2))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1743 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1744 (defun message-kill-to-signature () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1745 "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
|
1746 (interactive) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1747 (let ((point (point))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1748 (message-goto-signature) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1749 (unless (eobp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1750 (forward-line -2)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1751 (kill-region point (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1752 (unless (bolp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1753 (insert "\n")))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1754 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1755 (defun message-newline-and-reformat () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1756 "Insert four newlines, and then reformat if inside quoted text." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1757 (interactive) |
33375
d7d4bd9d131c
(message-mode) <adaptive-fill-regexp>:
Dave Love <fx@gnu.org>
parents:
33342
diff
changeset
|
1758 ;; The Latin-1 angle quote looks pretty dubious. -- fx |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1759 (let ((prefix "[]>»|:}+ \t]*") |
33375
d7d4bd9d131c
(message-mode) <adaptive-fill-regexp>:
Dave Love <fx@gnu.org>
parents:
33342
diff
changeset
|
1760 (supercite-thing "[-._[:alnum:]]*[>]+[ \t]*") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1761 quoted point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1762 (unless (bolp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1763 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1764 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1765 (when (looking-at (concat prefix |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1766 supercite-thing)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1767 (setq quoted (match-string 0)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1768 (insert "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1769 (setq point (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1770 (insert "\n\n\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1771 (delete-region (point) (re-search-forward "[ \t]*")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1772 (when quoted |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1773 (insert quoted)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1774 (fill-paragraph nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1775 (goto-char point) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1776 (forward-line 1))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1777 |
17493 | 1778 (defun message-insert-signature (&optional force) |
35147 | 1779 "Insert a signature. See documentation for variable `message-signature'." |
17493 | 1780 (interactive (list 0)) |
1781 (let* ((signature | |
1782 (cond | |
1783 ((and (null message-signature) | |
1784 (eq force 0)) | |
1785 (save-excursion | |
1786 (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
|
1787 (not (re-search-backward message-signature-separator nil t)))) |
17493 | 1788 ((and (null message-signature) |
1789 force) | |
1790 t) | |
1791 ((message-functionp message-signature) | |
1792 (funcall message-signature)) | |
1793 ((listp message-signature) | |
1794 (eval message-signature)) | |
1795 (t message-signature))) | |
1796 (signature | |
1797 (cond ((stringp signature) | |
1798 signature) | |
1799 ((and (eq t signature) | |
1800 message-signature-file | |
1801 (file-exists-p message-signature-file)) | |
1802 signature)))) | |
1803 (when signature | |
1804 (goto-char (point-max)) | |
1805 ;; Insert the signature. | |
1806 (unless (bolp) | |
1807 (insert "\n")) | |
1808 (insert "\n-- \n") | |
1809 (if (eq signature t) | |
1810 (insert-file-contents message-signature-file) | |
1811 (insert signature)) | |
1812 (goto-char (point-max)) | |
1813 (or (bolp) (insert "\n"))))) | |
1814 | |
1815 (defun message-elide-region (b e) | |
35147 | 1816 "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
|
1817 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
|
1818 text was killed." |
17493 | 1819 (interactive "r") |
1820 (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
|
1821 (insert message-elide-ellipsis)) |
17493 | 1822 |
1823 (defvar message-caesar-translation-table nil) | |
1824 | |
1825 (defun message-caesar-region (b e &optional n) | |
35147 | 1826 "Caesar rotate region B to E by N, default 13, for decrypting netnews." |
17493 | 1827 (interactive |
1828 (list | |
1829 (min (point) (or (mark t) (point))) | |
1830 (max (point) (or (mark t) (point))) | |
1831 (when current-prefix-arg | |
1832 (prefix-numeric-value current-prefix-arg)))) | |
1833 | |
1834 (setq n (if (numberp n) (mod n 26) 13)) ;canonize N | |
1835 (unless (or (zerop n) ; no action needed for a rot of 0 | |
1836 (= b e)) ; no region to rotate | |
1837 ;; We build the table, if necessary. | |
1838 (when (or (not message-caesar-translation-table) | |
1839 (/= (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
|
1840 (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
|
1841 (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
|
1842 (translate-region b e message-caesar-translation-table))) |
17493 | 1843 |
1844 (defun message-make-caesar-translation-table (n) | |
1845 "Create a rot table with offset N." | |
1846 (let ((i -1) | |
1847 (table (make-string 256 0))) | |
1848 (while (< (incf i) 256) | |
1849 (aset table i i)) | |
1850 (concat | |
1851 (substring table 0 ?A) | |
1852 (substring table (+ ?A n) (+ ?A n (- 26 n))) | |
1853 (substring table ?A (+ ?A n)) | |
1854 (substring table (+ ?A 26) ?a) | |
1855 (substring table (+ ?a n) (+ ?a n (- 26 n))) | |
1856 (substring table ?a (+ ?a n)) | |
1857 (substring table (+ ?a 26) 255)))) | |
1858 | |
1859 (defun message-caesar-buffer-body (&optional rotnum) | |
35147 | 1860 "Caesar rotate all letters in the current buffer by 13 places. |
1861 Used to encode/decode possibly offensive messages (commonly in rec.humor). | |
17493 | 1862 With prefix arg, specifies the number of places to rotate each letter forward. |
1863 Mail and USENET news headers are not rotated." | |
1864 (interactive (if current-prefix-arg | |
1865 (list (prefix-numeric-value current-prefix-arg)) | |
1866 (list nil))) | |
1867 (save-excursion | |
1868 (save-restriction | |
1869 (when (message-goto-body) | |
1870 (narrow-to-region (point) (point-max))) | |
1871 (message-caesar-region (point-min) (point-max) rotnum)))) | |
1872 | |
1873 (defun message-pipe-buffer-body (program) | |
1874 "Pipe the message body in the current buffer through PROGRAM." | |
1875 (save-excursion | |
1876 (save-restriction | |
1877 (when (message-goto-body) | |
1878 (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
|
1879 (shell-command-on-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1880 (point-min) (point-max) program nil t)))) |
17493 | 1881 |
1882 (defun message-rename-buffer (&optional enter-string) | |
1883 "Rename the *message* buffer to \"*message* RECIPIENT\". | |
1884 If the function is run with a prefix, it will ask for a new buffer | |
1885 name, rather than giving an automatic name." | |
1886 (interactive "Pbuffer name: ") | |
1887 (save-excursion | |
1888 (save-restriction | |
1889 (goto-char (point-min)) | |
1890 (narrow-to-region (point) | |
1891 (search-forward mail-header-separator nil 'end)) | |
1892 (let* ((mail-to (or | |
1893 (if (message-news-p) (message-fetch-field "Newsgroups") | |
1894 (message-fetch-field "To")) | |
1895 "")) | |
1896 (mail-trimmed-to | |
1897 (if (string-match "," mail-to) | |
1898 (concat (substring mail-to 0 (match-beginning 0)) ", ...") | |
1899 mail-to)) | |
1900 (name-default (concat "*message* " mail-trimmed-to)) | |
1901 (name (if enter-string | |
1902 (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
|
1903 name-default))) |
17493 | 1904 (rename-buffer name t))))) |
1905 | |
1906 (defun message-fill-yanked-message (&optional justifyp) | |
1907 "Fill the paragraphs of a message yanked into this one. | |
1908 Numeric argument means justify as well." | |
1909 (interactive "P") | |
1910 (save-excursion | |
1911 (goto-char (point-min)) | |
1912 (search-forward (concat "\n" mail-header-separator "\n") nil t) | |
1913 (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
|
1914 (fill-individual-paragraphs (point) (point-max) justifyp)))) |
17493 | 1915 |
1916 (defun message-indent-citation () | |
1917 "Modify text just inserted from a message to be cited. | |
1918 The inserted text should be the region. | |
1919 When this function returns, the region is again around the modified text. | |
1920 | |
1921 Normally, indent each nonblank line `message-indentation-spaces' spaces. | |
1922 However, if `message-yank-prefix' is non-nil, insert that prefix on each line." | |
1923 (let ((start (point))) | |
1924 ;; Remove unwanted headers. | |
1925 (when message-ignored-cited-headers | |
1926 (let (all-removed) | |
1927 (save-restriction | |
1928 (narrow-to-region | |
1929 (goto-char start) | |
1930 (if (search-forward "\n\n" nil t) | |
1931 (1- (point)) | |
1932 (point))) | |
1933 (message-remove-header message-ignored-cited-headers t) | |
1934 (when (= (point-min) (point-max)) | |
1935 (setq all-removed t)) | |
1936 (goto-char (point-max))) | |
1937 (if all-removed | |
1938 (goto-char start) | |
1939 (forward-line 1)))) | |
1940 ;; Delete blank lines at the start of the buffer. | |
1941 (while (and (point-min) | |
1942 (eolp) | |
1943 (not (eobp))) | |
1944 (message-delete-line)) | |
1945 ;; Delete blank lines at the end of the buffer. | |
1946 (goto-char (point-max)) | |
1947 (unless (eolp) | |
1948 (insert "\n")) | |
1949 (while (and (zerop (forward-line -1)) | |
1950 (looking-at "$")) | |
1951 (message-delete-line)) | |
1952 ;; Do the indentation. | |
1953 (if (null message-yank-prefix) | |
1954 (indent-rigidly start (mark t) message-indentation-spaces) | |
1955 (save-excursion | |
1956 (goto-char start) | |
1957 (while (< (point) (mark t)) | |
1958 (insert message-yank-prefix) | |
1959 (forward-line 1)))) | |
1960 (goto-char start))) | |
1961 | |
1962 (defun message-yank-original (&optional arg) | |
1963 "Insert the message being replied to, if any. | |
1964 Puts point before the text and mark after. | |
1965 Normally indents each nonblank line ARG spaces (default 3). However, | |
1966 if `message-yank-prefix' is non-nil, insert that prefix on each line. | |
1967 | |
1968 This function uses `message-cite-function' to do the actual citing. | |
1969 | |
1970 Just \\[universal-argument] as argument means don't indent, insert no | |
1971 prefix, and don't delete any headers." | |
1972 (interactive "P") | |
1973 (let ((modified (buffer-modified-p))) | |
1974 (when (and message-reply-buffer | |
1975 message-cite-function) | |
1976 (delete-windows-on message-reply-buffer t) | |
1977 (insert-buffer message-reply-buffer) | |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
1978 (unless arg |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
1979 (funcall message-cite-function)) |
17493 | 1980 (message-exchange-point-and-mark) |
1981 (unless (bolp) | |
1982 (insert ?\n)) | |
1983 (unless modified | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1984 (setq message-checksum (message-checksum)))))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
1985 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1986 (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
|
1987 "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
|
1988 (interactive "bYank buffer: ") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1989 (let ((message-reply-buffer buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1990 (save-window-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1991 (message-yank-original)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1992 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1993 (defun message-buffers () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1994 "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
|
1995 (let (buffers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1996 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1997 (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
|
1998 (set-buffer buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
1999 (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
|
2000 (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
|
2001 (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
|
2002 (nreverse buffers))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2003 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2004 (defun message-cite-original-without-signature () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2005 "Cite function in the standard Message manner." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2006 (let ((start (point)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2007 (end (mark t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2008 (functions |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2009 (when message-indent-citation-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2010 (if (listp message-indent-citation-function) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2011 message-indent-citation-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2012 (list message-indent-citation-function))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2013 (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
|
2014 ;; Allow undoing. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2015 (undo-boundary) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2016 (goto-char end) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2017 (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
|
2018 ;; 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
|
2019 (forward-line -1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2020 (while (looking-at "^[ \t]*$") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2021 (forward-line -1)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2022 (forward-line 1) |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2023 (delete-region (point) end) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2024 (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
|
2025 ;; 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
|
2026 (insert "\n"))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2027 (goto-char start) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2028 (while functions |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2029 (funcall (pop functions))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2030 (when message-citation-line-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2031 (unless (bolp) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2032 (insert "\n")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2033 (funcall message-citation-line-function)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2034 |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
2035 (eval-when-compile (defvar mail-citation-hook)) ;Compiler directive |
17493 | 2036 (defun message-cite-original () |
2037 "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
|
2038 (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
|
2039 mail-citation-hook) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
2040 (run-hooks 'mail-citation-hook) |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
2041 (let ((start (point)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2042 (end (mark t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2043 (functions |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2044 (when message-indent-citation-function |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2045 (if (listp message-indent-citation-function) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2046 message-indent-citation-function |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2047 (list message-indent-citation-function))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2048 (mml-quote-region start end) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
2049 (goto-char start) |
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
2050 (while functions |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2051 (funcall (pop functions))) |
22656
e3dc0aa099e5
(message-cite-original): If mail-citation-hook
Richard M. Stallman <rms@gnu.org>
parents:
22378
diff
changeset
|
2052 (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
|
2053 (unless (bolp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2054 (insert "\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2055 (funcall message-citation-line-function))))) |
17493 | 2056 |
2057 (defun message-insert-citation-line () | |
35147 | 2058 "Insert a simple citation line." |
17493 | 2059 (when message-reply-headers |
2060 (insert (mail-header-from message-reply-headers) " writes:\n\n"))) | |
2061 | |
2062 (defun message-position-on-field (header &rest afters) | |
2063 (let ((case-fold-search t)) | |
2064 (save-restriction | |
2065 (narrow-to-region | |
2066 (goto-char (point-min)) | |
2067 (progn | |
2068 (re-search-forward | |
2069 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2070 (match-beginning 0))) | |
2071 (goto-char (point-min)) | |
2072 (if (re-search-forward (concat "^" (regexp-quote header) ":") nil t) | |
2073 (progn | |
2074 (re-search-forward "^[^ \t]" nil 'move) | |
2075 (beginning-of-line) | |
2076 (skip-chars-backward "\n") | |
2077 t) | |
2078 (while (and afters | |
2079 (not (re-search-forward | |
2080 (concat "^" (regexp-quote (car afters)) ":") | |
2081 nil t))) | |
2082 (pop afters)) | |
2083 (when afters | |
2084 (re-search-forward "^[^ \t]" nil 'move) | |
2085 (beginning-of-line)) | |
2086 (insert header ": \n") | |
2087 (forward-char -1) | |
2088 nil)))) | |
2089 | |
2090 (defun message-remove-signature () | |
2091 "Remove the signature from the text between point and mark. | |
2092 The text will also be indented the normal way." | |
2093 (save-excursion | |
2094 (let ((start (point)) | |
2095 mark) | |
2096 (if (not (re-search-forward message-signature-separator (mark t) t)) | |
2097 ;; No signature here, so we just indent the cited text. | |
2098 (message-indent-citation) | |
2099 ;; Find the last non-empty line. | |
2100 (forward-line -1) | |
2101 (while (looking-at "[ \t]*$") | |
2102 (forward-line -1)) | |
2103 (forward-line 1) | |
2104 (setq mark (set-marker (make-marker) (point))) | |
2105 (goto-char start) | |
2106 (message-indent-citation) | |
2107 ;; Enable undoing the deletion. | |
2108 (undo-boundary) | |
2109 (delete-region mark (mark t)) | |
2110 (set-marker mark nil))))) | |
2111 | |
2112 | |
2113 | |
2114 ;;; | |
2115 ;;; Sending messages | |
2116 ;;; | |
2117 | |
2118 (defun message-send-and-exit (&optional arg) | |
2119 "Send message like `message-send', then, if no errors, exit from mail buffer." | |
2120 (interactive "P") | |
2121 (let ((buf (current-buffer)) | |
2122 (actions message-exit-actions)) | |
2123 (when (and (message-send arg) | |
2124 (buffer-name buf)) | |
2125 (if message-kill-buffer-on-exit | |
2126 (kill-buffer buf) | |
2127 (bury-buffer buf) | |
2128 (when (eq buf (current-buffer)) | |
2129 (message-bury buf))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2130 (message-do-actions actions) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2131 t))) |
17493 | 2132 |
2133 (defun message-dont-send () | |
2134 "Don't send the message you have been editing." | |
2135 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2136 (set-buffer-modified-p t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2137 (save-buffer) |
17493 | 2138 (let ((actions message-postpone-actions)) |
2139 (message-bury (current-buffer)) | |
2140 (message-do-actions actions))) | |
2141 | |
2142 (defun message-kill-buffer () | |
2143 "Kill the current buffer." | |
2144 (interactive) | |
2145 (when (or (not (buffer-modified-p)) | |
2146 (yes-or-no-p "Message modified; kill anyway? ")) | |
2147 (let ((actions message-kill-actions)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2148 (setq buffer-file-name nil) |
17493 | 2149 (kill-buffer (current-buffer)) |
2150 (message-do-actions actions)))) | |
2151 | |
2152 (defun message-bury (buffer) | |
35147 | 2153 "Bury this mail BUFFER." |
17493 | 2154 (let ((newbuf (other-buffer buffer))) |
2155 (bury-buffer buffer) | |
2156 (if (and (fboundp 'frame-parameters) | |
2157 (cdr (assq 'dedicated (frame-parameters))) | |
2158 (not (null (delq (selected-frame) (visible-frame-list))))) | |
2159 (delete-frame (selected-frame)) | |
2160 (switch-to-buffer newbuf)))) | |
2161 | |
2162 (defun message-send (&optional arg) | |
2163 "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
|
2164 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
|
2165 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
|
2166 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
|
2167 the mailer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2168 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
|
2169 It should typically alter the sending method in some way or other." |
17493 | 2170 (interactive "P") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2171 ;; 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
|
2172 (undo-boundary) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2173 (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
|
2174 (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
|
2175 (message-fix-before-sending) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2176 (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
|
2177 (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
|
2178 (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
|
2179 (success t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2180 elem sent) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2181 (while (and success |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2182 (setq elem (pop alist))) |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2183 (when (funcall (cadr elem)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2184 (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
|
2185 message-sent-message-via)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2186 (y-or-n-p |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2187 (format |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2188 "Already sent message via %s; resend? " |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2189 (car elem)))) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2190 (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
|
2191 (setq sent t)))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2192 (unless (or sent (not success)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2193 (error "No methods specified to send by")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2194 (when (and success sent) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2195 (message-do-fcc) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2196 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2197 (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
|
2198 (message "Sending...done") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2199 ;; 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
|
2200 (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
|
2201 (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
|
2202 (message-disassociate-draft) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2203 ;; 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
|
2204 (message-do-send-housekeeping) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2205 (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
|
2206 ;; Return success. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2207 t))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2208 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2209 (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
|
2210 "Send the current message via mail." |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2211 (message-send-mail arg)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2212 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2213 (defun message-send-via-news (arg) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2214 "Send the current message via news." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2215 (funcall message-send-news-function arg)) |
17493 | 2216 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2217 (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
|
2218 "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
|
2219 `(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
|
2220 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2221 ,@forms))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2222 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2223 (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
|
2224 (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
|
2225 |
17493 | 2226 (defun message-fix-before-sending () |
2227 "Do various things to make the message nice before sending it." | |
2228 ;; Make sure there's a newline at the end of the message. | |
2229 (goto-char (point-max)) | |
2230 (unless (bolp) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2231 (insert "\n")) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2232 ;; Delete all invisible text. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2233 (message-check 'invisible-text |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2234 (when (text-property-any (point-min) (point-max) 'invisible t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2235 (put-text-property (point-min) (point-max) 'invisible nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2236 (unless (yes-or-no-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2237 "Invisible text found and made visible; continue posting? ") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2238 (error "Invisible text found and made visible"))))) |
17493 | 2239 |
2240 (defun message-add-action (action &rest types) | |
2241 "Add ACTION to be performed when doing an exit of type TYPES." | |
2242 (let (var) | |
2243 (while types | |
2244 (set (setq var (intern (format "message-%s-actions" (pop types)))) | |
2245 (nconc (symbol-value var) (list action)))))) | |
2246 | |
2247 (defun message-do-actions (actions) | |
2248 "Perform all actions in ACTIONS." | |
2249 ;; Now perform actions on successful sending. | |
2250 (while actions | |
2251 (ignore-errors | |
2252 (cond | |
2253 ;; A simple function. | |
2254 ((message-functionp (car actions)) | |
2255 (funcall (car actions))) | |
2256 ;; Something to be evaled. | |
2257 (t | |
2258 (eval (car actions))))) | |
2259 (pop actions))) | |
2260 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2261 (defun message-send-mail-partially () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2262 "Sendmail as message/partial." |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2263 ;; 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
|
2264 (goto-char (point-min)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2265 (re-search-forward |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2266 (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
|
2267 (replace-match "\n") |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
2268 (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
|
2269 (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
|
2270 (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
|
2271 (curbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2272 (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
|
2273 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
|
2274 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2275 (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
|
2276 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2277 (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
|
2278 (beginning-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2279 (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
|
2280 (push p plist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2281 (setq p (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2282 (setq total (length plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2283 (push (point-max) plist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2284 (setq plist (nreverse plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2285 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2286 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2287 (setq p (pop plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2288 (while plist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2289 (set-buffer curbuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2290 (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
|
2291 (set-buffer tembuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2292 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2293 (if header |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2294 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2295 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2296 (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
|
2297 (insert header)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2298 (message-goto-eoh) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2299 (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
|
2300 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2301 (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
|
2302 (insert header) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2303 (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
|
2304 (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
|
2305 (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
|
2306 (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
|
2307 (message-remove-header "Lines") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2308 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2309 (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
|
2310 (setq header (buffer-substring (point-min) (point-max)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2311 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2312 (insert (format "Content-Type: message/partial; id=\"%s\"; number=%d; total=%d\n" |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2313 id n total)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2314 (let ((mail-header-separator "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2315 (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
|
2316 (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
|
2317 (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
|
2318 (let ((mail-header-separator "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2319 (insert "Lines: " (message-make-lines) "\n"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2320 (message-goto-subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2321 (end-of-line) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2322 (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
|
2323 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2324 (insert "\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2325 (widen) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2326 (mm-with-unibyte-current-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2327 (funcall message-send-mail-function))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2328 (setq n (+ n 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2329 (setq p (pop plist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2330 (erase-buffer))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2331 (kill-buffer tembuf)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2332 |
17493 | 2333 (defun message-send-mail (&optional arg) |
2334 (require 'mail-utils) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2335 (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
|
2336 (case-fold-search nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2337 (news (message-news-p)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2338 (mailbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2339 (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
|
2340 (message-posting-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2341 (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
|
2342 (gnus-setup-posting-charset nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2343 message-posting-charset))) |
17493 | 2344 (save-restriction |
2345 (message-narrow-to-headers) | |
2346 ;; Insert some headers. | |
2347 (let ((message-deletable-headers | |
2348 (if news nil message-deletable-headers))) | |
2349 (message-generate-headers message-required-mail-headers)) | |
2350 ;; Let the user do all of the above. | |
2351 (run-hooks 'message-header-hook)) | |
2352 (unwind-protect | |
2353 (save-excursion | |
2354 (set-buffer tembuf) | |
2355 (erase-buffer) | |
2356 ;; Avoid copying text props. | |
33748
2827e4066e08
* message.el (message-send-mail): Use buffer-substring-no-properties.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33436
diff
changeset
|
2357 (insert (with-current-buffer mailbuf |
2827e4066e08
* message.el (message-send-mail): Use buffer-substring-no-properties.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33436
diff
changeset
|
2358 (buffer-substring-no-properties (point-min) (point-max)))) |
17493 | 2359 ;; Remove some headers. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2360 (message-encode-message-body) |
17493 | 2361 (save-restriction |
2362 (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
|
2363 ;; 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
|
2364 (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
|
2365 (message-generate-headers '(Lines))) |
17493 | 2366 ;; Remove some headers. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2367 (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
|
2368 (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
|
2369 (mail-encode-encoded-word-buffer))) |
17493 | 2370 (goto-char (point-max)) |
2371 ;; require one newline at the end. | |
2372 (or (= (preceding-char) ?\n) | |
2373 (insert ?\n)) | |
35147 | 2374 (when |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2375 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2376 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2377 (and news |
17493 | 2378 (or (message-fetch-field "cc") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2379 (message-fetch-field "to")) |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2380 (let ((content-type (message-fetch-field "content-type"))) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2381 (or |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2382 (not content-type) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2383 (string= "text/plain" |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2384 (car |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2385 (mail-header-parse-content-type |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
2386 content-type))))))) |
17493 | 2387 (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
|
2388 (if (or (not message-send-mail-partially-limit) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2389 (< (point-max) message-send-mail-partially-limit) |
35147 | 2390 (not (y-or-n-p "The message size is too large, should it be sent partially? "))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2391 (mm-with-unibyte-current-buffer |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2392 (funcall message-send-mail-function)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2393 (message-send-mail-partially))) |
17493 | 2394 (kill-buffer tembuf)) |
2395 (set-buffer mailbuf) | |
2396 (push 'mail message-sent-message-via))) | |
2397 | |
2398 (defun message-send-mail-with-sendmail () | |
2399 "Send off the prepared buffer with sendmail." | |
2400 (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
|
2401 (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
|
2402 " sendmail errors") |
17493 | 2403 0)) |
2404 resend-to-addresses delimline) | |
2405 (let ((case-fold-search t)) | |
2406 (save-restriction | |
2407 (message-narrow-to-headers) | |
2408 (setq resend-to-addresses (message-fetch-field "resent-to"))) | |
2409 ;; Change header-delimiter to be what sendmail expects. | |
2410 (goto-char (point-min)) | |
2411 (re-search-forward | |
2412 (concat "^" (regexp-quote mail-header-separator) "\n")) | |
2413 (replace-match "\n") | |
2414 (backward-char 1) | |
2415 (setq delimline (point-marker)) | |
2416 (run-hooks 'message-send-mail-hook) | |
2417 ;; Insert an extra newline if we need it to work around | |
2418 ;; Sun's bug that swallows newlines. | |
2419 (goto-char (1+ delimline)) | |
2420 (when (eval message-mailer-swallows-blank-line) | |
2421 (newline)) | |
2422 (when message-interactive | |
2423 (save-excursion | |
2424 (set-buffer errbuf) | |
2425 (erase-buffer)))) | |
23096
e4419c63d4d7
(message-send-mail-with-sendmail): Bind
Kenichi Handa <handa@m17n.org>
parents:
22952
diff
changeset
|
2426 (let ((default-directory "/") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2427 (coding-system-for-write message-send-coding-system)) |
17493 | 2428 (apply 'call-process-region |
2429 (append (list (point-min) (point-max) | |
2430 (if (boundp 'sendmail-program) | |
2431 sendmail-program | |
2432 "/usr/lib/sendmail") | |
2433 nil errbuf nil "-oi") | |
2434 ;; Always specify who from, | |
2435 ;; since some systems have broken sendmails. | |
2436 ;; But some systems are more broken with -f, so | |
2437 ;; we'll let users override this. | |
2438 (if (null message-sendmail-f-is-evil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2439 (list "-f" (message-make-address))) |
17493 | 2440 ;; These mean "report errors by mail" |
2441 ;; and "deliver in background". | |
2442 (if (null message-interactive) '("-oem" "-odb")) | |
2443 ;; Get the addresses from the message | |
2444 ;; unless this is a resend. | |
2445 ;; We must not do that for a resend | |
2446 ;; because we would find the original addresses. | |
2447 ;; For a resend, include the specific addresses. | |
2448 (if resend-to-addresses | |
2449 (list resend-to-addresses) | |
2450 '("-t"))))) | |
2451 (when message-interactive | |
2452 (save-excursion | |
2453 (set-buffer errbuf) | |
2454 (goto-char (point-min)) | |
2455 (while (re-search-forward "\n\n* *" nil t) | |
2456 (replace-match "; ")) | |
2457 (if (not (zerop (buffer-size))) | |
2458 (error "Sending...failed to %s" | |
2459 (buffer-substring (point-min) (point-max))))) | |
2460 (when (bufferp errbuf) | |
2461 (kill-buffer errbuf))))) | |
2462 | |
2463 (defun message-send-mail-with-qmail () | |
2464 "Pass the prepared message buffer to qmail-inject. | |
2465 Refer to the documentation for the variable `message-send-mail-function' | |
2466 to find out how to use this." | |
2467 ;; replace the header delimiter with a blank line | |
2468 (goto-char (point-min)) | |
2469 (re-search-forward | |
2470 (concat "^" (regexp-quote mail-header-separator) "\n")) | |
2471 (replace-match "\n") | |
2472 (run-hooks 'message-send-mail-hook) | |
2473 ;; send the message | |
2474 (case | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2475 (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
|
2476 (apply |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2477 'call-process-region 1 (point-max) message-qmail-inject-program |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2478 nil nil nil |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2479 ;; 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
|
2480 ;; 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
|
2481 ;; 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
|
2482 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2483 ;; 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
|
2484 ;; 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
|
2485 ;; message from stdin. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2486 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2487 ;; 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
|
2488 ;; 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
|
2489 ;; 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
|
2490 ;; for sendmail's lost innocence. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2491 ;; |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2492 ;; 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
|
2493 ;; 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
|
2494 ;; 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
|
2495 ;; gets full control (no gestapo'ish -f's, for instance). --sj |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2496 message-qmail-inject-args)) |
17493 | 2497 ;; qmail-inject doesn't say anything on it's stdout/stderr, |
2498 ;; we have to look at the retval instead | |
2499 (0 nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2500 (1 (error "qmail-inject reported permanent failure")) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2501 (111 (error "qmail-inject reported transient failure")) |
17493 | 2502 ;; should never happen |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2503 (t (error "qmail-inject reported unknown failure")))) |
17493 | 2504 |
2505 (defun message-send-mail-with-mh () | |
2506 "Send the prepared message buffer with mh." | |
2507 (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
|
2508 (name (mh-new-draft-name))) |
17493 | 2509 (setq buffer-file-name name) |
2510 ;; MH wants to generate these headers itself. | |
2511 (when message-mh-deletable-headers | |
2512 (let ((headers message-mh-deletable-headers)) | |
2513 (while headers | |
2514 (goto-char (point-min)) | |
2515 (and (re-search-forward | |
2516 (concat "^" (symbol-name (car headers)) ": *") nil t) | |
2517 (message-delete-line)) | |
2518 (pop headers)))) | |
2519 (run-hooks 'message-send-mail-hook) | |
2520 ;; Pass it on to mh. | |
2521 (mh-send-letter))) | |
2522 | |
2523 (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
|
2524 (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
|
2525 (case-fold-search nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2526 (method (if (message-functionp message-post-method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2527 (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
|
2528 message-post-method)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2529 (group-name-charset (gnus-group-name-charset method "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2530 (rfc2047-header-encoding-alist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2531 (if group-name-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2532 (cons (cons "Newsgroups" group-name-charset) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2533 rfc2047-header-encoding-alist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2534 rfc2047-header-encoding-alist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2535 (messbuf (current-buffer)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2536 (message-syntax-checks |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2537 (if arg |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2538 (cons '(existing-newsgroups . disabled) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2539 message-syntax-checks) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2540 message-syntax-checks)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2541 (message-this-is-news t) |
35147 | 2542 (message-posting-charset (gnus-setup-posting-charset |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2543 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2544 (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
|
2545 (message-fetch-field "Newsgroups")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2546 result) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2547 (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
|
2548 nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2549 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2550 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2551 ;; Insert some headers. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2552 (message-generate-headers message-required-news-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2553 ;; 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
|
2554 (run-hooks 'message-header-hook)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2555 (if group-name-charset |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2556 (setq message-syntax-checks |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2557 (cons '(valid-newsgroups . disabled) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2558 message-syntax-checks))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2559 (message-cleanup-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2560 (if (not (message-check-news-syntax)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2561 nil |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2562 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2563 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2564 (set-buffer tembuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2565 (buffer-disable-undo) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2566 (erase-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2567 ;; Avoid copying text props. |
33768
8d6dc71efabb
(message-send-news): Use buffer-substring-no-properties.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33748
diff
changeset
|
2568 (insert (with-current-buffer messbuf |
35147 | 2569 (buffer-substring-no-properties |
33768
8d6dc71efabb
(message-send-news): Use buffer-substring-no-properties.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33748
diff
changeset
|
2570 (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
|
2571 (message-encode-message-body) |
17493 | 2572 ;; Remove some headers. |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2573 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2574 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2575 ;; 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
|
2576 (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
|
2577 (message-generate-headers '(Lines))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2578 ;; Remove some headers. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2579 (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
|
2580 (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
|
2581 (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
|
2582 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2583 ;; 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
|
2584 (or (= (preceding-char) ?\n) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2585 (insert ?\n)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2586 (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
|
2587 ;; Remove the delimiter. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2588 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2589 (re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2590 (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
|
2591 (replace-match "\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2592 (backward-char 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2593 (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
|
2594 (gnus-open-server method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2595 (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
|
2596 (gnus-request-post method)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2597 (kill-buffer tembuf)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2598 (set-buffer messbuf) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2599 (if result |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2600 (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
|
2601 (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
|
2602 (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
|
2603 nil))))) |
17493 | 2604 |
2605 ;;; | |
2606 ;;; Header generation & syntax checking. | |
2607 ;;; | |
2608 | |
2609 (defun message-check-element (type) | |
35147 | 2610 "Return non-nil if this TYPE is not to be checked." |
17493 | 2611 (if (eq message-syntax-checks 'dont-check-for-anything-just-trust-me) |
2612 t | |
2613 (let ((able (assq type message-syntax-checks))) | |
2614 (and (consp able) | |
2615 (eq (cdr able) 'disabled))))) | |
2616 | |
2617 (defun message-check-news-syntax () | |
2618 "Check the syntax of the message." | |
2619 (save-excursion | |
2620 (save-restriction | |
2621 (widen) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2622 ;; 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
|
2623 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2624 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2625 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2626 (message-check-news-header-syntax)))))) |
17493 | 2627 |
2628 (defun message-check-news-header-syntax () | |
2629 (and | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2630 ;; Check Newsgroups header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2631 (message-check 'newsgroups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2632 (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
|
2633 (or |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2634 (and group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2635 (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
|
2636 (ignore |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2637 (message |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2638 "The newsgroups field is empty or missing. Posting is denied."))))) |
17493 | 2639 ;; Check the Subject header. |
2640 (message-check 'subject | |
2641 (let* ((case-fold-search t) | |
2642 (subject (message-fetch-field "subject"))) | |
2643 (or | |
2644 (and subject | |
2645 (not (string-match "\\`[ \t]*\\'" subject))) | |
2646 (ignore | |
2647 (message | |
2648 "The subject field is empty or missing. Posting is denied."))))) | |
2649 ;; Check for commands in Subject. | |
2650 (message-check 'subject-cmsg | |
2651 (if (string-match "^cmsg " (message-fetch-field "subject")) | |
2652 (y-or-n-p | |
2653 "The control code \"cmsg\" is in the subject. Really post? ") | |
2654 t)) | |
2655 ;; Check for multiple identical headers. | |
2656 (message-check 'multiple-headers | |
2657 (let (found) | |
2658 (while (and (not found) | |
2659 (re-search-forward "^[^ \t:]+: " nil t)) | |
2660 (save-excursion | |
2661 (or (re-search-forward | |
2662 (concat "^" | |
2663 (regexp-quote | |
2664 (setq found | |
2665 (buffer-substring | |
2666 (match-beginning 0) (- (match-end 0) 2)))) | |
2667 ":") | |
2668 nil t) | |
2669 (setq found nil)))) | |
2670 (if found | |
2671 (y-or-n-p (format "Multiple %s headers. Really post? " found)) | |
2672 t))) | |
2673 ;; Check for Version and Sendsys. | |
2674 (message-check 'sendsys | |
2675 (if (re-search-forward "^Sendsys:\\|^Version:" nil t) | |
2676 (y-or-n-p | |
2677 (format "The article contains a %s command. Really post? " | |
2678 (buffer-substring (match-beginning 0) | |
2679 (1- (match-end 0))))) | |
2680 t)) | |
2681 ;; See whether we can shorten Followup-To. | |
2682 (message-check 'shorten-followup-to | |
2683 (let ((newsgroups (message-fetch-field "newsgroups")) | |
2684 (followup-to (message-fetch-field "followup-to")) | |
2685 to) | |
2686 (when (and newsgroups | |
2687 (string-match "," newsgroups) | |
2688 (not followup-to) | |
2689 (not | |
2690 (zerop | |
2691 (length | |
2692 (setq to (completing-read | |
2693 "Followups to: (default all groups) " | |
2694 (mapcar (lambda (g) (list g)) | |
2695 (cons "poster" | |
2696 (message-tokenize-header | |
2697 newsgroups))))))))) | |
2698 (goto-char (point-min)) | |
2699 (insert "Followup-To: " to "\n")) | |
2700 t)) | |
2701 ;; Check "Shoot me". | |
2702 (message-check 'shoot | |
2703 (if (re-search-forward | |
2704 "Message-ID.*.i-did-not-set--mail-host-address--so-shoot-me" nil t) | |
2705 (y-or-n-p "You appear to have a misconfigured system. Really post? ") | |
2706 t)) | |
2707 ;; Check for Approved. | |
2708 (message-check 'approved | |
2709 (if (re-search-forward "^Approved:" nil t) | |
2710 (y-or-n-p "The article contains an Approved header. Really post? ") | |
2711 t)) | |
2712 ;; Check the Message-ID header. | |
2713 (message-check 'message-id | |
2714 (let* ((case-fold-search t) | |
2715 (message-id (message-fetch-field "message-id" t))) | |
2716 (or (not message-id) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2717 ;; Is there an @ in the ID? |
17493 | 2718 (and (string-match "@" message-id) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2719 ;; 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
|
2720 (string-match "@[^.]*\\." message-id) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2721 ;; 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
|
2722 (not (string-match "\\.>" message-id))) |
17493 | 2723 (y-or-n-p |
2724 (format "The Message-ID looks strange: \"%s\". Really post? " | |
2725 message-id))))) | |
2726 ;; Check the Newsgroups & Followup-To headers. | |
2727 (message-check 'existing-newsgroups | |
2728 (let* ((case-fold-search t) | |
2729 (newsgroups (message-fetch-field "newsgroups")) | |
2730 (followup-to (message-fetch-field "followup-to")) | |
2731 (groups (message-tokenize-header | |
2732 (if followup-to | |
2733 (concat newsgroups "," followup-to) | |
2734 newsgroups))) | |
2735 (hashtb (and (boundp 'gnus-active-hashtb) | |
2736 gnus-active-hashtb)) | |
2737 errors) | |
2738 (if (or (not hashtb) | |
2739 (not (boundp 'gnus-read-active-file)) | |
2740 (not gnus-read-active-file) | |
2741 (eq gnus-read-active-file 'some)) | |
2742 t | |
2743 (while groups | |
2744 (when (and (not (boundp (intern (car groups) hashtb))) | |
2745 (not (equal (car groups) "poster"))) | |
2746 (push (car groups) errors)) | |
2747 (pop groups)) | |
2748 (if (not errors) | |
2749 t | |
2750 (y-or-n-p | |
2751 (format | |
35147 | 2752 "Really post to %s unknown group%s: %s? " |
17493 | 2753 (if (= (length errors) 1) "this" "these") |
2754 (if (= (length errors) 1) "" "s") | |
2755 (mapconcat 'identity errors ", "))))))) | |
2756 ;; Check the Newsgroups & Followup-To headers for syntax errors. | |
2757 (message-check 'valid-newsgroups | |
2758 (let ((case-fold-search t) | |
2759 (headers '("Newsgroups" "Followup-To")) | |
2760 header error) | |
2761 (while (and headers (not error)) | |
2762 (when (setq header (mail-fetch-field (car headers))) | |
2763 (if (or | |
2764 (not | |
2765 (string-match | |
2766 "\\`\\([-+_&.a-zA-Z0-9]+\\)?\\(,[-+_&.a-zA-Z0-9]+\\)*\\'" | |
2767 header)) | |
2768 (memq | |
2769 nil (mapcar | |
2770 (lambda (g) | |
2771 (not (string-match "\\.\\'\\|\\.\\." g))) | |
2772 (message-tokenize-header header ",")))) | |
2773 (setq error t))) | |
2774 (unless error | |
2775 (pop headers))) | |
2776 (if (not error) | |
2777 t | |
2778 (y-or-n-p | |
2779 (format "The %s header looks odd: \"%s\". Really post? " | |
2780 (car headers) header))))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2781 (message-check 'repeated-newsgroups |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2782 (let ((case-fold-search t) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2783 (headers '("Newsgroups" "Followup-To")) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2784 header error groups group) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2785 (while (and headers |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2786 (not error)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2787 (when (setq header (mail-fetch-field (pop headers))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2788 (setq groups (message-tokenize-header header ",")) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2789 (while (setq group (pop groups)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2790 (when (member group groups) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2791 (setq error group |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2792 groups nil))))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2793 (if (not error) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2794 t |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2795 (y-or-n-p |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2796 (format "Group %s is repeated in headers. Really post? " error))))) |
17493 | 2797 ;; Check the From header. |
2798 (message-check 'from | |
2799 (let* ((case-fold-search t) | |
2800 (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
|
2801 ad) |
17493 | 2802 (cond |
2803 ((not from) | |
2804 (message "There is no From line. Posting is denied.") | |
2805 nil) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2806 ((or (not (string-match |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2807 "@[^\\.]*\\." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2808 (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
|
2809 from))))) ;larsi@ifi |
17493 | 2810 (string-match "\\.\\." ad) ;larsi@ifi..uio |
2811 (string-match "@\\." ad) ;larsi@.ifi.uio | |
2812 (string-match "\\.$" ad) ;larsi@ifi.uio. | |
2813 (not (string-match "^[^@]+@[^@]+$" ad)) ;larsi.ifi.uio | |
2814 (string-match "(.*).*(.*)" from)) ;(lars) (lars) | |
2815 (message | |
2816 "Denied posting -- the From looks strange: \"%s\"." from) | |
2817 nil) | |
2818 (t t)))))) | |
2819 | |
2820 (defun message-check-news-body-syntax () | |
2821 (and | |
2822 ;; Check for long lines. | |
2823 (message-check 'long-lines | |
2824 (goto-char (point-min)) | |
2825 (re-search-forward | |
2826 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2827 (while (and | |
2828 (progn | |
2829 (end-of-line) | |
2830 (< (current-column) 80)) | |
2831 (zerop (forward-line 1)))) | |
2832 (or (bolp) | |
2833 (eobp) | |
2834 (y-or-n-p | |
2835 "You have lines longer than 79 characters. Really post? "))) | |
2836 ;; Check whether the article is empty. | |
2837 (message-check 'empty | |
2838 (goto-char (point-min)) | |
2839 (re-search-forward | |
2840 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2841 (forward-line 1) | |
2842 (let ((b (point))) | |
2843 (goto-char (point-max)) | |
2844 (re-search-backward message-signature-separator nil t) | |
2845 (beginning-of-line) | |
2846 (or (re-search-backward "[^ \n\t]" b t) | |
2847 (y-or-n-p "Empty article. Really post? ")))) | |
2848 ;; Check for control characters. | |
2849 (message-check 'control-chars | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2850 (if (re-search-forward "[\000-\007\013\015-\032\034-\037\200-\237]" nil t) |
17493 | 2851 (y-or-n-p |
2852 "The article contains control characters. Really post? ") | |
2853 t)) | |
2854 ;; Check excessive size. | |
2855 (message-check 'size | |
2856 (if (> (buffer-size) 60000) | |
2857 (y-or-n-p | |
2858 (format "The article is %d octets long. Really post? " | |
2859 (buffer-size))) | |
2860 t)) | |
2861 ;; Check whether any new text has been added. | |
2862 (message-check 'new-text | |
2863 (or | |
2864 (not message-checksum) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2865 (not (eq (message-checksum) message-checksum)) |
17493 | 2866 (y-or-n-p |
2867 "It looks like no new text has been added. Really post? "))) | |
2868 ;; Check the length of the signature. | |
2869 (message-check 'signature | |
2870 (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
|
2871 (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
|
2872 (y-or-n-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2873 (format |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2874 "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
|
2875 (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
|
2876 t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2877 ;; 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
|
2878 (message-check 'quoting-style |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2879 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2880 (let ((no-problem t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2881 (when (search-backward-regexp "^>[^\n]*\n>" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2882 (setq no-problem nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2883 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2884 (when (and (not (eolp)) (looking-at "[^> \t]")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2885 (setq no-problem t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2886 (forward-line))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2887 (if no-problem |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2888 t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2889 (y-or-n-p "Your text should follow quoted text. Really post? ")))))) |
17493 | 2890 |
2891 (defun message-checksum () | |
2892 "Return a \"checksum\" for the current buffer." | |
2893 (let ((sum 0)) | |
2894 (save-excursion | |
2895 (goto-char (point-min)) | |
2896 (re-search-forward | |
2897 (concat "^" (regexp-quote mail-header-separator) "$")) | |
2898 (while (not (eobp)) | |
2899 (when (not (looking-at "[ \t\n]")) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
2900 (setq sum (logxor (ash sum 1) (if (natnump sum) 0 1) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2901 (char-after)))) |
17493 | 2902 (forward-char 1))) |
2903 sum)) | |
2904 | |
2905 (defun message-do-fcc () | |
2906 "Process Fcc headers in the current buffer." | |
2907 (let ((case-fold-search t) | |
2908 (buf (current-buffer)) | |
2909 list file) | |
2910 (save-excursion | |
2911 (set-buffer (get-buffer-create " *message temp*")) | |
2912 (erase-buffer) | |
2913 (insert-buffer-substring buf) | |
2914 (save-restriction | |
2915 (message-narrow-to-headers) | |
2916 (while (setq file (message-fetch-field "fcc")) | |
2917 (push file list) | |
2918 (message-remove-header "fcc" nil t))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2919 (message-encode-message-body) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2920 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2921 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2922 (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
|
2923 (rfc2047-header-encoding-alist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2924 (cons '("Newsgroups" . default) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2925 rfc2047-header-encoding-alist))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2926 (mail-encode-encoded-word-buffer))) |
17493 | 2927 (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
|
2928 (when (re-search-forward |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2929 (concat "^" (regexp-quote mail-header-separator) "$") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2930 nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2931 (replace-match "" t t )) |
17493 | 2932 ;; Process FCC operations. |
2933 (while list | |
2934 (setq file (pop list)) | |
2935 (if (string-match "^[ \t]*|[ \t]*\\(.*\\)[ \t]*$" file) | |
2936 ;; Pipe the article to the program in question. | |
2937 (call-process-region (point-min) (point-max) shell-file-name | |
2938 nil nil nil shell-command-switch | |
2939 (match-string 1 file)) | |
2940 ;; Save the article. | |
2941 (setq file (expand-file-name file)) | |
2942 (unless (file-exists-p (file-name-directory file)) | |
2943 (make-directory (file-name-directory file) t)) | |
2944 (if (and message-fcc-handler-function | |
2945 (not (eq message-fcc-handler-function 'rmail-output))) | |
2946 (funcall message-fcc-handler-function file) | |
2947 (if (and (file-readable-p file) (mail-file-babyl-p file)) | |
2948 (rmail-output file 1 nil t) | |
2949 (let ((mail-use-rfc822 t)) | |
2950 (rmail-output file 1 t t)))))) | |
2951 (kill-buffer (current-buffer))))) | |
2952 | |
2953 (defun message-output (filename) | |
35147 | 2954 "Append this article to Unix/babyl mail file FILENAME." |
17493 | 2955 (if (and (file-readable-p filename) |
2956 (mail-file-babyl-p filename)) | |
2957 (gnus-output-to-rmail filename t) | |
2958 (gnus-output-to-mail filename t))) | |
2959 | |
2960 (defun message-cleanup-headers () | |
2961 "Do various automatic cleanups of the headers." | |
2962 ;; Remove empty lines in the header. | |
2963 (save-restriction | |
2964 (message-narrow-to-headers) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2965 ;; Remove blank lines. |
17493 | 2966 (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
|
2967 (replace-match "" t t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2968 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2969 ;; 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
|
2970 ;; 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
|
2971 ;; embedded line breaks. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2972 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2973 (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
|
2974 (save-restriction |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2975 (narrow-to-region |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2976 (point) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2977 (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
|
2978 (match-beginning 0) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2979 (forward-line 1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2980 (point))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2981 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2982 (while (re-search-forward "\n[ \t]+" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2983 (replace-match " " t t)) ;No line breaks (too confusing) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2984 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2985 (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
|
2986 (replace-match "," t t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2987 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2988 ;; Remove trailing commas. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2989 (when (re-search-forward ",+$" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
2990 (replace-match "" t t)))))) |
17493 | 2991 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2992 (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
|
2993 "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
|
2994 If NOW, use that time instead." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2995 (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
|
2996 (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
|
2997 (sign "+")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2998 (when (< zone 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2999 (setq sign "-") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3000 (setq zone (- zone))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3001 (concat |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3002 (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
|
3003 ;; 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
|
3004 (format " %s " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3005 (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
|
3006 parse-time-months)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3007 (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
|
3008 ;; 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
|
3009 (format "%s%02d%02d" sign (/ zone 3600) (/ (% zone 3600) 60))))) |
17493 | 3010 |
3011 (defun message-make-message-id () | |
3012 "Make a unique Message-ID." | |
3013 (concat "<" (message-unique-id) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3014 (let ((psubject (save-excursion (message-fetch-field "subject"))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3015 (psupersedes |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3016 (save-excursion (message-fetch-field "supersedes")))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3017 (if (or |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3018 (and message-reply-headers |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3019 (mail-header-references message-reply-headers) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3020 (mail-header-subject message-reply-headers) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3021 psubject |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3022 (not (string= |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3023 (message-strip-subject-re |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3024 (mail-header-subject message-reply-headers)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3025 (message-strip-subject-re psubject)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3026 (and psupersedes |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3027 (string-match "_-_@" psupersedes))) |
17493 | 3028 "_-_" "")) |
3029 "@" (message-make-fqdn) ">")) | |
3030 | |
3031 (defvar message-unique-id-char nil) | |
3032 | |
3033 ;; If you ever change this function, make sure the new version | |
3034 ;; cannot generate IDs that the old version could. | |
3035 ;; You might for example insert a "." somewhere (not next to another dot | |
3036 ;; or string boundary), or modify the "fsf" string. | |
3037 (defun message-unique-id () | |
3038 ;; Don't use microseconds from (current-time), they may be unsupported. | |
3039 ;; Instead we use this randomly inited counter. | |
3040 (setq message-unique-id-char | |
3041 (% (1+ (or message-unique-id-char (logand (random t) (1- (lsh 1 20))))) | |
3042 ;; (current-time) returns 16-bit ints, | |
3043 ;; and 2^16*25 just fits into 4 digits i base 36. | |
3044 (* 25 25))) | |
3045 (let ((tm (current-time))) | |
3046 (concat | |
3047 (if (memq system-type '(ms-dos emx vax-vms)) | |
3048 (let ((user (downcase (user-login-name)))) | |
3049 (while (string-match "[^a-z0-9_]" user) | |
3050 (aset user (match-beginning 0) ?_)) | |
3051 user) | |
3052 (message-number-base36 (user-uid) -1)) | |
3053 (message-number-base36 (+ (car tm) | |
3054 (lsh (% message-unique-id-char 25) 16)) 4) | |
3055 (message-number-base36 (+ (nth 1 tm) | |
3056 (lsh (/ message-unique-id-char 25) 16)) 4) | |
3057 ;; Append the newsreader name, because while the generated | |
3058 ;; ID is unique to this newsreader, other newsreaders might | |
3059 ;; otherwise generate the same ID via another algorithm. | |
3060 ".fsf"))) | |
3061 | |
3062 (defun message-number-base36 (num len) | |
3063 (if (if (< len 0) | |
3064 (<= num 0) | |
3065 (= len 0)) | |
3066 "" | |
3067 (concat (message-number-base36 (/ num 36) (1- len)) | |
3068 (char-to-string (aref "zyxwvutsrqponmlkjihgfedcba9876543210" | |
3069 (% num 36)))))) | |
3070 | |
3071 (defun message-make-organization () | |
3072 "Make an Organization header." | |
3073 (let* ((organization | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3074 (when message-user-organization |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3075 (if (message-functionp message-user-organization) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3076 (funcall message-user-organization) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3077 message-user-organization)))) |
17493 | 3078 (save-excursion |
3079 (message-set-work-buffer) | |
3080 (cond ((stringp organization) | |
3081 (insert organization)) | |
3082 ((and (eq t organization) | |
3083 message-user-organization-file | |
3084 (file-exists-p message-user-organization-file)) | |
3085 (insert-file-contents message-user-organization-file))) | |
3086 (goto-char (point-min)) | |
3087 (while (re-search-forward "[\t\n]+" nil t) | |
3088 (replace-match "" t t)) | |
3089 (unless (zerop (buffer-size)) | |
3090 (buffer-string))))) | |
3091 | |
3092 (defun message-make-lines () | |
3093 "Count the number of lines and return numeric string." | |
3094 (save-excursion | |
3095 (save-restriction | |
3096 (widen) | |
3097 (goto-char (point-min)) | |
3098 (re-search-forward | |
3099 (concat "^" (regexp-quote mail-header-separator) "$")) | |
3100 (forward-line 1) | |
3101 (int-to-string (count-lines (point) (point-max)))))) | |
3102 | |
3103 (defun message-make-in-reply-to () | |
3104 "Return the In-Reply-To header for this message." | |
3105 (when message-reply-headers | |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3106 (mail-header-message-id message-reply-headers))) |
17493 | 3107 |
3108 (defun message-make-distribution () | |
3109 "Make a Distribution header." | |
3110 (let ((orig-distribution (message-fetch-reply-field "distribution"))) | |
3111 (cond ((message-functionp message-distribution-function) | |
3112 (funcall message-distribution-function)) | |
3113 (t orig-distribution)))) | |
3114 | |
3115 (defun message-make-expires () | |
3116 "Return an Expires header based on `message-expires'." | |
3117 (let ((current (current-time)) | |
3118 (future (* 1.0 message-expires 60 60 24))) | |
3119 ;; Add the future to current. | |
3120 (setcar current (+ (car current) (round (/ future (expt 2 16))))) | |
3121 (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
|
3122 (message-make-date current))) |
17493 | 3123 |
3124 (defun message-make-path () | |
3125 "Return uucp path." | |
3126 (let ((login-name (user-login-name))) | |
3127 (cond ((null message-user-path) | |
3128 (concat (system-name) "!" login-name)) | |
3129 ((stringp message-user-path) | |
3130 ;; Support GENERICPATH. Suggested by vixie@decwrl.dec.com. | |
3131 (concat message-user-path "!" login-name)) | |
3132 (t login-name)))) | |
3133 | |
3134 (defun message-make-from () | |
3135 "Make a From header." | |
3136 (let* ((style message-from-style) | |
3137 (login (message-make-address)) | |
3138 (fullname | |
3139 (or (and (boundp 'user-full-name) | |
3140 user-full-name) | |
3141 (user-full-name)))) | |
3142 (when (string= fullname "&") | |
3143 (setq fullname (user-login-name))) | |
3144 (save-excursion | |
3145 (message-set-work-buffer) | |
3146 (cond | |
3147 ((or (null style) | |
3148 (equal fullname "")) | |
3149 (insert login)) | |
3150 ((or (eq style 'angles) | |
3151 (and (not (eq style 'parens)) | |
3152 ;; Use angles if no quoting is needed, or if parens would | |
3153 ;; need quoting too. | |
3154 (or (not (string-match "[^- !#-'*+/-9=?A-Z^-~]" fullname)) | |
3155 (let ((tmp (concat fullname nil))) | |
3156 (while (string-match "([^()]*)" tmp) | |
3157 (aset tmp (match-beginning 0) ?-) | |
3158 (aset tmp (1- (match-end 0)) ?-)) | |
3159 (string-match "[\\()]" tmp))))) | |
3160 (insert fullname) | |
3161 (goto-char (point-min)) | |
3162 ;; Look for a character that cannot appear unquoted | |
3163 ;; according to RFC 822. | |
3164 (when (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" nil 1) | |
3165 ;; Quote fullname, escaping specials. | |
3166 (goto-char (point-min)) | |
3167 (insert "\"") | |
3168 (while (re-search-forward "[\"\\]" nil 1) | |
3169 (replace-match "\\\\\\&" t)) | |
3170 (insert "\"")) | |
3171 (insert " <" login ">")) | |
3172 (t ; 'parens or default | |
3173 (insert login " (") | |
3174 (let ((fullname-start (point))) | |
3175 (insert fullname) | |
3176 (goto-char fullname-start) | |
3177 ;; RFC 822 says \ and nonmatching parentheses | |
3178 ;; must be escaped in comments. | |
3179 ;; Escape every instance of ()\ ... | |
3180 (while (re-search-forward "[()\\]" nil 1) | |
3181 (replace-match "\\\\\\&" t)) | |
3182 ;; ... then undo escaping of matching parentheses, | |
3183 ;; including matching nested parentheses. | |
3184 (goto-char fullname-start) | |
3185 (while (re-search-forward | |
3186 "\\(\\=\\|[^\\]\\(\\\\\\\\\\)*\\)\\\\(\\(\\([^\\]\\|\\\\\\\\\\)*\\)\\\\)" | |
3187 nil 1) | |
3188 (replace-match "\\1(\\3)" t) | |
3189 (goto-char fullname-start))) | |
3190 (insert ")"))) | |
3191 (buffer-string)))) | |
3192 | |
3193 (defun message-make-sender () | |
3194 "Return the \"real\" user address. | |
3195 This function tries to ignore all user modifications, and | |
3196 give as trustworthy answer as possible." | |
3197 (concat (user-login-name) "@" (system-name))) | |
3198 | |
3199 (defun message-make-address () | |
3200 "Make the address of the user." | |
3201 (or (message-user-mail-address) | |
3202 (concat (user-login-name) "@" (message-make-domain)))) | |
3203 | |
3204 (defun message-user-mail-address () | |
3205 "Return the pertinent part of `user-mail-address'." | |
3206 (when user-mail-address | |
3207 (if (string-match " " user-mail-address) | |
3208 (nth 1 (mail-extract-address-components user-mail-address)) | |
3209 user-mail-address))) | |
3210 | |
3211 (defun message-make-fqdn () | |
3212 "Return user's fully qualified domain name." | |
3213 (let ((system-name (system-name)) | |
3214 (user-mail (message-user-mail-address))) | |
3215 (cond | |
3216 ((string-match "[^.]\\.[^.]" system-name) | |
3217 ;; `system-name' returned the right result. | |
3218 system-name) | |
3219 ;; Try `mail-host-address'. | |
3220 ((and (boundp 'mail-host-address) | |
3221 (stringp mail-host-address) | |
3222 (string-match "\\." mail-host-address)) | |
3223 mail-host-address) | |
3224 ;; We try `user-mail-address' as a backup. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3225 ((and user-mail |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3226 (string-match "\\." user-mail) |
17493 | 3227 (string-match "@\\(.*\\)\\'" user-mail)) |
3228 (match-string 1 user-mail)) | |
3229 ;; Default to this bogus thing. | |
3230 (t | |
3231 (concat system-name ".i-did-not-set--mail-host-address--so-shoot-me"))))) | |
3232 | |
3233 (defun message-make-host-name () | |
3234 "Return the name of the host." | |
3235 (let ((fqdn (message-make-fqdn))) | |
3236 (string-match "^[^.]+\\." fqdn) | |
3237 (substring fqdn 0 (1- (match-end 0))))) | |
3238 | |
3239 (defun message-make-domain () | |
3240 "Return the domain name." | |
3241 (or mail-host-address | |
3242 (message-make-fqdn))) | |
3243 | |
3244 (defun message-generate-headers (headers) | |
3245 "Prepare article HEADERS. | |
3246 Headers already prepared in the buffer are not modified." | |
3247 (save-restriction | |
3248 (message-narrow-to-headers) | |
3249 (let* ((Date (message-make-date)) | |
3250 (Message-ID (message-make-message-id)) | |
3251 (Organization (message-make-organization)) | |
3252 (From (message-make-from)) | |
3253 (Path (message-make-path)) | |
3254 (Subject nil) | |
3255 (Newsgroups nil) | |
3256 (In-Reply-To (message-make-in-reply-to)) | |
3257 (To nil) | |
3258 (Distribution (message-make-distribution)) | |
3259 (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
|
3260 (User-Agent message-newsreader) |
17493 | 3261 (Expires (message-make-expires)) |
3262 (case-fold-search t) | |
3263 header value elem) | |
3264 ;; First we remove any old generated headers. | |
3265 (let ((headers message-deletable-headers)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3266 (unless (buffer-modified-p) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3267 (setq headers (delq 'Message-ID (copy-sequence headers)))) |
17493 | 3268 (while headers |
3269 (goto-char (point-min)) | |
3270 (and (re-search-forward | |
3271 (concat "^" (symbol-name (car headers)) ": *") nil t) | |
3272 (get-text-property (1+ (match-beginning 0)) 'message-deletable) | |
3273 (message-delete-line)) | |
3274 (pop headers))) | |
3275 ;; Go through all the required headers and see if they are in the | |
3276 ;; articles already. If they are not, or are empty, they are | |
3277 ;; inserted automatically - except for Subject, Newsgroups and | |
3278 ;; Distribution. | |
3279 (while headers | |
3280 (goto-char (point-min)) | |
3281 (setq elem (pop headers)) | |
3282 (if (consp elem) | |
3283 (if (eq (car elem) 'optional) | |
3284 (setq header (cdr elem)) | |
3285 (setq header (car elem))) | |
3286 (setq header elem)) | |
3287 (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
|
3288 (concat "^" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3289 (regexp-quote |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3290 (downcase |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3291 (if (stringp header) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3292 header |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3293 (symbol-name header)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3294 ":") |
17493 | 3295 nil t)) |
3296 (progn | |
3297 ;; The header was found. We insert a space after the | |
3298 ;; 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
|
3299 (if (/= (char-after) ? ) (insert " ") (forward-char 1)) |
17493 | 3300 ;; 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
|
3301 (looking-at "[ \t]*\n[^ \t]"))) |
17493 | 3302 ;; So we find out what value we should insert. |
3303 (setq value | |
3304 (cond | |
3305 ((and (consp elem) (eq (car elem) 'optional)) | |
3306 ;; This is an optional header. If the cdr of this | |
3307 ;; is something that is nil, then we do not insert | |
3308 ;; this header. | |
3309 (setq header (cdr elem)) | |
3310 (or (and (fboundp (cdr elem)) (funcall (cdr elem))) | |
3311 (and (boundp (cdr elem)) (symbol-value (cdr elem))))) | |
3312 ((consp elem) | |
3313 ;; The element is a cons. Either the cdr is a | |
3314 ;; string to be inserted verbatim, or it is a | |
3315 ;; function, and we insert the value returned from | |
3316 ;; this function. | |
3317 (or (and (stringp (cdr elem)) (cdr elem)) | |
3318 (and (fboundp (cdr elem)) (funcall (cdr elem))))) | |
3319 ((and (boundp header) (symbol-value header)) | |
3320 ;; The element is a symbol. We insert the value | |
3321 ;; of this symbol, if any. | |
3322 (symbol-value header)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3323 ((not (message-check-element header)) |
17493 | 3324 ;; We couldn't generate a value for this header, |
3325 ;; so we just ask the user. | |
3326 (read-from-minibuffer | |
3327 (format "Empty header for %s; enter value: " header))))) | |
3328 ;; Finally insert the header. | |
3329 (when (and value | |
3330 (not (equal value ""))) | |
3331 (save-excursion | |
3332 (if (bolp) | |
3333 (progn | |
3334 ;; This header didn't exist, so we insert it. | |
3335 (goto-char (point-max)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3336 (insert (if (stringp header) header (symbol-name header)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3337 ": " value "\n") |
17493 | 3338 (forward-line -1)) |
3339 ;; The value of this header was empty, so we clear | |
3340 ;; totally and insert the new value. | |
3341 (delete-region (point) (gnus-point-at-eol)) | |
3342 (insert value)) | |
3343 ;; Add the deletable property to the headers that require it. | |
3344 (and (memq header message-deletable-headers) | |
3345 (progn (beginning-of-line) (looking-at "[^:]+: ")) | |
3346 (add-text-properties | |
3347 (point) (match-end 0) | |
3348 '(message-deletable t face italic) (current-buffer))))))) | |
3349 ;; Insert new Sender if the From is strange. | |
3350 (let ((from (message-fetch-field "from")) | |
3351 (sender (message-fetch-field "sender")) | |
3352 (secure-sender (message-make-sender))) | |
3353 (when (and from | |
3354 (not (message-check-element 'sender)) | |
3355 (not (string= | |
3356 (downcase | |
3357 (cadr (mail-extract-address-components from))) | |
3358 (downcase secure-sender))) | |
3359 (or (null sender) | |
3360 (not | |
3361 (string= | |
3362 (downcase | |
3363 (cadr (mail-extract-address-components sender))) | |
3364 (downcase secure-sender))))) | |
3365 (goto-char (point-min)) | |
3366 ;; Rename any old Sender headers to Original-Sender. | |
3367 (when (re-search-forward "^\\(Original-\\)*Sender:" nil t) | |
3368 (beginning-of-line) | |
3369 (insert "Original-") | |
3370 (beginning-of-line)) | |
3371 (when (or (message-news-p) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3372 (string-match "@.+\\.." secure-sender)) |
17493 | 3373 (insert "Sender: " secure-sender "\n"))))))) |
3374 | |
3375 (defun message-insert-courtesy-copy () | |
3376 "Insert a courtesy message in mail copies of combined messages." | |
3377 (let (newsgroups) | |
3378 (save-excursion | |
3379 (save-restriction | |
3380 (message-narrow-to-headers) | |
3381 (when (setq newsgroups (message-fetch-field "newsgroups")) | |
3382 (goto-char (point-max)) | |
3383 (insert "Posted-To: " newsgroups "\n"))) | |
3384 (forward-line 1) | |
3385 (when message-courtesy-message | |
3386 (cond | |
3387 ((string-match "%s" message-courtesy-message) | |
3388 (insert (format message-courtesy-message newsgroups))) | |
3389 (t | |
3390 (insert message-courtesy-message))))))) | |
3391 | |
3392 ;;; | |
3393 ;;; Setting up a message buffer | |
3394 ;;; | |
3395 | |
3396 (defun message-fill-address (header value) | |
3397 (save-restriction | |
3398 (narrow-to-region (point) (point)) | |
3399 (insert (capitalize (symbol-name header)) | |
3400 ": " | |
3401 (if (consp value) (car value) value) | |
3402 "\n") | |
3403 (narrow-to-region (point-min) (1- (point-max))) | |
3404 (let (quoted last) | |
3405 (goto-char (point-min)) | |
3406 (while (not (eobp)) | |
3407 (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
|
3408 (if (or (eq (char-after) ?,) |
17493 | 3409 (eobp)) |
3410 (when (not quoted) | |
3411 (if (and (> (current-column) 78) | |
3412 last) | |
3413 (progn | |
3414 (save-excursion | |
3415 (goto-char last) | |
3416 (insert "\n\t")) | |
3417 (setq last (1+ (point)))) | |
3418 (setq last (1+ (point))))) | |
3419 (setq quoted (not quoted))) | |
3420 (unless (eobp) | |
3421 (forward-char 1)))) | |
3422 (goto-char (point-max)) | |
3423 (widen) | |
3424 (forward-line 1))) | |
3425 | |
3426 (defun message-fill-header (header value) | |
3427 (let ((begin (point)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3428 (fill-column 78) |
17493 | 3429 (fill-prefix "\t")) |
3430 (insert (capitalize (symbol-name header)) | |
3431 ": " | |
3432 (if (consp value) (car value) value) | |
3433 "\n") | |
3434 (save-restriction | |
3435 (narrow-to-region begin (point)) | |
3436 (fill-region-as-paragraph begin (point)) | |
3437 ;; Tapdance around looong Message-IDs. | |
3438 (forward-line -1) | |
3439 (when (looking-at "[ \t]*$") | |
3440 (message-delete-line)) | |
3441 (goto-char begin) | |
3442 (re-search-forward ":" nil t) | |
3443 (when (looking-at "\n[ \t]+") | |
3444 (replace-match " " t t)) | |
3445 (goto-char (point-max))))) | |
3446 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3447 (defun message-shorten-1 (list cut surplus) |
35147 | 3448 "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
|
3449 (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
|
3450 (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
|
3451 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3452 (defun message-shorten-references (header references) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3453 "Trim REFERENCES to be less than 31 Message-ID long, and fold them. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3454 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
|
3455 than 988 characters long, and if they are not, trim them until they are." |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3456 (let ((maxcount 31) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3457 (count 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3458 (cut 6) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3459 refs) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3460 (with-temp-buffer |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3461 (insert references) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3462 (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
|
3463 ;; 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
|
3464 (while (re-search-forward "<[^>]+>" nil t) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3465 (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
|
3466 (setq refs (nreverse refs) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3467 count (length refs))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3468 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3469 ;; 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
|
3470 ;; 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
|
3471 ;; elements that follow. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3472 (when (> count maxcount) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3473 (let ((surplus (- count maxcount))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3474 (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
|
3475 (decf count surplus))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3476 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3477 ;; 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
|
3478 ;; 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
|
3479 ;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3480 ;; 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
|
3481 ;; 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
|
3482 (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
|
3483 (let ((maxsize 988) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3484 (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
|
3485 (1- count))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3486 (surplus 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3487 (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
|
3488 ;; 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
|
3489 (while (> totalsize maxsize) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3490 (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
|
3491 (incf surplus) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3492 (setq ptr (cdr ptr))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3493 ;; ...and do it. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3494 (when (> surplus 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3495 (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
|
3496 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3497 ;; 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
|
3498 ;; it into the buffer. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3499 (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
|
3500 (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
|
3501 (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
|
3502 refstring "\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3503 (message-fill-header header refstring))))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3504 |
17493 | 3505 (defun message-position-point () |
3506 "Move point to where the user probably wants to find it." | |
3507 (message-narrow-to-headers) | |
3508 (cond | |
3509 ((re-search-forward "^[^:]+:[ \t]*$" nil t) | |
3510 (search-backward ":" ) | |
3511 (widen) | |
3512 (forward-char 1) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3513 (if (eq (char-after) ? ) |
17493 | 3514 (forward-char 1) |
3515 (insert " "))) | |
3516 (t | |
3517 (goto-char (point-max)) | |
3518 (widen) | |
3519 (forward-line 1) | |
3520 (unless (looking-at "$") | |
3521 (forward-line 2))) | |
3522 (sit-for 0))) | |
3523 | |
3524 (defun message-buffer-name (type &optional to group) | |
3525 "Return a new (unique) buffer name based on TYPE and TO." | |
3526 (cond | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3527 ;; 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
|
3528 ((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
|
3529 (generate-new-buffer-name |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3530 (concat "*" type |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3531 (if to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3532 (concat " to " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3533 (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
|
3534 to) "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3535 "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3536 (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
|
3537 "*"))) |
17493 | 3538 ;; Check whether `message-generate-new-buffers' is a function, |
3539 ;; and if so, call it. | |
3540 ((message-functionp message-generate-new-buffers) | |
3541 (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
|
3542 ((eq message-generate-new-buffers 'unsent) |
17493 | 3543 (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
|
3544 (concat "*unsent " type |
17493 | 3545 (if to |
3546 (concat " to " | |
3547 (or (car (mail-extract-address-components to)) | |
3548 to) "") | |
3549 "") | |
3550 (if (and group (not (string= group ""))) (concat " on " group) "") | |
3551 "*"))) | |
3552 ;; Use standard name. | |
3553 (t | |
3554 (format "*%s message*" type)))) | |
3555 | |
3556 (defun message-pop-to-buffer (name) | |
3557 "Pop to buffer NAME, and warn if it already exists and is modified." | |
3558 (let ((buffer (get-buffer name))) | |
3559 (if (and buffer | |
3560 (buffer-name buffer)) | |
3561 (progn | |
3562 (set-buffer (pop-to-buffer buffer)) | |
3563 (when (and (buffer-modified-p) | |
3564 (not (y-or-n-p | |
3565 "Message already being composed; erase? "))) | |
3566 (error "Message being composed"))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3567 (set-buffer (pop-to-buffer name))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3568 (erase-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3569 (message-mode))) |
17493 | 3570 |
3571 (defun message-do-send-housekeeping () | |
3572 "Kill old message buffers." | |
3573 ;; We might have sent this buffer already. Delete it from the | |
3574 ;; list of buffers. | |
3575 (setq message-buffer-list (delq (current-buffer) message-buffer-list)) | |
3576 (while (and message-max-buffers | |
3577 message-buffer-list | |
3578 (>= (length message-buffer-list) message-max-buffers)) | |
3579 ;; Kill the oldest buffer -- unless it has been changed. | |
3580 (let ((buffer (pop message-buffer-list))) | |
3581 (when (and (buffer-name buffer) | |
3582 (not (buffer-modified-p buffer))) | |
3583 (kill-buffer buffer)))) | |
3584 ;; Rename the buffer. | |
3585 (if message-send-rename-function | |
3586 (funcall message-send-rename-function) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3587 (when (string-match "\\`\\*\\(unsent \\)?" (buffer-name)) |
17493 | 3588 (rename-buffer |
3589 (concat "*sent " (substring (buffer-name) (match-end 0))) t))) | |
3590 ;; Push the current buffer onto the list. | |
3591 (when message-max-buffers | |
3592 (setq message-buffer-list | |
3593 (nconc message-buffer-list (list (current-buffer)))))) | |
3594 | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3595 (defun message-mail-user-agent () |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3596 (let ((mua (cond |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3597 ((not message-mail-user-agent) nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3598 ((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
|
3599 (t message-mail-user-agent)))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3600 (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
|
3601 nil |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3602 mua))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3603 |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3604 (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
|
3605 (let ((mua (message-mail-user-agent)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3606 subject to field yank-action) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3607 (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
|
3608 (message-setup-1 headers replybuffer actions) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3609 (if replybuffer |
34859
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
3610 (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
|
3611 (setq headers (copy-sequence headers)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3612 (setq field (assq 'Subject headers)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3613 (when field |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3614 (setq subject (cdr field)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3615 (setq headers (delq field headers))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3616 (setq field (assq 'To headers)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3617 (when field |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3618 (setq to (cdr field)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3619 (setq headers (delq field headers))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3620 (let ((mail-user-agent mua)) |
35147 | 3621 (compose-mail to subject |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3622 (mapcar (lambda (item) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3623 (cons |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3624 (format "%s" (car item)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3625 (cdr item))) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3626 headers) |
35147 | 3627 nil switch-function yank-action actions))))) |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3628 |
33301
c1c373a70748
Put some defvars in eval-when-compile.
Dave Love <fx@gnu.org>
parents:
33199
diff
changeset
|
3629 (eval-when-compile (defvar mc-modes-alist)) |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3630 (defun message-setup-1 (headers &optional replybuffer actions) |
17493 | 3631 (when (and (boundp 'mc-modes-alist) |
3632 (not (assq 'message-mode mc-modes-alist))) | |
3633 (push '(message-mode (encrypt . mc-encrypt-message) | |
3634 (sign . mc-sign-message)) | |
3635 mc-modes-alist)) | |
3636 (when actions | |
3637 (setq message-send-actions actions)) | |
3638 (setq message-reply-buffer replybuffer) | |
3639 (goto-char (point-min)) | |
3640 ;; Insert all the headers. | |
3641 (mail-header-format | |
3642 (let ((h headers) | |
3643 (alist message-header-format-alist)) | |
3644 (while h | |
3645 (unless (assq (caar h) message-header-format-alist) | |
3646 (push (list (caar h)) alist)) | |
3647 (pop h)) | |
3648 alist) | |
3649 headers) | |
3650 (delete-region (point) (progn (forward-line -1) (point))) | |
3651 (when message-default-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3652 (insert message-default-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3653 (or (bolp) (insert ?\n))) |
17493 | 3654 (put-text-property |
3655 (point) | |
3656 (progn | |
3657 (insert mail-header-separator "\n") | |
3658 (1- (point))) | |
3659 'read-only nil) | |
3660 (forward-line -1) | |
3661 (when (message-news-p) | |
3662 (when message-default-news-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3663 (insert message-default-news-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3664 (or (bolp) (insert ?\n))) |
17493 | 3665 (when message-generate-headers-first |
3666 (message-generate-headers | |
3667 (delq 'Lines | |
3668 (delq 'Subject | |
3669 (copy-sequence message-required-news-headers)))))) | |
3670 (when (message-mail-p) | |
3671 (when message-default-mail-headers | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3672 (insert message-default-mail-headers) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3673 (or (bolp) (insert ?\n))) |
17493 | 3674 (when message-generate-headers-first |
3675 (message-generate-headers | |
3676 (delq 'Lines | |
3677 (delq 'Subject | |
3678 (copy-sequence message-required-mail-headers)))))) | |
3679 (run-hooks 'message-signature-setup-hook) | |
3680 (message-insert-signature) | |
3681 (save-restriction | |
3682 (message-narrow-to-headers) | |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3683 (if message-alternative-emails |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
3684 (message-use-alternative-email-as-from)) |
17493 | 3685 (run-hooks 'message-header-setup-hook)) |
3686 (set-buffer-modified-p nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
3687 (setq buffer-undo-list nil) |
17493 | 3688 (run-hooks 'message-setup-hook) |
3689 (message-position-point) | |
3690 (undo-boundary)) | |
3691 | |
3692 (defun message-set-auto-save-file-name () | |
3693 "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
|
3694 (when message-auto-save-directory |
34057
98bd49d8cf7d
(message-auto-save-directory): Use
Dave Love <fx@gnu.org>
parents:
33982
diff
changeset
|
3695 (unless (file-directory-p |
98bd49d8cf7d
(message-auto-save-directory): Use
Dave Love <fx@gnu.org>
parents:
33982
diff
changeset
|
3696 (directory-file-name message-auto-save-directory)) |
34059
c40dbebdad05
(message-set-auto-save-file-name): Use gnus-make-directory.
Dave Love <fx@gnu.org>
parents:
34058
diff
changeset
|
3697 (gnus-make-directory message-auto-save-directory)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3698 (if (gnus-alive-p) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3699 (setq message-draft-article |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3700 (nndraft-request-associate-buffer "drafts")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3701 (setq buffer-file-name (expand-file-name "*message*" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3702 message-auto-save-directory)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3703 (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
|
3704 (clear-visited-file-modtime) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3705 (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
|
3706 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3707 (defun message-disassociate-draft () |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3708 "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
|
3709 (when message-draft-article |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3710 (nndraft-request-expire-articles |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3711 (list message-draft-article) "drafts" nil t))) |
17493 | 3712 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3713 (defun message-insert-headers () |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3714 "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
|
3715 (interactive) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3716 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3717 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3718 (message-narrow-to-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3719 (when (message-news-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3720 (message-generate-headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3721 (delq 'Lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3722 (delq 'Subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3723 (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
|
3724 (when (message-mail-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3725 (message-generate-headers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3726 (delq 'Lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3727 (delq 'Subject |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3728 (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
|
3729 |
17493 | 3730 |
3731 | |
3732 ;;; | |
3733 ;;; Commands for interfacing with message | |
3734 ;;; | |
3735 | |
3736 ;;;###autoload | |
3737 (defun message-mail (&optional to subject | |
3738 other-headers continue switch-function | |
3739 yank-action send-actions) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3740 "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
|
3741 OTHER-HEADERS is an alist of header/value pairs." |
17493 | 3742 (interactive) |
34859
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
3743 (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
|
3744 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3745 (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
|
3746 ;; 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
|
3747 ;; insert-buffer. |
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
3748 (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
|
3749 (setq replybuffer (nth 1 yank-action))) |
17493 | 3750 (message-setup |
3751 (nconc | |
3752 `((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
|
3753 (when other-headers other-headers)) |
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
3754 replybuffer) |
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
3755 ;; FIXME: Should return nil if failure. |
596342378358
* message.el (message-mail): Support yank-action.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34858
diff
changeset
|
3756 t)) |
17493 | 3757 |
3758 ;;;###autoload | |
3759 (defun message-news (&optional newsgroups subject) | |
3760 "Start editing a news article to be sent." | |
3761 (interactive) | |
3762 (let ((message-this-is-news t)) | |
3763 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups)) | |
3764 (message-setup `((Newsgroups . ,(or newsgroups "")) | |
3765 (Subject . ,(or subject "")))))) | |
3766 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3767 (defun message-get-reply-headers (wide &optional to-address) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3768 (let (follow-to mct never-mct from to cc reply-to ccalist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3769 ;; Find all relevant headers we need. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3770 (setq from (message-fetch-field "from") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3771 to (message-fetch-field "to") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3772 cc (message-fetch-field "cc") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3773 mct (message-fetch-field "mail-copies-to") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3774 reply-to (message-fetch-field "reply-to")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3775 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3776 ;; 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
|
3777 (when mct |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3778 (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
|
3779 (equal (downcase mct) "nobody")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3780 (setq never-mct t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3781 (setq mct nil)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3782 ((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
|
3783 (equal (downcase mct) "poster")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3784 (setq mct (or reply-to from))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3785 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3786 (if (or (not wide) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3787 to-address) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3788 (progn |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3789 (setq follow-to (list (cons 'To (or to-address reply-to from)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3790 (when (and wide mct) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3791 (push (cons 'Cc mct) follow-to))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3792 (let (ccalist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3793 (save-excursion |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3794 (message-set-work-buffer) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3795 (unless never-mct |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3796 (insert (or reply-to from ""))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3797 (insert (if to (concat (if (bolp) "" ", ") to "") "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3798 (insert (if mct (concat (if (bolp) "" ", ") mct) "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3799 (insert (if cc (concat (if (bolp) "" ", ") cc) "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3800 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3801 (while (re-search-forward "[ \t]+" nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3802 (replace-match " " t t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3803 ;; Remove addresses that match `rmail-dont-reply-to-names'. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3804 (let ((rmail-dont-reply-to-names message-dont-reply-to-names)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3805 (insert (prog1 (rmail-dont-reply-to (buffer-string)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3806 (erase-buffer)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3807 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3808 ;; Perhaps "Mail-Copies-To: never" removed the only address? |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3809 (when (eobp) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3810 (insert (or reply-to from ""))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3811 (setq ccalist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3812 (mapcar |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3813 (lambda (addr) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3814 (cons (mail-strip-quoted-names addr) addr)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3815 (message-tokenize-header (buffer-string)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3816 (let ((s ccalist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3817 (while s |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3818 (setq ccalist (delq (assoc (car (pop s)) s) ccalist))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3819 (setq follow-to (list (cons 'To (cdr (pop ccalist))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3820 (when ccalist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3821 (let ((ccs (cons 'Cc (mapconcat |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3822 (lambda (addr) (cdr addr)) ccalist ", ")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3823 (when (string-match "^ +" (cdr ccs)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3824 (setcdr ccs (substring (cdr ccs) (match-end 0)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3825 (push ccs follow-to))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3826 follow-to)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3827 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3828 |
17493 | 3829 ;;;###autoload |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3830 (defun message-reply (&optional to-address wide) |
17493 | 3831 "Start editing a reply to the article in the current buffer." |
3832 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3833 (require 'gnus-sum) ; for gnus-list-identifiers |
17493 | 3834 (let ((cur (current-buffer)) |
3835 from subject date reply-to to cc | |
3836 references message-id follow-to | |
3837 (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
|
3838 (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
|
3839 gnus-warning) |
17493 | 3840 (save-restriction |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
3841 (message-narrow-to-head-1) |
17493 | 3842 ;; Allow customizations to have their say. |
3843 (if (not wide) | |
3844 ;; This is a regular reply. | |
3845 (if (message-functionp message-reply-to-function) | |
3846 (setq follow-to (funcall message-reply-to-function))) | |
3847 ;; This is a followup. | |
3848 (if (message-functionp message-wide-reply-to-function) | |
3849 (save-excursion | |
3850 (setq follow-to | |
3851 (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
|
3852 (setq message-id (message-fetch-field "message-id" t) |
17493 | 3853 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
|
3854 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
|
3855 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
|
3856 subject (or (message-fetch-field "subject") "none")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3857 (if gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3858 (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
|
3859 (setq subject (concat "Re: " (message-strip-subject-re subject))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3860 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3861 (when (and (setq gnus-warning (message-fetch-field "gnus-warning")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3862 (string-match "<[^>]+>" gnus-warning)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3863 (setq message-id (match-string 0 gnus-warning))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3864 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3865 (unless follow-to |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3866 (setq follow-to (message-get-reply-headers wide to-address)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3867 |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3868 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3869 (message-pop-to-buffer |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3870 (message-buffer-name |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3871 (if wide "wide reply" "reply") from |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
3872 (if wide to-address nil)))) |
17493 | 3873 |
3874 (setq message-reply-headers | |
3875 (vector 0 subject from date message-id references 0 0 "")) | |
3876 | |
3877 (message-setup | |
3878 `((Subject . ,subject) | |
3879 ,@follow-to | |
3880 ,@(if (or references message-id) | |
3881 `((References . ,(concat (or references "") (and references " ") | |
3882 (or message-id "")))) | |
3883 nil)) | |
3884 cur))) | |
3885 | |
3886 ;;;###autoload | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3887 (defun message-wide-reply (&optional to-address) |
17493 | 3888 "Make a \"wide\" reply to the message in the current buffer." |
3889 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
3890 (message-reply to-address t)) |
17493 | 3891 |
3892 ;;;###autoload | |
3893 (defun message-followup (&optional to-newsgroups) | |
3894 "Follow up to the message in the current buffer. | |
3895 If TO-NEWSGROUPS, use that as the new Newsgroups line." | |
3896 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3897 (require 'gnus-sum) ; for gnus-list-identifiers |
17493 | 3898 (let ((cur (current-buffer)) |
3899 from subject date reply-to mct | |
3900 references message-id follow-to | |
3901 (inhibit-point-motion-hooks t) | |
3902 (message-this-is-news t) | |
3903 followup-to distribution newsgroups gnus-warning posted-to) | |
3904 (save-restriction | |
3905 (narrow-to-region | |
3906 (goto-char (point-min)) | |
3907 (if (search-forward "\n\n" nil t) | |
3908 (1- (point)) | |
3909 (point-max))) | |
3910 (when (message-functionp message-followup-to-function) | |
3911 (setq follow-to | |
3912 (funcall message-followup-to-function))) | |
3913 (setq from (message-fetch-field "from") | |
3914 date (message-fetch-field "date") | |
3915 subject (or (message-fetch-field "subject") "none") | |
3916 references (message-fetch-field "references") | |
3917 message-id (message-fetch-field "message-id" t) | |
3918 followup-to (message-fetch-field "followup-to") | |
3919 newsgroups (message-fetch-field "newsgroups") | |
3920 posted-to (message-fetch-field "posted-to") | |
3921 reply-to (message-fetch-field "reply-to") | |
3922 distribution (message-fetch-field "distribution") | |
3923 mct (message-fetch-field "mail-copies-to")) | |
3924 (when (and (setq gnus-warning (message-fetch-field "gnus-warning")) | |
3925 (string-match "<[^>]+>" gnus-warning)) | |
3926 (setq message-id (match-string 0 gnus-warning))) | |
3927 ;; Remove bogus distribution. | |
3928 (when (and (stringp distribution) | |
3929 (let ((case-fold-search t)) | |
3930 (string-match "world" distribution))) | |
3931 (setq distribution nil)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3932 (if gnus-list-identifiers |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3933 (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
|
3934 (setq subject (concat "Re: " (message-strip-subject-re subject))) |
17493 | 3935 (widen)) |
3936 | |
3937 (message-pop-to-buffer (message-buffer-name "followup" from newsgroups)) | |
3938 | |
3939 (message-setup | |
3940 `((Subject . ,subject) | |
3941 ,@(cond | |
3942 (to-newsgroups | |
3943 (list (cons 'Newsgroups to-newsgroups))) | |
3944 (follow-to follow-to) | |
3945 ((and followup-to message-use-followup-to) | |
3946 (list | |
3947 (cond | |
3948 ((equal (downcase followup-to) "poster") | |
3949 (if (or (eq message-use-followup-to 'use) | |
3950 (message-y-or-n-p "Obey Followup-To: poster? " t "\ | |
3951 You should normally obey the Followup-To: header. | |
3952 | |
3953 `Followup-To: poster' sends your response via e-mail instead of news. | |
3954 | |
3955 A typical situation where `Followup-To: poster' is used is when the poster | |
3956 does not read the newsgroup, so he wouldn't see any replies sent to it.")) | |
3957 (progn | |
3958 (setq message-this-is-news nil) | |
3959 (cons 'To (or reply-to from ""))) | |
3960 (cons 'Newsgroups newsgroups))) | |
3961 (t | |
3962 (if (or (equal followup-to newsgroups) | |
3963 (not (eq message-use-followup-to 'ask)) | |
3964 (message-y-or-n-p | |
3965 (concat "Obey Followup-To: " followup-to "? ") t "\ | |
3966 You should normally obey the Followup-To: header. | |
3967 | |
3968 `Followup-To: " followup-to "' | |
3969 directs your response to " (if (string-match "," followup-to) | |
3970 "the specified newsgroups" | |
3971 "that newsgroup only") ". | |
3972 | |
3973 If a message is posted to several newsgroups, Followup-To is often | |
3974 used to direct the following discussion to one newsgroup only, | |
3975 because discussions that are spread over several newsgroup tend to | |
3976 be fragmented and very difficult to follow. | |
3977 | |
3978 Also, some source/announcement newsgroups are not indented for discussion; | |
3979 responses here are directed to other newsgroups.")) | |
3980 (cons 'Newsgroups followup-to) | |
3981 (cons 'Newsgroups newsgroups)))))) | |
3982 (posted-to | |
3983 `((Newsgroups . ,posted-to))) | |
3984 (t | |
3985 `((Newsgroups . ,newsgroups)))) | |
3986 ,@(and distribution (list (cons 'Distribution distribution))) | |
3987 ,@(if (or references message-id) | |
3988 `((References . ,(concat (or references "") (and references " ") | |
3989 (or message-id ""))))) | |
3990 ,@(when (and mct | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3991 (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
|
3992 (equal (downcase mct) "nobody")))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
3993 (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
|
3994 (equal (downcase mct) "poster")) |
17493 | 3995 (or reply-to from "") |
3996 mct))))) | |
3997 | |
3998 cur) | |
3999 | |
4000 (setq message-reply-headers | |
4001 (vector 0 subject from date message-id references 0 0 "")))) | |
4002 | |
4003 | |
4004 ;;;###autoload | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4005 (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
|
4006 "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
|
4007 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
|
4008 (interactive "P") |
17493 | 4009 (unless (message-news-p) |
4010 (error "This is not a news article; canceling is impossible")) | |
4011 (when (yes-or-no-p "Do you really want to cancel this article? ") | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4012 (let (from newsgroups message-id distribution buf sender) |
17493 | 4013 (save-excursion |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4014 ;; Get header info from original article. |
17493 | 4015 (save-restriction |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4016 (message-narrow-to-head-1) |
17493 | 4017 (setq from (message-fetch-field "from") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4018 sender (message-fetch-field "sender") |
17493 | 4019 newsgroups (message-fetch-field "newsgroups") |
4020 message-id (message-fetch-field "message-id" t) | |
4021 distribution (message-fetch-field "distribution"))) | |
4022 ;; Make sure that this article was written by the user. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4023 (unless (or (and sender |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4024 (string-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4025 (downcase sender) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4026 (downcase (message-make-sender)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4027 (string-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4028 (downcase (cadr (mail-extract-address-components from))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4029 (downcase (cadr (mail-extract-address-components |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4030 (message-make-from)))))) |
17493 | 4031 (error "This article is not yours")) |
4032 ;; Make control message. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4033 (if arg |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4034 (message-news) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4035 (setq buf (set-buffer (get-buffer-create " *message cancel*")))) |
17493 | 4036 (erase-buffer) |
4037 (insert "Newsgroups: " newsgroups "\n" | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4038 "From: " from "\n" |
17493 | 4039 "Subject: cmsg cancel " message-id "\n" |
4040 "Control: cancel " message-id "\n" | |
4041 (if distribution | |
4042 (concat "Distribution: " distribution "\n") | |
4043 "") | |
4044 mail-header-separator "\n" | |
4045 message-cancel-message) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4046 (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
|
4047 (unless arg |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4048 (message "Canceling your article...") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4049 (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
|
4050 '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
|
4051 (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
|
4052 (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
|
4053 (kill-buffer buf)))))) |
17493 | 4054 |
4055 ;;;###autoload | |
4056 (defun message-supersede () | |
4057 "Start composing a message to supersede the current message. | |
4058 This is done simply by taking the old article and adding a Supersedes | |
4059 header line with the old Message-ID." | |
4060 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4061 (let ((cur (current-buffer)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4062 (sender (message-fetch-field "sender")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4063 (from (message-fetch-field "from"))) |
17493 | 4064 ;; Check whether the user owns the article that is to be superseded. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4065 (unless (or (and sender |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4066 (string-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4067 (downcase sender) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4068 (downcase (message-make-sender)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4069 (string-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4070 (downcase (cadr (mail-extract-address-components from))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4071 (downcase (cadr (mail-extract-address-components |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4072 (message-make-from)))))) |
17493 | 4073 (error "This article is not yours")) |
4074 ;; Get a normal message buffer. | |
4075 (message-pop-to-buffer (message-buffer-name "supersede")) | |
4076 (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
|
4077 (mime-to-mml) |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4078 (message-narrow-to-head-1) |
17493 | 4079 ;; Remove unwanted headers. |
4080 (when message-ignored-supersedes-headers | |
4081 (message-remove-header message-ignored-supersedes-headers t)) | |
4082 (goto-char (point-min)) | |
4083 (if (not (re-search-forward "^Message-ID: " nil t)) | |
4084 (error "No Message-ID in this article") | |
4085 (replace-match "Supersedes: " t t)) | |
4086 (goto-char (point-max)) | |
4087 (insert mail-header-separator) | |
4088 (widen) | |
4089 (forward-line 1))) | |
4090 | |
4091 ;;;###autoload | |
4092 (defun message-recover () | |
4093 "Reread contents of current buffer from its last auto-save file." | |
4094 (interactive) | |
4095 (let ((file-name (make-auto-save-file-name))) | |
4096 (cond ((save-window-excursion | |
4097 (if (not (eq system-type 'vax-vms)) | |
4098 (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
|
4099 (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
|
4100 (fundamental-mode)) ; for Emacs 20.4+ |
17493 | 4101 (buffer-disable-undo standard-output) |
4102 (let ((default-directory "/")) | |
4103 (call-process | |
4104 "ls" nil standard-output nil "-l" file-name)))) | |
4105 (yes-or-no-p (format "Recover auto save file %s? " file-name))) | |
4106 (let ((buffer-read-only nil)) | |
4107 (erase-buffer) | |
4108 (insert-file-contents file-name nil))) | |
4109 (t (error "message-recover cancelled"))))) | |
4110 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4111 ;;; Washing Subject: |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4112 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4113 (defun message-wash-subject (subject) |
35147 | 4114 "Remove junk like \"Re:\", \"(fwd)\", etc. added to subject string SUBJECT. |
4115 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
|
4116 (with-temp-buffer |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4117 (insert-string subject) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4118 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4119 ;; 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
|
4120 (while (re-search-forward |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4121 "\\([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
|
4122 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4123 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4124 ;; 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
|
4125 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4126 (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
|
4127 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4128 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4129 ;; and off the end |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4130 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4131 (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
|
4132 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4133 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4134 ;; 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
|
4135 (goto-char (point-min)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4136 (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
|
4137 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4138 (goto-char (point-max)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4139 (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
|
4140 (replace-match "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4141 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4142 (buffer-string))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4143 |
17493 | 4144 ;;; Forwarding messages. |
4145 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4146 (defun message-forward-subject-author-subject (subject) |
35147 | 4147 "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
|
4148 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
|
4149 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
|
4150 the list of newsgroups is was posted to." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4151 (concat "[" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4152 (or (message-fetch-field |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4153 (if (message-news-p) "newsgroups" "from")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4154 "(nowhere)") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4155 "] " subject)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4156 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4157 (defun message-forward-subject-fwd (subject) |
35147 | 4158 "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
|
4159 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
|
4160 the message." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4161 (concat "Fwd: " subject)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4162 |
17493 | 4163 (defun message-make-forward-subject () |
4164 "Return a Subject header suitable for the message in the current buffer." | |
4165 (save-excursion | |
4166 (save-restriction | |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4167 (message-narrow-to-head-1) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4168 (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
|
4169 (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
|
4170 (setq subject |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4171 (if subject |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4172 (mail-decode-encoded-word-string subject) |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4173 "")) |
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4174 (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
|
4175 (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
|
4176 ;; Make sure funcs is a list. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4177 (and funcs |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4178 (not (listp funcs)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4179 (setq funcs (list funcs))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4180 ;; 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
|
4181 ;; func to the next one. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4182 (while funcs |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4183 (when (message-functionp (car funcs)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4184 (setq subject (funcall (car funcs) subject))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4185 (setq funcs (cdr funcs))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4186 subject)))) |
17493 | 4187 |
4188 ;;;###autoload | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4189 (defun message-forward (&optional news digest) |
17493 | 4190 "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
|
4191 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
|
4192 Optional DIGEST will use digest to forward." |
17493 | 4193 (interactive "P") |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4194 (let* ((cur (current-buffer)) |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4195 (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
|
4196 art-beg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4197 (if news |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4198 (message-news nil subject) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4199 (message-mail nil subject)) |
17493 | 4200 ;; Put point where we want it before inserting the forwarded |
4201 ;; message. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4202 (if message-forward-before-signature |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4203 (message-goto-body) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4204 (goto-char (point-max))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4205 (if message-forward-as-mime |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4206 (if digest |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4207 (insert "\n<#multipart type=digest>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4208 (if message-forward-show-mml |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4209 (insert "\n\n<#mml type=message/rfc822 disposition=inline>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4210 (insert "\n\n<#part type=message/rfc822 disposition=inline raw=t>\n"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4211 (insert "\n-------------------- Start of forwarded message --------------------\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4212 (let ((b (point)) e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4213 (if digest |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4214 (if message-forward-as-mime |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4215 (insert-buffer-substring cur) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4216 (mml-insert-buffer cur)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4217 (if message-forward-show-mml |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4218 (insert |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4219 (with-temp-buffer |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4220 (mm-disable-multibyte-mule4) ;; Must copy buffer in unibyte mode |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4221 (insert |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4222 (with-current-buffer cur |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4223 (mm-string-as-unibyte (buffer-string)))) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4224 (mm-enable-multibyte-mule4) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4225 (mime-to-mml) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4226 (goto-char (point-min)) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4227 (when (looking-at "From ") |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4228 (replace-match "X-From-Line: ")) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
35147
diff
changeset
|
4229 (buffer-string))) |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4230 (save-restriction |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4231 (narrow-to-region (point) (point)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4232 (mml-insert-buffer cur) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4233 (goto-char (point-min)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4234 (when (looking-at "From ") |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4235 (replace-match "X-From-Line: ")) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4236 (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
|
4237 (setq e (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4238 (if message-forward-as-mime |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4239 (if digest |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4240 (insert "<#/multipart>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4241 (if message-forward-show-mml |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4242 (insert "<#/mml>\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4243 (insert "<#/part>\n"))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4244 (insert "\n-------------------- End of forwarded message --------------------\n")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4245 (if (and digest message-forward-as-mime) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4246 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4247 (narrow-to-region b e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4248 (goto-char b) |
35147 | 4249 (narrow-to-region (point) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4250 (or (search-forward "\n\n" nil t) (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4251 (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
|
4252 (when (and (not current-prefix-arg) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4253 message-forward-ignored-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4254 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4255 (narrow-to-region b e) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4256 (goto-char b) |
35147 | 4257 (narrow-to-region (point) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4258 (or (search-forward "\n\n" nil t) (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4259 (message-remove-header message-forward-ignored-headers t))))) |
17493 | 4260 (message-position-point))) |
4261 | |
4262 ;;;###autoload | |
4263 (defun message-resend (address) | |
4264 "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
|
4265 (interactive |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4266 (list (message-read-from-minibuffer "Resend message to: "))) |
17493 | 4267 (message "Resending message to %s..." address) |
4268 (save-excursion | |
4269 (let ((cur (current-buffer)) | |
4270 beg) | |
4271 ;; 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
|
4272 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4273 (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
|
4274 (erase-buffer)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4275 (let ((message-this-is-mail t)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4276 (message-setup `((To . ,address)))) |
17493 | 4277 ;; Insert our usual headers. |
4278 (message-generate-headers '(From Date To)) | |
4279 (message-narrow-to-headers) | |
4280 ;; Rename them all to "Resent-*". | |
4281 (while (re-search-forward "^[A-Za-z]" nil t) | |
4282 (forward-char -1) | |
4283 (insert "Resent-")) | |
4284 (widen) | |
4285 (forward-line) | |
4286 (delete-region (point) (point-max)) | |
4287 (setq beg (point)) | |
4288 ;; Insert the message to be resent. | |
4289 (insert-buffer-substring cur) | |
4290 (goto-char (point-min)) | |
4291 (search-forward "\n\n") | |
4292 (forward-char -1) | |
4293 (save-restriction | |
4294 (narrow-to-region beg (point)) | |
4295 (message-remove-header message-ignored-resent-headers t) | |
4296 (goto-char (point-max))) | |
4297 (insert mail-header-separator) | |
4298 ;; 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
|
4299 (while (re-search-backward "^\\(Also-\\)*Resent-" beg t) |
17493 | 4300 (beginning-of-line) |
4301 (insert "Also-")) | |
4302 ;; Quote any "From " lines at the beginning. | |
4303 (goto-char beg) | |
4304 (when (looking-at "From ") | |
4305 (replace-match "X-From-Line: ")) | |
4306 ;; Send it. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4307 (let ((message-inhibit-body-encoding t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4308 message-required-mail-headers) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4309 (message-send-mail)) |
17493 | 4310 (kill-buffer (current-buffer))) |
4311 (message "Resending message to %s...done" address))) | |
4312 | |
4313 ;;;###autoload | |
4314 (defun message-bounce () | |
4315 "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
|
4316 This only makes sense if the current message is a bounce message that |
17493 | 4317 contains some mail you have written which has been bounced back to |
4318 you." | |
4319 (interactive) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4320 (let ((handles (mm-dissect-buffer t)) |
17493 | 4321 boundary) |
4322 (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
|
4323 (if (stringp (car handles)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4324 ;; 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
|
4325 (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
|
4326 ;; 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
|
4327 ;; manually. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4328 (mm-insert-part handles) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4329 (undo-boundary) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4330 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4331 (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
|
4332 (or (and (re-search-forward message-unsent-separator nil t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4333 (forward-line 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4334 (re-search-forward "^Return-Path:.*\n" nil t)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4335 ;; We remove everything before the bounced mail. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4336 (delete-region |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4337 (point-min) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4338 (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
|
4339 (match-beginning 0) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4340 (point)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4341 (mm-enable-multibyte) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4342 (mime-to-mml) |
17493 | 4343 (save-restriction |
34752
f04f551e94ce
* message.el (message-narrow-to-head-1): New function.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34485
diff
changeset
|
4344 (message-narrow-to-head-1) |
17493 | 4345 (message-remove-header message-ignored-bounced-headers t) |
4346 (goto-char (point-max)) | |
4347 (insert mail-header-separator)) | |
4348 (message-position-point))) | |
4349 | |
4350 ;;; | |
4351 ;;; Interactive entry points for new message buffers. | |
4352 ;;; | |
4353 | |
4354 ;;;###autoload | |
4355 (defun message-mail-other-window (&optional to subject) | |
4356 "Like `message-mail' command, but display mail buffer in another window." | |
4357 (interactive) | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4358 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4359 (let ((pop-up-windows t) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4360 (special-display-buffer-names nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4361 (special-display-regexps nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4362 (same-window-buffer-names nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4363 (same-window-regexps nil)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4364 (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
|
4365 (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
|
4366 (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
|
4367 nil nil 'switch-to-buffer-other-window))) |
17493 | 4368 |
4369 ;;;###autoload | |
4370 (defun message-mail-other-frame (&optional to subject) | |
4371 "Like `message-mail' command, but display mail buffer in another frame." | |
4372 (interactive) | |
34797
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4373 (unless (message-mail-user-agent) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4374 (let ((pop-up-frames t) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4375 (special-display-buffer-names nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4376 (special-display-regexps nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4377 (same-window-buffer-names nil) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4378 (same-window-regexps nil)) |
b473bc6d9a55
* mml.el (gnus-add-minor-mode): Autoload.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34766
diff
changeset
|
4379 (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
|
4380 (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
|
4381 (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
|
4382 nil nil 'switch-to-buffer-other-frame))) |
17493 | 4383 |
4384 ;;;###autoload | |
4385 (defun message-news-other-window (&optional newsgroups subject) | |
4386 "Start editing a news article to be sent." | |
4387 (interactive) | |
4388 (let ((pop-up-windows t) | |
4389 (special-display-buffer-names nil) | |
4390 (special-display-regexps nil) | |
4391 (same-window-buffer-names nil) | |
4392 (same-window-regexps nil)) | |
4393 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4394 (let ((message-this-is-news t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4395 (message-setup `((Newsgroups . ,(or newsgroups "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4396 (Subject . ,(or subject "")))))) |
17493 | 4397 |
4398 ;;;###autoload | |
4399 (defun message-news-other-frame (&optional newsgroups subject) | |
4400 "Start editing a news article to be sent." | |
4401 (interactive) | |
4402 (let ((pop-up-frames t) | |
4403 (special-display-buffer-names nil) | |
4404 (special-display-regexps nil) | |
4405 (same-window-buffer-names nil) | |
4406 (same-window-regexps nil)) | |
4407 (message-pop-to-buffer (message-buffer-name "news" nil newsgroups))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4408 (let ((message-this-is-news t)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4409 (message-setup `((Newsgroups . ,(or newsgroups "")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4410 (Subject . ,(or subject "")))))) |
17493 | 4411 |
4412 ;;; underline.el | |
4413 | |
4414 ;; This code should be moved to underline.el (from which it is stolen). | |
4415 | |
4416 ;;;###autoload | |
4417 (defun bold-region (start end) | |
4418 "Bold all nonblank characters in the region. | |
4419 Works by overstriking characters. | |
4420 Called from program, takes two arguments START and END | |
4421 which specify the range to operate on." | |
4422 (interactive "r") | |
4423 (save-excursion | |
4424 (let ((end1 (make-marker))) | |
4425 (move-marker end1 (max start end)) | |
4426 (goto-char (min start end)) | |
4427 (while (< (point) end1) | |
4428 (or (looking-at "[_\^@- ]") | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4429 (insert (char-after) "\b")) |
17493 | 4430 (forward-char 1))))) |
4431 | |
4432 ;;;###autoload | |
4433 (defun unbold-region (start end) | |
4434 "Remove all boldness (overstruck characters) in the region. | |
4435 Called from program, takes two arguments START and END | |
4436 which specify the range to operate on." | |
4437 (interactive "r") | |
4438 (save-excursion | |
4439 (let ((end1 (make-marker))) | |
4440 (move-marker end1 (max start end)) | |
4441 (goto-char (min start end)) | |
4442 (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
|
4443 (if (eq (char-after) (char-after (- (point) 2))) |
17493 | 4444 (delete-char -2)))))) |
4445 | |
4446 (defalias 'message-exchange-point-and-mark 'exchange-point-and-mark) | |
4447 | |
4448 ;; Support for toolbar | |
33335
3fcf9bc886b8
(tool-bar-map): Defvar when compiling.
Dave Love <fx@gnu.org>
parents:
33301
diff
changeset
|
4449 (eval-when-compile (defvar tool-bar-map)) |
32964
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4450 (if (featurep 'xemacs) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4451 (require 'messagexmas) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4452 (when (and (fboundp 'tool-bar-add-item-from-menu) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4453 tool-bar-mode) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4454 (defvar message-tool-bar-map |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4455 (let ((tool-bar-map (copy-keymap tool-bar-map))) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4456 ;; Zap some items which aren't so relevant and take up space. |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4457 (dolist (key '(print-buffer kill-buffer save-buffer write-file |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4458 dired open-file)) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4459 (define-key tool-bar-map (vector key) nil)) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4460 |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4461 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4462 'message-send-and-exit "mail_send" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4463 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4464 'message-kill-buffer "close" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4465 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4466 'message-dont-send "cancel" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4467 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4468 'mml-attach-file "attach" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4469 (tool-bar-add-item-from-menu |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4470 'ispell-message "spell" message-mode-map) |
352449d35643
(message-mode-menu): Add some :help strings.
Dave Love <fx@gnu.org>
parents:
31716
diff
changeset
|
4471 tool-bar-map)))) |
17493 | 4472 |
4473 ;;; Group name completion. | |
4474 | |
4475 (defvar message-newgroups-header-regexp | |
4476 "^\\(Newsgroups\\|Followup-To\\|Posted-To\\|Gcc\\):" | |
4477 "Regexp that match headers that lists groups.") | |
4478 | |
4479 (defun message-tab () | |
4480 "Expand group names in Newsgroups and Followup-To headers. | |
4481 Do a `tab-to-tab-stop' if not in those headers." | |
4482 (interactive) | |
4483 (if (let ((mail-abbrev-mode-regexp message-newgroups-header-regexp)) | |
4484 (mail-abbrev-in-expansion-header-p)) | |
4485 (message-expand-group) | |
4486 (tab-to-tab-stop))) | |
4487 | |
4488 (defun message-expand-group () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4489 "Expand the group name under point." |
17493 | 4490 (let* ((b (save-excursion |
4491 (save-restriction | |
4492 (narrow-to-region | |
4493 (save-excursion | |
4494 (beginning-of-line) | |
4495 (skip-chars-forward "^:") | |
4496 (1+ (point))) | |
4497 (point)) | |
4498 (skip-chars-backward "^, \t\n") (point)))) | |
4499 (completion-ignore-case t) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4500 (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
|
4501 (point)))) |
17493 | 4502 (hashtb (and (boundp 'gnus-active-hashtb) gnus-active-hashtb)) |
4503 (completions (all-completions string hashtb)) | |
4504 comp) | |
4505 (delete-region b (point)) | |
4506 (cond | |
4507 ((= (length completions) 1) | |
4508 (if (string= (car completions) string) | |
4509 (progn | |
4510 (insert string) | |
4511 (message "Only matching group")) | |
4512 (insert (car completions)))) | |
4513 ((and (setq comp (try-completion string hashtb)) | |
4514 (not (string= comp string))) | |
4515 (insert comp)) | |
4516 (t | |
4517 (insert string) | |
4518 (if (not comp) | |
4519 (message "No matching groups") | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4520 (save-selected-window |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4521 (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
|
4522 (buffer-disable-undo) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4523 (let ((buffer-read-only nil)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4524 (erase-buffer) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4525 (let ((standard-output (current-buffer))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4526 (display-completion-list (sort completions 'string<))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4527 (goto-char (point-min)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4528 (delete-region (point) (progn (forward-line 3) (point)))))))))) |
17493 | 4529 |
4530 ;;; Help stuff. | |
4531 | |
4532 (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
|
4533 "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
|
4534 If SHOW is non-nil, the arguments TEXT... are displayed in a temp buffer. |
17493 | 4535 The following arguments may contain lists of values." |
4536 (if (and show | |
4537 (setq text (message-flatten-list text))) | |
4538 (save-window-excursion | |
4539 (save-excursion | |
4540 (with-output-to-temp-buffer " *MESSAGE information message*" | |
4541 (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
|
4542 (fundamental-mode) ; for Emacs 20.4+ |
17493 | 4543 (mapcar 'princ text) |
4544 (goto-char (point-min)))) | |
4545 (funcall ask question)) | |
4546 (funcall ask question))) | |
4547 | |
4548 (defun message-flatten-list (list) | |
4549 "Return a new, flat list that contains all elements of LIST. | |
4550 | |
4551 \(message-flatten-list '(1 (2 3 (4 5 (6))) 7)) | |
4552 => (1 2 3 4 5 6 7)" | |
4553 (cond ((consp list) | |
4554 (apply 'append (mapcar 'message-flatten-list list))) | |
4555 (list | |
4556 (list list)))) | |
4557 | |
4558 (defun message-generate-new-buffer-clone-locals (name &optional varstr) | |
35147 | 4559 "Create and return a buffer with name based on NAME using `generate-new-buffer.' |
17493 | 4560 Then clone the local variables and values from the old buffer to the |
4561 new one, cloning only the locals having a substring matching the | |
4562 regexp varstr." | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4563 (let ((oldbuf (current-buffer))) |
17493 | 4564 (save-excursion |
4565 (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
|
4566 (message-clone-locals oldbuf varstr) |
17493 | 4567 (current-buffer)))) |
4568 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4569 (defun message-clone-locals (buffer &optional varstr) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4570 "Clone the local variables from BUFFER to the current buffer." |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4571 (let ((locals (save-excursion |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4572 (set-buffer buffer) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4573 (buffer-local-variables))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4574 (regexp "^gnus\\|^nn\\|^message\\|^user-mail-address")) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4575 (mapcar |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4576 (lambda (local) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4577 (when (and (consp local) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4578 (car local) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4579 (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
|
4580 (or (null varstr) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4581 (string-match varstr (symbol-name (car local))))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4582 (ignore-errors |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4583 (set (make-local-variable (car local)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4584 (cdr local))))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4585 locals))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19762
diff
changeset
|
4586 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4587 ;;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4588 ;;; MIME functions |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4589 ;;; |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4590 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4591 (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
|
4592 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4593 (defun message-encode-message-body () |
35147 | 4594 (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
|
4595 (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
|
4596 message-default-charset)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4597 (case-fold-search t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4598 lines content-type-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4599 (message-goto-body) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4600 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4601 (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
|
4602 (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
|
4603 (when new |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4604 (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
|
4605 (insert new) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4606 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4607 (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
|
4608 (delete-char 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4609 (search-forward "\n\n") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4610 (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
|
4611 (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
|
4612 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4613 (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
|
4614 (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
|
4615 (goto-char (point-max)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4616 (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
|
4617 (when lines |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4618 (insert lines)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4619 (setq content-type-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4620 (re-search-backward "^Content-Type:" nil t))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4621 (save-restriction |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4622 (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
|
4623 (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
|
4624 (message-remove-first-header "Content-Transfer-Encoding")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4625 ;; We always make sure that the message has a Content-Type header. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4626 ;; This is because some broken MTAs and MUAs get awfully confused |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4627 ;; when confronted with a message with a MIME-Version header and |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4628 ;; without a Content-Type header. For instance, Solaris' |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4629 ;; /usr/bin/mail. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4630 (unless content-type-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4631 (goto-char (point-min)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4632 (re-search-forward "^MIME-Version:") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4633 (forward-line 1) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4634 (insert "Content-Type: text/plain; charset=us-ascii\n"))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4635 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4636 (defun message-read-from-minibuffer (prompt) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4637 "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
|
4638 (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
|
4639 (let ((mail-abbrev-mode-regexp "") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4640 (minibuffer-setup-hook 'mail-abbrevs-setup)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4641 (read-from-minibuffer prompt)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4642 (let ((minibuffer-setup-hook 'mail-abbrev-minibuffer-setup-hook)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4643 (read-string prompt)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4644 |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4645 (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
|
4646 (require 'mail-utils) |
35147 | 4647 (let* ((fields '("To" "Cc")) |
32967
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4648 (emails |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4649 (split-string |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4650 (mail-strip-quoted-names |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4651 (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
|
4652 "[ \f\t\n\r\v,]+")) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4653 email) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4654 (while emails |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4655 (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
|
4656 (setq email (car emails) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4657 emails nil)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4658 (pop emails)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4659 (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
|
4660 (goto-char (point-max)) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4661 (insert "From: " email "\n")))) |
7625203dacf3
2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents:
32964
diff
changeset
|
4662 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4663 (provide 'message) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
23743
diff
changeset
|
4664 |
17493 | 4665 (run-hooks 'message-load-hook) |
4666 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4667 ;; Local Variables: |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4668 ;; coding: iso-8859-1 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
4669 ;; End: |
17493 | 4670 |
4671 ;;; message.el ends here |