* gnus.el (gnus-other-frame-function): New user option.
[gnus] / lisp / gnus-msg.el
1 ;;; gnus-msg.el --- mail and post interface for Gnus
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
3 ;;        Free Software Foundation, Inc.
4
5 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6 ;;      Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; Keywords: news
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;; GNU General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
25
26 ;;; Commentary:
27
28 ;;; Code:
29
30 (eval-when-compile (require 'cl))
31
32 (require 'gnus)
33 (require 'gnus-ems)
34 (require 'message)
35 (require 'gnus-art)
36
37 (defcustom gnus-post-method 'current
38   "*Preferred method for posting USENET news.
39
40 If this variable is `current' (which is the default), Gnus will use
41 the \"current\" select method when posting.  If it is `native', Gnus
42 will use the native select method when posting.
43
44 This method will not be used in mail groups and the like, only in
45 \"real\" newsgroups.
46
47 If not `native' nor `current', the value must be a valid method as discussed
48 in the documentation of `gnus-select-method'.  It can also be a list of
49 methods.  If that is the case, the user will be queried for what select
50 method to use when posting."
51   :group 'gnus-group-foreign
52   :link '(custom-manual "(gnus)Posting Server")
53   :type `(choice (const native)
54                  (const current)
55                  (sexp :tag "Methods" ,gnus-select-method)))
56
57 (defcustom gnus-outgoing-message-group nil
58   "*All outgoing messages will be put in this group.
59 If you want to store all your outgoing mail and articles in the group
60 \"nnml:archive\", you set this variable to that value.  This variable
61 can also be a list of group names.
62
63 If you want to have greater control over what group to put each
64 message in, you can set this variable to a function that checks the
65 current newsgroup name and then returns a suitable group name (or list
66 of names)."
67   :group 'gnus-message
68   :type '(choice (string :tag "Group")
69                  (function)))
70
71 (defcustom gnus-mailing-list-groups nil
72   "*Regexp matching groups that are really mailing lists.
73 This is useful when you're reading a mailing list that has been
74 gatewayed to a newsgroup, and you want to followup to an article in
75 the group."
76   :group 'gnus-message
77   :type 'regexp)
78
79 (defcustom gnus-add-to-list nil
80   "*If non-nil, add a `to-list' parameter automatically."
81   :group 'gnus-message
82   :type 'boolean)
83
84 (defcustom gnus-crosspost-complaint
85   "Hi,
86
87 You posted the article below with the following Newsgroups header:
88
89 Newsgroups: %s
90
91 The %s group, at least, was an inappropriate recipient
92 of this message.  Please trim your Newsgroups header to exclude this
93 group before posting in the future.
94
95 Thank you.
96
97 "
98   "Format string to be inserted when complaining about crossposts.
99 The first %s will be replaced by the Newsgroups header;
100 the second with the current group name."
101   :group 'gnus-message
102   :type 'string)
103
104 (defcustom gnus-message-setup-hook nil
105   "Hook run after setting up a message buffer."
106   :group 'gnus-message
107   :type 'hook)
108
109 (defcustom gnus-bug-create-help-buffer t
110   "*Should we create the *Gnus Help Bug* buffer?"
111   :group 'gnus-message
112   :type 'boolean)
113
114 (defcustom gnus-posting-styles nil
115   "*Alist of styles to use when posting.
116 See Info node `(gnus)Posting Styles'."
117   :group 'gnus-message
118   :type '(repeat (cons (choice (regexp)
119                                (variable)
120                                (list (const header)
121                                      (string :tag "Header")
122                                      (regexp :tag "Regexp"))
123                                (function)
124                                (sexp))
125                        (repeat (list
126                                 (choice (const signature)
127                                         (const signature-file)
128                                         (const organization)
129                                         (const address)
130                                         (const x-face-file)
131                                         (const name)
132                                         (const body)
133                                         (symbol)
134                                         (string :tag "Header"))
135                                 (choice (string)
136                                         (function)
137                                         (variable)
138                                         (sexp)))))))
139
140 (defcustom gnus-gcc-mark-as-read nil
141   "If non-nil, automatically mark Gcc articles as read."
142   :version "21.1"
143   :group 'gnus-message
144   :type 'boolean)
145
146 (defvar gnus-inews-mark-gcc-as-read nil
147   "Obsolete variable. Use `gnus-gcc-mark-as-read' instead.")
148
149 (make-obsolete-variable 'gnus-inews-mark-gcc-as-read
150                         'gnus-gcc-mark-as-read)
151
152 (defcustom gnus-gcc-externalize-attachments nil
153   "Should local-file attachments be included as external parts in Gcc copies?
154 If it is `all', attach files as external parts;
155 if a regexp and matches the Gcc group name, attach files as external parts;
156 If nil, attach files as normal parts."
157   :version "21.1"
158   :group 'gnus-message
159   :type '(choice (const nil :tag "None")
160                  (const all :tag "Any")
161                  (string :tag "Regexp")))
162
163 (defcustom gnus-group-posting-charset-alist
164   '(("^\\(no\\|fr\\)\\.[^,]*\\(,[ \t\n]*\\(no\\|fr\\)\\.[^,]*\\)*$" iso-8859-1 (iso-8859-1))
165     ("^\\(fido7\\|relcom\\)\\.[^,]*\\(,[ \t\n]*\\(fido7\\|relcom\\)\\.[^,]*\\)*$" koi8-r (koi8-r))
166     (message-this-is-mail nil nil)
167     (message-this-is-news nil t))
168   "Alist of regexps and permitted unencoded charsets for posting.
169 Each element of the alist has the form (TEST HEADER BODY-LIST), where
170 TEST is either a regular expression matching the newsgroup header or a
171 variable to query,
172 HEADER is the charset which may be left unencoded in the header (nil
173 means encode all charsets),
174 BODY-LIST is a list of charsets which may be encoded using 8bit
175 content-transfer encoding in the body, or one of the special values
176 nil (always encode using quoted-printable) or t (always use 8bit).
177
178 Note that any value other than nil for HEADER infringes some RFCs, so
179 use this option with care."
180   :type '(repeat (list :tag "Permitted unencoded charsets"
181                   (choice :tag "Where"
182                    (regexp :tag "Group")
183                    (const :tag "Mail message" :value message-this-is-mail)
184                    (const :tag "News article" :value message-this-is-news))
185                   (choice :tag "Header"
186                    (const :tag "None" nil)
187                    (symbol :tag "Charset"))
188                   (choice :tag "Body"
189                           (const :tag "Any" :value t)
190                           (const :tag "None" :value nil)
191                           (repeat :tag "Charsets"
192                                   (symbol :tag "Charset")))))
193   :group 'gnus-charset)
194
195 (defcustom gnus-debug-files
196   '("gnus.el" "gnus-sum.el" "gnus-group.el"
197     "gnus-art.el" "gnus-start.el" "gnus-async.el"
198     "gnus-msg.el" "gnus-score.el" "gnus-win.el" "gnus-topic.el"
199     "gnus-agent.el" "gnus-cache.el" "gnus-srvr.el"
200     "mm-util.el" "mm-decode.el" "nnmail.el" "message.el")
201   "Files whose variables will be reported in `gnus-bug'."
202   :version "21.1"
203   :group 'gnus-message
204   :type '(repeat (string :tag "File")))
205
206 (defcustom gnus-debug-exclude-variables
207   '(mm-mime-mule-charset-alist
208     nnmail-split-fancy message-minibuffer-local-map)
209   "Variables that should not be reported in `gnus-bug'."
210   :version "21.1"
211   :group 'gnus-message
212   :type '(repeat (symbol :tag "Variable")))
213
214 (defcustom gnus-discouraged-post-methods
215   '(nndraft nnml nnimap nnmaildir nnmh nnfolder nndir)
216   "A list of back ends that are not used in \"real\" newsgroups.
217 This variable is used only when `gnus-post-method' is `current'."
218   :version "21.3"
219   :group 'gnus-group-foreign
220   :type '(repeat (symbol :tag "Back end")))
221
222 (defcustom gnus-message-replysign
223   nil
224   "Automatically sign replys to signed messages.
225 See also the `mml-default-sign-method' variable."
226   :group 'gnus-message
227   :type 'boolean)
228
229 (defcustom gnus-message-replyencrypt
230   nil
231   "Automatically encrypt replys to encrypted messages.
232 See also the `mml-default-encrypt-method' variable."
233   :group 'gnus-message
234   :type 'boolean)
235
236 (defcustom gnus-message-replysignencrypted
237   t
238   "Setting this causes automatically encryped messages to also be signed."
239   :group 'gnus-message
240   :type 'boolean)
241
242 (defcustom gnus-confirm-mail-reply-to-news nil
243   "If non-nil, Gnus requests confirmation when replying to news.
244 This is done because new users often reply by mistake when reading
245 news."
246   :group 'gnus-message
247   :type 'boolean)
248
249 (defcustom gnus-summary-resend-default-address t
250   "If non-nil, Gnus tries to suggest a default address to resend to.
251 If nil, the address field will always be empty after invoking
252 `gnus-summary-resend-message'."
253   :group 'gnus-message
254   :type 'boolean)
255
256 ;;; Internal variables.
257
258 (defvar gnus-inhibit-posting-styles nil
259   "Inhibit the use of posting styles.")
260
261 (defvar gnus-message-buffer "*Mail Gnus*")
262 (defvar gnus-article-copy nil)
263 (defvar gnus-check-before-posting nil)
264 (defvar gnus-last-posting-server nil)
265 (defvar gnus-message-group-art nil)
266
267 (defvar gnus-msg-force-broken-reply-to nil)
268
269 (defconst gnus-bug-message
270   "Sending a bug report to the Gnus Towers.
271 ========================================
272
273 The buffer below is a mail buffer.  When you press `C-c C-c', it will
274 be sent to the Gnus Bug Exterminators.
275
276 The thing near the bottom of the buffer is how the environment
277 settings will be included in the mail.  Please do not delete that.
278 They will tell the Bug People what your environment is, so that it
279 will be easier to locate the bugs.
280
281 If you have found a bug that makes Emacs go \"beep\", set
282 debug-on-error to t (`M-x set-variable RET debug-on-error RET t RET')
283 and include the backtrace in your bug report.
284
285 Please describe the bug in annoying, painstaking detail.
286
287 Thank you for your help in stamping out bugs.
288 ")
289
290 (eval-and-compile
291   (autoload 'gnus-uu-post-news "gnus-uu" nil t)
292   (autoload 'news-setup "rnewspost")
293   (autoload 'news-reply-mode "rnewspost")
294   (autoload 'rmail-dont-reply-to "mail-utils")
295   (autoload 'rmail-output "rmailout"))
296
297 \f
298 ;;;
299 ;;; Gnus Posting Functions
300 ;;;
301
302 (gnus-define-keys (gnus-summary-send-map "S" gnus-summary-mode-map)
303   "p" gnus-summary-post-news
304   "i" gnus-summary-news-other-window
305   "f" gnus-summary-followup
306   "F" gnus-summary-followup-with-original
307   "c" gnus-summary-cancel-article
308   "s" gnus-summary-supersede-article
309   "r" gnus-summary-reply
310   "y" gnus-summary-yank-message
311   "R" gnus-summary-reply-with-original
312   "w" gnus-summary-wide-reply
313   "W" gnus-summary-wide-reply-with-original
314   "v" gnus-summary-very-wide-reply
315   "V" gnus-summary-very-wide-reply-with-original
316   "n" gnus-summary-followup-to-mail
317   "N" gnus-summary-followup-to-mail-with-original
318   "m" gnus-summary-mail-other-window
319   "u" gnus-uu-post-news
320   "\M-c" gnus-summary-mail-crosspost-complaint
321   "Br" gnus-summary-reply-broken-reply-to
322   "BR" gnus-summary-reply-broken-reply-to-with-original
323   "om" gnus-summary-mail-forward
324   "op" gnus-summary-post-forward
325   "Om" gnus-uu-digest-mail-forward
326   "Op" gnus-uu-digest-post-forward)
327
328 (gnus-define-keys (gnus-send-bounce-map "D" gnus-summary-send-map)
329   "b" gnus-summary-resend-bounced-mail
330   ;; "c" gnus-summary-send-draft
331   "r" gnus-summary-resend-message
332   "e" gnus-summary-resend-message-edit)
333
334 ;;; Internal functions.
335
336 (defvar gnus-article-reply nil)
337 (defmacro gnus-setup-message (config &rest forms)
338   (let ((winconf (make-symbol "gnus-setup-message-winconf"))
339         (buffer (make-symbol "gnus-setup-message-buffer"))
340         (article (make-symbol "gnus-setup-message-article"))
341         (group (make-symbol "gnus-setup-message-group")))
342     `(let ((,winconf (current-window-configuration))
343            (,buffer (buffer-name (current-buffer)))
344            (,article gnus-article-reply)
345            (,group gnus-newsgroup-name)
346            (message-header-setup-hook
347             (copy-sequence message-header-setup-hook))
348            (mbl mml-buffer-list)
349            (message-mode-hook (copy-sequence message-mode-hook)))
350        (setq mml-buffer-list nil)
351        (add-hook 'message-header-setup-hook 'gnus-inews-insert-gcc)
352        (add-hook 'message-header-setup-hook 'gnus-inews-insert-archive-gcc)
353        ;; #### FIXME: for a reason that I did not manage to identify yet,
354        ;; the variable `gnus-newsgroup-name' does not honor a dynamically
355        ;; scoped or setq'ed value from a caller like `C-u gnus-summary-mail'.
356        ;; After evaluation of @forms below, it gets the value we actually want
357        ;; to override, and the posting styles are used. For that reason, I've
358        ;; added an optional argument to `gnus-configure-posting-styles' to
359        ;; make sure that the correct value for the group name is used. -- drv
360        (add-hook 'message-mode-hook
361                  (lambda ()
362                    (gnus-configure-posting-styles ,group)))
363        (unwind-protect
364            (progn
365              ,@forms)
366          (gnus-inews-add-send-actions ,winconf ,buffer ,article ,config)
367          (gnus-inews-insert-draft-meta-information ,group ,article)
368          (setq gnus-message-buffer (current-buffer))
369          (set (make-local-variable 'gnus-message-group-art)
370               (cons ,group ,article))
371          (set (make-local-variable 'gnus-newsgroup-name) ,group)
372          (gnus-run-hooks 'gnus-message-setup-hook)
373          (if (eq major-mode 'message-mode)
374              (let ((mbl1 mml-buffer-list))
375                (setq mml-buffer-list mbl)  ;; Global value
376                (set (make-local-variable 'mml-buffer-list) mbl1);; Local value
377                ;; LOCAL argument of add-hook differs between GNU Emacs
378                ;; and XEmacs. make-local-hook makes sure they are local.
379                (make-local-hook 'kill-buffer-hook)
380                (make-local-hook 'change-major-mode-hook)
381                (add-hook 'change-major-mode-hook 'mml-destroy-buffers nil t)
382                (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))
383            (mml-destroy-buffers)
384            (setq mml-buffer-list mbl)))
385        (gnus-add-buffer)
386        (gnus-configure-windows ,config t)
387        (run-hooks 'post-command-hook)
388        (set-buffer-modified-p nil))))
389
390 (defun gnus-inews-insert-draft-meta-information (group article)
391   (save-excursion
392     (when (and group
393                (not (string= group ""))
394                (not (message-fetch-field gnus-draft-meta-information-header)))
395       (goto-char (point-min))
396       (insert gnus-draft-meta-information-header ": (\"" group "\" "
397               (if article (number-to-string
398                            (if (listp article)
399                                (car article)
400                              article)) "\"\"")
401               ")\n"))))
402
403 ;;;###autoload
404 (defun gnus-msg-mail (&optional to subject other-headers continue
405                                 switch-action yank-action send-actions)
406   "Start editing a mail message to be sent.
407 Like `message-mail', but with Gnus paraphernalia, particularly the
408 Gcc: header for archiving purposes."
409   (interactive)
410   (let ((buf (current-buffer))
411         mail-buf)
412     (gnus-setup-message 'message
413       (message-mail to subject other-headers continue
414                     nil yank-action send-actions))
415     (when switch-action
416       (setq mail-buf (current-buffer))
417       (switch-to-buffer buf)
418       (apply switch-action mail-buf nil)))
419   ;; COMPOSEFUNC should return t if succeed.  Undocumented ???
420   t)
421
422 (defvar save-selected-window-window)
423
424 ;;;###autoload
425 (defun gnus-button-mailto (address)
426   "Mail to ADDRESS."
427   (set-buffer (gnus-copy-article-buffer))
428   (gnus-setup-message 'message
429     (message-reply address))
430   (and (boundp 'save-selected-window-window)
431        (not (window-live-p save-selected-window-window))
432        (setq save-selected-window-window (selected-window))))
433
434 ;;;###autoload
435 (defun gnus-button-reply (&optional to-address wide)
436   "Like `message-reply'."
437   (interactive)
438   (gnus-setup-message 'message
439     (message-reply to-address wide))
440   (and (boundp 'save-selected-window-window)
441        (not (window-live-p save-selected-window-window))
442        (setq save-selected-window-window (selected-window))))
443
444 ;;;###autoload
445 (define-mail-user-agent 'gnus-user-agent
446   'gnus-msg-mail 'message-send-and-exit
447   'message-kill-buffer 'message-send-hook)
448
449 (defun gnus-setup-posting-charset (group)
450   (let ((alist gnus-group-posting-charset-alist)
451         (group (or group ""))
452         elem)
453     (when group
454       (catch 'found
455         (while (setq elem (pop alist))
456           (when (or (and (stringp (car elem))
457                          (string-match (car elem) group))
458                     (and (gnus-functionp (car elem))
459                          (funcall (car elem) group))
460                     (and (symbolp (car elem))
461                          (symbol-value (car elem))))
462             (throw 'found (cons (cadr elem) (caddr elem)))))))))
463
464 (defun gnus-inews-add-send-actions (winconf buffer article &optional config)
465   (make-local-hook 'message-sent-hook)
466   (add-hook 'message-sent-hook (if gnus-agent 'gnus-agent-possibly-do-gcc
467                                  'gnus-inews-do-gcc) nil t)
468   (when gnus-agent
469     (make-local-hook 'message-header-hook)
470     (add-hook 'message-header-hook 'gnus-agent-possibly-save-gcc nil t))
471   (setq message-post-method
472         `(lambda (arg)
473            (gnus-post-method arg ,gnus-newsgroup-name)))
474   (setq message-newsreader (setq message-mailer (gnus-extended-version)))
475   (message-add-action
476    `(set-window-configuration ,winconf) 'exit 'postpone 'kill)
477   (message-add-action
478    `(when (gnus-buffer-exists-p ,buffer)
479       (save-excursion
480         (set-buffer ,buffer)
481         ,(when article
482            (if (eq config 'forward)
483                `(gnus-summary-mark-article-as-forwarded ',article)
484              `(gnus-summary-mark-article-as-replied ',article)))))
485    'send))
486
487 (put 'gnus-setup-message 'lisp-indent-function 1)
488 (put 'gnus-setup-message 'edebug-form-spec '(form body))
489
490 ;;; Post news commands of Gnus group mode and summary mode
491
492 (defun gnus-group-mail (&optional arg)
493   "Start composing a mail.
494 If ARG, use the group under the point to find a posting style.
495 If ARG is 1, prompt for a group name to find the posting style."
496   (interactive "P")
497   ;; We can't `let' gnus-newsgroup-name here, since that leads
498   ;; to local variables leaking.
499   (let ((group gnus-newsgroup-name)
500         ;; make sure last viewed article doesn't affect posting styles:
501         (gnus-article-copy)
502         (buffer (current-buffer)))
503     (unwind-protect
504         (progn
505           (setq gnus-newsgroup-name
506                 (if arg
507                     (if (= 1 (prefix-numeric-value arg))
508                         (completing-read "Use posting style of group: "
509                                          gnus-active-hashtb nil
510                                          (gnus-read-active-file-p))
511                       (gnus-group-group-name))
512                   ""))
513           ;; #### see comment in gnus-setup-message -- drv
514           (gnus-setup-message 'message (message-mail)))
515       (save-excursion
516         (set-buffer buffer)
517         (setq gnus-newsgroup-name group)))))
518
519 (defun gnus-group-news (&optional arg)
520   "Start composing a news.
521 If ARG, post to group under point.
522 If ARG is 1, prompt for group name to post to.
523
524 This function prepares a news even when using mail groups.  This is useful
525 for posting messages to mail groups without actually sending them over the
526 network.  The corresponding backend must have a 'request-post method."
527   (interactive "P")
528   ;; We can't `let' gnus-newsgroup-name here, since that leads
529   ;; to local variables leaking.
530   (let ((group gnus-newsgroup-name)
531         ;; make sure last viewed article doesn't affect posting styles:
532         (gnus-article-copy)
533         (buffer (current-buffer)))
534     (unwind-protect
535         (progn
536           (setq gnus-newsgroup-name
537                 (if arg
538                     (if (= 1 (prefix-numeric-value arg))
539                         (completing-read "Use group: "
540                                          gnus-active-hashtb nil
541                                          (gnus-read-active-file-p))
542                       (gnus-group-group-name))
543                   ""))
544           ;; #### see comment in gnus-setup-message -- drv
545           (gnus-setup-message 'message
546             (message-news (gnus-group-real-name gnus-newsgroup-name))))
547       (save-excursion
548         (set-buffer buffer)
549         (setq gnus-newsgroup-name group)))))
550
551 (defun gnus-group-post-news (&optional arg)
552   "Start composing a message (a news by default).
553 If ARG, post to group under point.  If ARG is 1, prompt for group name.
554 Depending on the selected group, the message might be either a mail or
555 a news."
556   (interactive "P")
557   ;; Bind this variable here to make message mode hooks work ok.
558   (let ((gnus-newsgroup-name
559          (if arg
560              (if (= 1 (prefix-numeric-value arg))
561                  (completing-read "Newsgroup: " gnus-active-hashtb nil
562                                   (gnus-read-active-file-p))
563                (gnus-group-group-name))
564            ""))
565         ;; make sure last viewed article doesn't affect posting styles:
566         (gnus-article-copy))
567     (gnus-post-news 'post gnus-newsgroup-name)))
568
569 (defun gnus-summary-mail-other-window (&optional arg)
570   "Start composing a mail in another window.
571 Use the posting of the current group by default.
572 If ARG, don't do that.  If ARG is 1, prompt for group name to find the
573 posting style."
574   (interactive "P")
575   ;; We can't `let' gnus-newsgroup-name here, since that leads
576   ;; to local variables leaking.
577   (let ((group gnus-newsgroup-name)
578         ;; make sure last viewed article doesn't affect posting styles:
579         (gnus-article-copy)
580         (buffer (current-buffer)))
581     (unwind-protect
582         (progn
583           (setq gnus-newsgroup-name
584                 (if arg
585                     (if (= 1 (prefix-numeric-value arg))
586                         (completing-read "Use group: "
587                                          gnus-active-hashtb nil
588                                          (gnus-read-active-file-p))
589                       "")
590                   gnus-newsgroup-name))
591           ;; #### see comment in gnus-setup-message -- drv
592           (gnus-setup-message 'message (message-mail)))
593       (save-excursion
594         (set-buffer buffer)
595         (setq gnus-newsgroup-name group)))))
596
597 (defun gnus-summary-news-other-window (&optional arg)
598   "Start composing a news in another window.
599 Post to the current group by default.
600 If ARG, don't do that.  If ARG is 1, prompt for group name to post to.
601
602 This function prepares a news even when using mail groups.  This is useful
603 for posting messages to mail groups without actually sending them over the
604 network.  The corresponding backend must have a 'request-post method."
605   (interactive "P")
606   ;; We can't `let' gnus-newsgroup-name here, since that leads
607   ;; to local variables leaking.
608   (let ((group gnus-newsgroup-name)
609         ;; make sure last viewed article doesn't affect posting styles:
610         (gnus-article-copy)
611         (buffer (current-buffer)))
612     (unwind-protect
613         (progn
614           (setq gnus-newsgroup-name
615                 (if arg
616                     (if (= 1 (prefix-numeric-value arg))
617                         (completing-read "Use group: "
618                                          gnus-active-hashtb nil
619                                          (gnus-read-active-file-p))
620                       "")
621                   gnus-newsgroup-name))
622           ;; #### see comment in gnus-setup-message -- drv
623           (gnus-setup-message 'message
624             (message-news (gnus-group-real-name gnus-newsgroup-name))))
625       (save-excursion
626         (set-buffer buffer)
627         (setq gnus-newsgroup-name group)))))
628
629 (defun gnus-summary-post-news (&optional arg)
630   "Start composing a message.  Post to the current group by default.
631 If ARG, don't do that.  If ARG is 1, prompt for a group name to post to.
632 Depending on the selected group, the message might be either a mail or
633 a news."
634   (interactive "P")
635   ;; Bind this variable here to make message mode hooks work ok.
636   (let ((gnus-newsgroup-name
637          (if arg
638              (if (= 1 (prefix-numeric-value arg))
639                  (completing-read "Newsgroup: " gnus-active-hashtb nil
640                                   (gnus-read-active-file-p))
641                "")
642            gnus-newsgroup-name))
643         ;; make sure last viewed article doesn't affect posting styles:
644         (gnus-article-copy))
645     (gnus-post-news 'post gnus-newsgroup-name)))
646
647
648 (defun gnus-summary-followup (yank &optional force-news)
649   "Compose a followup to an article.
650 If prefix argument YANK is non-nil, the original article is yanked
651 automatically.
652 YANK is a list of elements, where the car of each element is the
653 article number, and the two following numbers is the region to be
654 yanked."
655   (interactive
656    (list (and current-prefix-arg
657               (gnus-summary-work-articles 1))))
658   (when yank
659     (gnus-summary-goto-subject
660      (if (listp (car yank))
661          (caar yank)
662        (car yank))))
663   (save-window-excursion
664     (gnus-summary-select-article))
665   (let ((headers (gnus-summary-article-header (gnus-summary-article-number)))
666         (gnus-newsgroup-name gnus-newsgroup-name))
667     ;; Send a followup.
668     (gnus-post-news nil gnus-newsgroup-name
669                     headers gnus-article-buffer
670                     yank nil force-news)
671     (gnus-summary-handle-replysign)))
672
673 (defun gnus-summary-followup-with-original (n &optional force-news)
674   "Compose a followup to an article and include the original article."
675   (interactive "P")
676   (gnus-summary-followup (gnus-summary-work-articles n) force-news))
677
678 (defun gnus-summary-followup-to-mail (&optional arg)
679   "Followup to the current mail message via news."
680   (interactive
681    (list (and current-prefix-arg
682               (gnus-summary-work-articles 1))))
683   (gnus-summary-followup arg t))
684
685 (defun gnus-summary-followup-to-mail-with-original (&optional arg)
686   "Followup to the current mail message via news."
687   (interactive "P")
688   (gnus-summary-followup (gnus-summary-work-articles arg) t))
689
690 (defun gnus-inews-yank-articles (articles)
691   (let (beg article yank-string)
692     (message-goto-body)
693     (while (setq article (pop articles))
694       (when (listp article)
695         (setq yank-string (nth 1 article)
696               article (nth 0 article)))
697       (save-window-excursion
698         (set-buffer gnus-summary-buffer)
699         (gnus-summary-select-article nil nil nil article)
700         (gnus-summary-remove-process-mark article))
701       (gnus-copy-article-buffer nil yank-string)
702       (let ((message-reply-buffer gnus-article-copy)
703             (message-reply-headers
704              ;; The headers are decoded.
705              (with-current-buffer gnus-article-copy
706                (save-restriction
707                  (nnheader-narrow-to-headers)
708                  (ietf-drums-unfold-fws)
709                  (nnheader-parse-head t)))))
710         (message-yank-original)
711         (setq beg (or beg (mark t))))
712       (when articles
713         (insert "\n")))
714     (push-mark)
715     (goto-char beg)))
716
717 (defun gnus-summary-cancel-article (&optional n symp)
718   "Cancel an article you posted.
719 Uses the process-prefix convention.  If given the symbolic
720 prefix `a', cancel using the standard posting method; if not
721 post using the current select method."
722   (interactive (gnus-interactive "P\ny"))
723   (let ((articles (gnus-summary-work-articles n))
724         (message-post-method
725          `(lambda (arg)
726             (gnus-post-method (eq ',symp 'a) ,gnus-newsgroup-name)))
727         article)
728     (while (setq article (pop articles))
729       (when (gnus-summary-select-article t nil nil article)
730         (when (gnus-eval-in-buffer-window gnus-original-article-buffer
731                 (message-cancel-news))
732           (gnus-summary-mark-as-read article gnus-canceled-mark)
733           (gnus-cache-remove-article 1))
734         (gnus-article-hide-headers-if-wanted))
735       (gnus-summary-remove-process-mark article))))
736
737 (defun gnus-summary-supersede-article ()
738   "Compose an article that will supersede a previous article.
739 This is done simply by taking the old article and adding a Supersedes
740 header line with the old Message-ID."
741   (interactive)
742   (let ((article (gnus-summary-article-number)))
743     (gnus-setup-message 'reply-yank
744       (gnus-summary-select-article t)
745       (set-buffer gnus-original-article-buffer)
746       (message-supersede)
747       (push
748        `((lambda ()
749            (when (gnus-buffer-exists-p ,gnus-summary-buffer)
750              (save-excursion
751                (set-buffer ,gnus-summary-buffer)
752                (gnus-cache-possibly-remove-article ,article nil nil nil t)
753                (gnus-summary-mark-as-read ,article gnus-canceled-mark)))))
754        message-send-actions))))
755
756 \f
757
758 (defun gnus-copy-article-buffer (&optional article-buffer yank-string)
759   ;; make a copy of the article buffer with all text properties removed
760   ;; this copy is in the buffer gnus-article-copy.
761   ;; if ARTICLE-BUFFER is nil, gnus-article-buffer is used
762   ;; this buffer should be passed to all mail/news reply/post routines.
763   (setq gnus-article-copy (gnus-get-buffer-create " *gnus article copy*"))
764   (save-excursion
765     (set-buffer gnus-article-copy)
766     (mm-enable-multibyte))
767   (let ((article-buffer (or article-buffer gnus-article-buffer))
768         end beg)
769     (if (not (and (get-buffer article-buffer)
770                   (gnus-buffer-exists-p article-buffer)))
771         (error "Can't find any article buffer")
772       (save-excursion
773         (set-buffer article-buffer)
774         (let ((gnus-newsgroup-charset (or gnus-article-charset
775                                           gnus-newsgroup-charset))
776               (gnus-newsgroup-ignored-charsets
777                (or gnus-article-ignored-charsets
778                    gnus-newsgroup-ignored-charsets)))
779           (save-restriction
780             ;; Copy over the (displayed) article buffer, delete
781             ;; hidden text and remove text properties.
782             (widen)
783             (copy-to-buffer gnus-article-copy (point-min) (point-max))
784             (set-buffer gnus-article-copy)
785             (when yank-string
786               (message-goto-body)
787               (delete-region (point) (point-max))
788               (insert yank-string))
789             (gnus-article-delete-text-of-type 'annotation)
790             (gnus-remove-text-with-property 'gnus-prev)
791             (gnus-remove-text-with-property 'gnus-next)
792             (gnus-remove-text-with-property 'gnus-decoration)
793             (insert
794              (prog1
795                  (buffer-substring-no-properties (point-min) (point-max))
796                (erase-buffer)))
797             ;; Find the original headers.
798             (set-buffer gnus-original-article-buffer)
799             (goto-char (point-min))
800             (while (looking-at message-unix-mail-delimiter)
801               (forward-line 1))
802             (setq beg (point)
803                   end (or (message-goto-body) beg))
804             ;; Delete the headers from the displayed articles.
805             (set-buffer gnus-article-copy)
806             (delete-region (goto-char (point-min))
807                            (or (message-goto-body) (point-max)))
808             ;; Insert the original article headers.
809             (insert-buffer-substring gnus-original-article-buffer beg end)
810             ;; Decode charsets.
811             (let ((gnus-article-decode-hook
812                    (delq 'article-decode-charset
813                          (copy-sequence gnus-article-decode-hook))))
814               (run-hooks 'gnus-article-decode-hook)))))
815       gnus-article-copy)))
816
817 (defun gnus-post-news (post &optional group header article-buffer yank subject
818                             force-news)
819   (when article-buffer
820     (gnus-copy-article-buffer))
821   (let ((gnus-article-reply (and article-buffer (gnus-summary-article-number)))
822         (add-to-list gnus-add-to-list))
823     (gnus-setup-message (cond (yank 'reply-yank)
824                               (article-buffer 'reply)
825                               (t 'message))
826       (let* ((group (or group gnus-newsgroup-name))
827              (charset (gnus-group-name-charset nil group))
828              (pgroup group)
829              to-address to-group mailing-list to-list
830              newsgroup-p)
831         (when group
832           (setq to-address (gnus-parameter-to-address group)
833                 to-group (gnus-group-find-parameter group 'to-group)
834                 to-list (gnus-parameter-to-list group)
835                 newsgroup-p (gnus-group-find-parameter group 'newsgroup)
836                 mailing-list (when gnus-mailing-list-groups
837                                (string-match gnus-mailing-list-groups group))
838                 group (gnus-group-name-decode (gnus-group-real-name group)
839                                               charset)))
840         (if (or (and to-group
841                      (gnus-news-group-p to-group))
842                 newsgroup-p
843                 force-news
844                 (and (gnus-news-group-p
845                       (or pgroup gnus-newsgroup-name)
846                       (or header gnus-current-article))
847                      (not mailing-list)
848                      (not to-list)
849                      (not to-address)))
850             ;; This is news.
851             (if post
852                 (message-news (or to-group group))
853               (set-buffer gnus-article-copy)
854               (gnus-msg-treat-broken-reply-to)
855               (message-followup (if (or newsgroup-p force-news)
856                                     (if (save-restriction
857                                           (article-narrow-to-head)
858                                           (message-fetch-field "newsgroups"))
859                                         nil
860                                       "")
861                                   to-group)))
862           ;; The is mail.
863           (if post
864               (progn
865                 (message-mail (or to-address to-list))
866                 ;; Arrange for mail groups that have no `to-address' to
867                 ;; get that when the user sends off the mail.
868                 (when (and (not to-list)
869                            (not to-address)
870                            add-to-list)
871                   (push (list 'gnus-inews-add-to-address pgroup)
872                         message-send-actions)))
873             (set-buffer gnus-article-copy)
874             (gnus-msg-treat-broken-reply-to)
875             (message-wide-reply to-address)))
876         (when yank
877           (gnus-inews-yank-articles yank))))))
878
879 (defun gnus-msg-treat-broken-reply-to (&optional force)
880   "Remove the Reply-to header iff broken-reply-to."
881   (when (or force
882             (gnus-group-find-parameter
883              gnus-newsgroup-name 'broken-reply-to))
884     (save-restriction
885       (message-narrow-to-head)
886       (message-remove-header "reply-to"))))
887
888 (defun gnus-post-method (arg group &optional silent)
889   "Return the posting method based on GROUP and ARG.
890 If SILENT, don't prompt the user."
891   (let ((gnus-post-method (or (gnus-parameter-post-method group)
892                               gnus-post-method))
893         (group-method (gnus-find-method-for-group group)))
894     (cond
895      ;; If the group-method is nil (which shouldn't happen) we use
896      ;; the default method.
897      ((null group-method)
898       (or (and (listp gnus-post-method) ;If not current/native/nil
899                (not (listp (car gnus-post-method))) ; and not a list of methods
900                gnus-post-method)        ;then use it.
901           gnus-select-method
902           message-post-method))
903      ;; We want the inverse of the default
904      ((and arg (not (eq arg 0)))
905       (if (eq gnus-post-method 'current)
906           gnus-select-method
907         group-method))
908      ;; We query the user for a post method.
909      ((or arg
910           (and (listp gnus-post-method)
911                (listp (car gnus-post-method))))
912       (let* ((methods
913               ;; Collect all methods we know about.
914               (append
915                (when (listp gnus-post-method)
916                  (if (listp (car gnus-post-method))
917                      gnus-post-method
918                    (list gnus-post-method)))
919                gnus-secondary-select-methods
920                (mapcar 'cdr gnus-server-alist)
921                (mapcar 'car gnus-opened-servers)
922                (list gnus-select-method)
923                (list group-method)))
924              method-alist post-methods method)
925         ;; Weed out all mail methods.
926         (while methods
927           (setq method (gnus-server-get-method "" (pop methods)))
928           (when (and (or (gnus-method-option-p method 'post)
929                          (gnus-method-option-p method 'post-mail))
930                      (not (member method post-methods)))
931             (push method post-methods)))
932         ;; Create a name-method alist.
933         (setq method-alist
934               (mapcar
935                (lambda (m)
936                  (if (equal (cadr m) "")
937                      (list (symbol-name (car m)) m)
938                    (list (concat (cadr m) " (" (symbol-name (car m)) ")") m)))
939                post-methods))
940         ;; Query the user.
941         (cadr
942          (assoc
943           (setq gnus-last-posting-server
944                 (if (and silent
945                          gnus-last-posting-server)
946                     ;; Just use the last value.
947                     gnus-last-posting-server
948                   (completing-read
949                    "Posting method: " method-alist nil t
950                    (cons (or gnus-last-posting-server "") 0))))
951           method-alist))))
952      ;; Override normal method.
953      ((and (eq gnus-post-method 'current)
954            (not (memq (car group-method) gnus-discouraged-post-methods))
955            (gnus-get-function group-method 'request-post t))
956       (assert (not arg))
957       group-method)
958      ;; Use gnus-post-method.
959      ((listp gnus-post-method)          ;A method...
960       (assert (not (listp (car gnus-post-method)))) ;... not a list of methods.
961       gnus-post-method)
962      ;; Use the normal select method (nil or native).
963      (t gnus-select-method))))
964
965 \f
966
967 ;; Dummies to avoid byte-compile warning.
968 (eval-when-compile
969   (defvar nnspool-rejected-article-hook)
970   (defvar xemacs-codename))
971
972 (defun gnus-extended-version ()
973   "Stringified Gnus version and Emacs version."
974   (interactive)
975   (concat
976    "Gnus/" (prin1-to-string (gnus-continuum-version gnus-version) t)
977    " (" gnus-version ")"
978    " "
979    (cond
980     ((string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version)
981      (concat "Emacs/" (match-string 1 emacs-version)
982              " (" system-configuration ")"))
983     ((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
984                    emacs-version)
985      (concat (match-string 1 emacs-version)
986              (format "/%d.%d" emacs-major-version emacs-minor-version)
987              (if (match-beginning 3)
988                  (match-string 3 emacs-version)
989                "")
990              (if (boundp 'xemacs-codename)
991                  (concat " (" xemacs-codename ", " system-configuration ")")
992                "")))
993     (t emacs-version))))
994
995 \f
996 ;;;
997 ;;; Gnus Mail Functions
998 ;;;
999
1000 ;;; Mail reply commands of Gnus summary mode
1001
1002 (defun gnus-summary-reply (&optional yank wide very-wide)
1003   "Start composing a mail reply to the current message.
1004 If prefix argument YANK is non-nil, the original article is yanked
1005 automatically.
1006 If WIDE, make a wide reply.
1007 If VERY-WIDE, make a very wide reply."
1008   (interactive
1009    (list (and current-prefix-arg
1010               (gnus-summary-work-articles 1))))
1011   ;; Allow user to require confirmation before replying by mail to the
1012   ;; author of a news article.
1013   (when (or (not (gnus-news-group-p gnus-newsgroup-name))
1014             (not gnus-confirm-mail-reply-to-news)
1015             (y-or-n-p "Really reply by mail to article author? "))
1016     (let* ((article
1017             (if (listp (car yank))
1018                 (caar yank)
1019               (car yank)))
1020            (gnus-article-reply (or article (gnus-summary-article-number)))
1021            (headers ""))
1022       ;; Stripping headers should be specified with mail-yank-ignored-headers.
1023       (when yank
1024         (gnus-summary-goto-subject article))
1025       (gnus-setup-message (if yank 'reply-yank 'reply)
1026         (if (not very-wide)
1027             (gnus-summary-select-article)
1028           (dolist (article very-wide)
1029             (gnus-summary-select-article nil nil nil article)
1030             (save-excursion
1031               (set-buffer (gnus-copy-article-buffer))
1032               (gnus-msg-treat-broken-reply-to)
1033               (save-restriction
1034                 (message-narrow-to-head)
1035                 (setq headers (concat headers (buffer-string)))))))
1036         (set-buffer (gnus-copy-article-buffer))
1037         (gnus-msg-treat-broken-reply-to gnus-msg-force-broken-reply-to)
1038         (save-restriction
1039           (message-narrow-to-head)
1040           (when very-wide
1041             (erase-buffer)
1042             (insert headers))
1043           (goto-char (point-max)))
1044         (mml-quote-region (point) (point-max))
1045         (message-reply nil wide)
1046         (when yank
1047           (gnus-inews-yank-articles yank))
1048         (gnus-summary-handle-replysign)))))
1049
1050 (defun gnus-summary-handle-replysign ()
1051   "Check the various replysign variables and take action accordingly."
1052   (when (or gnus-message-replysign gnus-message-replyencrypt)
1053     (let (signed encrypted)
1054       (save-excursion
1055         (set-buffer gnus-article-buffer)
1056         (setq signed (memq 'signed gnus-article-wash-types))
1057         (setq encrypted (memq 'encrypted gnus-article-wash-types)))
1058       (cond ((and gnus-message-replysign signed)
1059              (mml-secure-message mml-default-sign-method 'sign))
1060             ((and gnus-message-replyencrypt encrypted)
1061              (mml-secure-message mml-default-encrypt-method
1062                                  (if gnus-message-replysignencrypted
1063                                      'signencrypt
1064                                    'encrypt)))))))
1065
1066 (defun gnus-summary-reply-with-original (n &optional wide)
1067   "Start composing a reply mail to the current message.
1068 The original article will be yanked."
1069   (interactive "P")
1070   (gnus-summary-reply (gnus-summary-work-articles n) wide))
1071
1072 (defun gnus-summary-reply-broken-reply-to (&optional yank wide very-wide)
1073   "Like `gnus-summary-reply' except removing reply-to field.
1074 If prefix argument YANK is non-nil, the original article is yanked
1075 automatically.
1076 If WIDE, make a wide reply.
1077 If VERY-WIDE, make a very wide reply."
1078   (interactive
1079    (list (and current-prefix-arg
1080               (gnus-summary-work-articles 1))))
1081   (let ((gnus-msg-force-broken-reply-to t))
1082     (gnus-summary-reply yank wide very-wide)))
1083
1084 (defun gnus-summary-reply-broken-reply-to-with-original (n &optional wide)
1085   "Like `gnus-summary-reply-with-original' except removing reply-to field.
1086 The original article will be yanked."
1087   (interactive "P")
1088   (gnus-summary-reply-broken-reply-to (gnus-summary-work-articles n) wide))
1089
1090 (defun gnus-summary-wide-reply (&optional yank)
1091   "Start composing a wide reply mail to the current message.
1092 If prefix argument YANK is non-nil, the original article is yanked
1093 automatically."
1094   (interactive
1095    (list (and current-prefix-arg
1096               (gnus-summary-work-articles 1))))
1097   (gnus-summary-reply yank t))
1098
1099 (defun gnus-summary-wide-reply-with-original (n)
1100   "Start composing a wide reply mail to the current message.
1101 The original article will be yanked."
1102   (interactive "P")
1103   (gnus-summary-reply-with-original n t))
1104
1105 (defun gnus-summary-very-wide-reply (&optional yank)
1106   "Start composing a very wide reply mail to the current message.
1107 If prefix argument YANK is non-nil, the original article is yanked
1108 automatically."
1109   (interactive
1110    (list (and current-prefix-arg
1111               (gnus-summary-work-articles 1))))
1112   (gnus-summary-reply yank t (gnus-summary-work-articles yank)))
1113
1114 (defun gnus-summary-very-wide-reply-with-original (n)
1115   "Start composing a very wide reply mail to the current message.
1116 The original article will be yanked."
1117   (interactive "P")
1118   (gnus-summary-reply
1119    (gnus-summary-work-articles n) t (gnus-summary-work-articles n)))
1120
1121 (defun gnus-summary-mail-forward (&optional arg post)
1122   "Forward the current message(s) to another user.
1123 If process marks exist, forward all marked messages;
1124 if ARG is nil, see `message-forward-as-mime' and `message-forward-show-mml';
1125 if ARG is 1, decode the message and forward directly inline;
1126 if ARG is 2, forward message as an rfc822 MIME section;
1127 if ARG is 3, decode message and forward as an rfc822 MIME section;
1128 if ARG is 4, forward message directly inline;
1129 otherwise, use flipped `message-forward-as-mime'.
1130 If POST, post instead of mail.
1131 For the `inline' alternatives, also see the variable
1132 `message-forward-ignored-headers'."
1133   (interactive "P")
1134   (if (null (cdr (gnus-summary-work-articles nil)))
1135       (let ((message-forward-as-mime message-forward-as-mime)
1136             (message-forward-show-mml message-forward-show-mml))
1137         (cond
1138          ((null arg))
1139          ((eq arg 1)
1140           (setq message-forward-as-mime nil
1141                 message-forward-show-mml t))
1142          ((eq arg 2)
1143           (setq message-forward-as-mime t
1144                 message-forward-show-mml nil))
1145          ((eq arg 3)
1146           (setq message-forward-as-mime t
1147                 message-forward-show-mml t))
1148          ((eq arg 4)
1149           (setq message-forward-as-mime nil
1150                 message-forward-show-mml nil))
1151          (t
1152           (setq message-forward-as-mime (not message-forward-as-mime))))
1153         (let ((gnus-article-reply (gnus-summary-article-number)))
1154           (gnus-setup-message 'forward
1155             (gnus-summary-select-article)
1156             (let ((mail-parse-charset
1157                    (or (and (gnus-buffer-live-p gnus-article-buffer)
1158                             (with-current-buffer gnus-article-buffer
1159                               gnus-article-charset))
1160                        gnus-newsgroup-charset))
1161                   (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
1162               (set-buffer gnus-original-article-buffer)
1163               (message-forward post)))))
1164     (gnus-uu-digest-mail-forward arg post)))
1165
1166 (defun gnus-summary-resend-message (address n)
1167   "Resend the current article to ADDRESS."
1168   (interactive
1169    (list (message-read-from-minibuffer
1170           "Resend message(s) to: "
1171           (when (and gnus-summary-resend-default-address
1172                      (gnus-buffer-live-p gnus-original-article-buffer))
1173             ;; If some other article is currently selected, the
1174             ;; initial-contents is wrong. Whatever, it is just the
1175             ;; initial-contents.
1176             (with-current-buffer gnus-original-article-buffer
1177               (nnmail-fetch-field "to"))))
1178          current-prefix-arg))
1179   (let ((articles (gnus-summary-work-articles n))
1180         article)
1181     (while (setq article (pop articles))
1182       (gnus-summary-select-article nil nil nil article)
1183       (save-excursion
1184         (set-buffer gnus-original-article-buffer)
1185         (message-resend address))
1186       (gnus-summary-mark-article-as-forwarded article))))
1187
1188 ;; From: Matthieu Moy <Matthieu.Moy@imag.fr>
1189 (defun gnus-summary-resend-message-edit ()
1190   "Resend an article that has already been sent.
1191 A new buffer will be created to allow the user to modify body and
1192 contents of the message, and then, everything will happen as when
1193 composing a new message."
1194   (interactive)
1195   (let ((article (gnus-summary-article-number)))
1196     (gnus-setup-message 'reply-yank
1197       (gnus-summary-select-article t)
1198       (set-buffer gnus-original-article-buffer)
1199       (let ((cur (current-buffer))
1200             (to (message-fetch-field "to")))
1201         ;; Get a normal message buffer.
1202         (message-pop-to-buffer (message-buffer-name "Resend" to))
1203         (insert-buffer-substring cur)
1204         (mime-to-mml)
1205         (message-narrow-to-head-1)
1206         ;; Gnus will generate a new one when sending.
1207         (message-remove-header "Message-ID")
1208         (message-remove-header message-ignored-resent-headers t)
1209         ;; Remove unwanted headers.
1210         (goto-char (point-max))
1211         (insert mail-header-separator)
1212         (goto-char (point-min))
1213         (re-search-forward "^To:\\|^Newsgroups:" nil 'move)
1214         (forward-char 1)
1215         (widen)))))
1216
1217 (defun gnus-summary-post-forward (&optional arg)
1218   "Forward the current article to a newsgroup.
1219 See `gnus-summary-mail-forward' for ARG."
1220   (interactive "P")
1221   (gnus-summary-mail-forward arg t))
1222
1223 (defvar gnus-nastygram-message
1224   "The following article was inappropriately posted to %s.\n\n"
1225   "Format string to insert in nastygrams.
1226 The current group name will be inserted at \"%s\".")
1227
1228 (defun gnus-summary-mail-nastygram (n)
1229   "Send a nastygram to the author of the current article."
1230   (interactive "P")
1231   (when (or gnus-expert-user
1232             (gnus-y-or-n-p
1233              "Really send a nastygram to the author of the current article? "))
1234     (let ((group gnus-newsgroup-name))
1235       (gnus-summary-reply-with-original n)
1236       (set-buffer gnus-message-buffer)
1237       (message-goto-body)
1238       (insert (format gnus-nastygram-message group))
1239       (message-send-and-exit))))
1240
1241 (defun gnus-summary-mail-crosspost-complaint (n)
1242   "Send a complaint about crossposting to the current article(s)."
1243   (interactive "P")
1244   (let ((articles (gnus-summary-work-articles n))
1245         article)
1246     (while (setq article (pop articles))
1247       (set-buffer gnus-summary-buffer)
1248       (gnus-summary-goto-subject article)
1249       (let ((group (gnus-group-real-name gnus-newsgroup-name))
1250             newsgroups followup-to)
1251         (gnus-summary-select-article)
1252         (set-buffer gnus-original-article-buffer)
1253         (if (and (<= (length (message-tokenize-header
1254                               (setq newsgroups
1255                                     (mail-fetch-field "newsgroups"))
1256                               ", "))
1257                      1)
1258                  (or (not (setq followup-to (mail-fetch-field "followup-to")))
1259                      (not (member group (message-tokenize-header
1260                                          followup-to ", ")))))
1261             (if followup-to
1262                 (gnus-message 1 "Followup-to restricted")
1263               (gnus-message 1 "Not a crossposted article"))
1264           (set-buffer gnus-summary-buffer)
1265           (gnus-summary-reply-with-original 1)
1266           (set-buffer gnus-message-buffer)
1267           (message-goto-body)
1268           (insert (format gnus-crosspost-complaint newsgroups group))
1269           (message-goto-subject)
1270           (re-search-forward " *$")
1271           (replace-match " (crosspost notification)" t t)
1272           (gnus-deactivate-mark)
1273           (when (gnus-y-or-n-p "Send this complaint? ")
1274             (message-send-and-exit)))))))
1275
1276 (defun gnus-mail-parse-comma-list ()
1277   (let (accumulated
1278         beg)
1279     (skip-chars-forward " ")
1280     (while (not (eobp))
1281       (setq beg (point))
1282       (skip-chars-forward "^,")
1283       (while (zerop
1284               (save-excursion
1285                 (save-restriction
1286                   (let ((i 0))
1287                     (narrow-to-region beg (point))
1288                     (goto-char beg)
1289                     (logand (progn
1290                               (while (search-forward "\"" nil t)
1291                                 (incf i))
1292                               (if (zerop i) 2 i))
1293                             2)))))
1294         (skip-chars-forward ",")
1295         (skip-chars-forward "^,"))
1296       (skip-chars-backward " ")
1297       (push (buffer-substring beg (point))
1298             accumulated)
1299       (skip-chars-forward "^,")
1300       (skip-chars-forward ", "))
1301     accumulated))
1302
1303 (defun gnus-inews-add-to-address (group)
1304   (let ((to-address (mail-fetch-field "to")))
1305     (when (and to-address
1306                (gnus-alive-p))
1307       ;; This mail group doesn't have a `to-list', so we add one
1308       ;; here.  Magic!
1309       (when (gnus-y-or-n-p
1310              (format "Do you want to add this as `to-list': %s " to-address))
1311         (gnus-group-add-parameter group (cons 'to-list to-address))))))
1312
1313 (defun gnus-put-message ()
1314   "Put the current message in some group and return to Gnus."
1315   (interactive)
1316   (let ((reply gnus-article-reply)
1317         (winconf gnus-prev-winconf)
1318         (group gnus-newsgroup-name))
1319     (unless (and group
1320                  (not (gnus-group-read-only-p group)))
1321       (setq group (read-string "Put in group: " nil (gnus-writable-groups))))
1322
1323     (when (gnus-gethash group gnus-newsrc-hashtb)
1324       (error "No such group: %s" group))
1325     (save-excursion
1326       (save-restriction
1327         (widen)
1328         (message-narrow-to-headers)
1329         (let ((gnus-deletable-headers nil))
1330           (message-generate-headers
1331            (if (message-news-p)
1332                message-required-news-headers
1333              message-required-mail-headers)))
1334         (goto-char (point-max))
1335         (insert "Gcc: " group "\n")
1336         (widen)))
1337     (gnus-inews-do-gcc)
1338     (when (and (get-buffer gnus-group-buffer)
1339                (gnus-buffer-exists-p (car-safe reply))
1340                (cdr reply))
1341       (set-buffer (car reply))
1342       (gnus-summary-mark-article-as-replied (cdr reply)))
1343     (when winconf
1344       (set-window-configuration winconf))))
1345
1346 (defun gnus-article-mail (yank)
1347   "Send a reply to the address near point.
1348 If YANK is non-nil, include the original article."
1349   (interactive "P")
1350   (let ((address
1351          (buffer-substring
1352           (save-excursion (re-search-backward "[ \t\n]" nil t) (1+ (point)))
1353           (save-excursion (re-search-forward "[ \t\n]" nil t) (1- (point))))))
1354     (when address
1355       (gnus-msg-mail address)
1356       (when yank
1357         (gnus-inews-yank-articles (list (cdr gnus-article-current)))))))
1358
1359 (defvar nntp-server-type)
1360 (defun gnus-bug ()
1361   "Send a bug report to the Gnus maintainers."
1362   (interactive)
1363   (unless (gnus-alive-p)
1364     (error "Gnus has been shut down"))
1365   (gnus-setup-message (if (message-mail-user-agent) 'message 'bug)
1366     (unless (message-mail-user-agent)
1367       (delete-other-windows)
1368       (when gnus-bug-create-help-buffer
1369         (switch-to-buffer "*Gnus Help Bug*")
1370         (erase-buffer)
1371         (insert gnus-bug-message)
1372         (goto-char (point-min)))
1373       (message-pop-to-buffer "*Gnus Bug*"))
1374     (let ((message-this-is-mail t))
1375       (message-setup `((To . ,gnus-maintainer) (Subject . ""))))
1376     (when gnus-bug-create-help-buffer
1377       (push `(gnus-bug-kill-buffer) message-send-actions))
1378     (goto-char (point-min))
1379     (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
1380     (forward-line 1)
1381     (insert (gnus-version) "\n"
1382             (emacs-version) "\n")
1383     (when (and (boundp 'nntp-server-type)
1384                (stringp nntp-server-type))
1385       (insert nntp-server-type))
1386     (insert "\n\n\n\n\n")
1387     (let (text)
1388       (save-excursion
1389         (set-buffer (gnus-get-buffer-create " *gnus environment info*"))
1390         (erase-buffer)
1391         (gnus-debug)
1392         (setq text (buffer-string)))
1393       (insert "<#part type=application/emacs-lisp disposition=inline description=\"User settings\">\n" text "\n<#/part>"))
1394     (goto-char (point-min))
1395     (search-forward "Subject: " nil t)
1396     (message "")))
1397
1398 (defun gnus-bug-kill-buffer ()
1399   (when (get-buffer "*Gnus Help Bug*")
1400     (kill-buffer "*Gnus Help Bug*")))
1401
1402 (defun gnus-summary-yank-message (buffer n)
1403   "Yank the current article into a composed message."
1404   (interactive
1405    (list (completing-read "Buffer: " (mapcar 'list (message-buffers)) nil t)
1406          current-prefix-arg))
1407   (gnus-summary-iterate n
1408     (let ((gnus-display-mime-function nil)
1409           (gnus-inhibit-treatment t))
1410       (gnus-summary-select-article))
1411     (save-excursion
1412       (set-buffer buffer)
1413       (message-yank-buffer gnus-article-buffer))))
1414
1415 (defun gnus-debug ()
1416   "Attempts to go through the Gnus source file and report what variables have been changed.
1417 The source file has to be in the Emacs load path."
1418   (interactive)
1419   (let ((files gnus-debug-files)
1420         (point (point))
1421         file expr olist sym)
1422     (gnus-message 4 "Please wait while we snoop your variables...")
1423     (sit-for 0)
1424     ;; Go through all the files looking for non-default values for variables.
1425     (save-excursion
1426       (set-buffer (gnus-get-buffer-create " *gnus bug info*"))
1427       (while files
1428         (erase-buffer)
1429         (when (and (setq file (locate-library (pop files)))
1430                    (file-exists-p file))
1431           (insert-file-contents file)
1432           (goto-char (point-min))
1433           (if (not (re-search-forward "^;;* *Internal variables" nil t))
1434               (gnus-message 4 "Malformed sources in file %s" file)
1435             (narrow-to-region (point-min) (point))
1436             (goto-char (point-min))
1437             (while (setq expr (ignore-errors (read (current-buffer))))
1438               (ignore-errors
1439                 (and (or (eq (car expr) 'defvar)
1440                          (eq (car expr) 'defcustom))
1441                      (stringp (nth 3 expr))
1442                      (not (memq (nth 1 expr) gnus-debug-exclude-variables))
1443                      (or (not (boundp (nth 1 expr)))
1444                          (not (equal (eval (nth 2 expr))
1445                                      (symbol-value (nth 1 expr)))))
1446                      (push (nth 1 expr) olist)))))))
1447       (kill-buffer (current-buffer)))
1448     (when (setq olist (nreverse olist))
1449       (insert "------------------ Environment follows ------------------\n\n"))
1450     (while olist
1451       (if (boundp (car olist))
1452           (condition-case ()
1453               (pp `(setq ,(car olist)
1454                          ,(if (or (consp (setq sym (symbol-value (car olist))))
1455                                   (and (symbolp sym)
1456                                        (not (or (eq sym nil)
1457                                                 (eq sym t)))))
1458                               (list 'quote (symbol-value (car olist)))
1459                             (symbol-value (car olist))))
1460                   (current-buffer))
1461             (error
1462              (format "(setq %s 'whatever)\n" (car olist))))
1463         (insert ";; (makeunbound '" (symbol-name (car olist)) ")\n"))
1464       (setq olist (cdr olist)))
1465     (insert "\n\n")
1466     ;; Remove any control chars - they seem to cause trouble for some
1467     ;; mailers.  (Byte-compiled output from the stuff above.)
1468     (goto-char point)
1469     (while (re-search-forward "[\000-\010\013-\037\200-\237]" nil t)
1470       (replace-match (format "\\%03o" (string-to-char (match-string 0)))
1471                      t t))))
1472
1473 ;;; Treatment of rejected articles.
1474 ;;; Bounced mail.
1475
1476 (defun gnus-summary-resend-bounced-mail (&optional fetch)
1477   "Re-mail the current message.
1478 This only makes sense if the current message is a bounce message than
1479 contains some mail you have written which has been bounced back to
1480 you.
1481 If FETCH, try to fetch the article that this is a reply to, if indeed
1482 this is a reply."
1483   (interactive "P")
1484   (gnus-summary-select-article t)
1485   (set-buffer gnus-original-article-buffer)
1486   (gnus-setup-message 'compose-bounce
1487     (let* ((references (mail-fetch-field "references"))
1488            (parent (and references (gnus-parent-id references))))
1489       (message-bounce)
1490       ;; If there are references, we fetch the article we answered to.
1491       (and fetch parent
1492            (gnus-summary-refer-article parent)
1493            (gnus-summary-show-all-headers)))))
1494
1495 ;;; Gcc handling.
1496
1497 (defun gnus-inews-group-method (group)
1498   (cond
1499    ;; If the group doesn't exist, we assume
1500    ;; it's an archive group...
1501    ((and (null (gnus-get-info group))
1502          (eq (car (gnus-server-to-method gnus-message-archive-method))
1503              (car (gnus-server-to-method (gnus-group-method group)))))
1504     gnus-message-archive-method)
1505    ;; Use the method.
1506    ((gnus-info-method (gnus-get-info group))
1507     (gnus-info-method (gnus-get-info group)))
1508    ;; Find the method.
1509    (t (gnus-server-to-method (gnus-group-method group)))))
1510
1511 ;; Do Gcc handling, which copied the message over to some group.
1512 (defun gnus-inews-do-gcc (&optional gcc)
1513   (interactive)
1514   (save-excursion
1515     (save-restriction
1516       (message-narrow-to-headers)
1517       (let ((gcc (or gcc (mail-fetch-field "gcc" nil t)))
1518             (cur (current-buffer))
1519             groups group method group-art
1520             mml-externalize-attachments)
1521         (when gcc
1522           (message-remove-header "gcc")
1523           (widen)
1524           (setq groups (message-unquote-tokens
1525                         (message-tokenize-header gcc " ,")))
1526           ;; Copy the article over to some group(s).
1527           (while (setq group (pop groups))
1528             (unless (gnus-check-server
1529                      (setq method (gnus-inews-group-method group)))
1530               (error "Can't open server %s" (if (stringp method) method
1531                                               (car method))))
1532             (unless (gnus-request-group group nil method)
1533               (gnus-request-create-group group method))
1534             (setq mml-externalize-attachments
1535                   (if (stringp gnus-gcc-externalize-attachments)
1536                       (string-match gnus-gcc-externalize-attachments group)
1537                     gnus-gcc-externalize-attachments))
1538             (save-excursion
1539               (nnheader-set-temp-buffer " *acc*")
1540               (insert-buffer-substring cur)
1541               (message-encode-message-body)
1542               (save-restriction
1543                 (message-narrow-to-headers)
1544                 (let* ((mail-parse-charset message-default-charset)
1545                        (newsgroups-field (save-restriction
1546                                            (message-narrow-to-headers-or-head)
1547                                            (message-fetch-field "Newsgroups")))
1548                        (followup-field (save-restriction
1549                                          (message-narrow-to-headers-or-head)
1550                                          (message-fetch-field "Followup-To")))
1551                        ;; BUG: We really need to get the charset for
1552                        ;; each name in the Newsgroups and Followup-To
1553                        ;; lines to allow crossposting between group
1554                        ;; namess with incompatible character sets.
1555                        ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2001-10-08.
1556                        (group-field-charset
1557                         (gnus-group-name-charset
1558                          method (or newsgroups-field "")))
1559                        (followup-field-charset
1560                         (gnus-group-name-charset
1561                          method (or followup-field "")))
1562                        (rfc2047-header-encoding-alist
1563                         (append
1564                          (when group-field-charset
1565                            (list (cons "Newsgroups" group-field-charset)))
1566                          (when followup-field-charset
1567                            (list (cons "Followup-To" followup-field-charset)))
1568                          rfc2047-header-encoding-alist)))
1569                   (mail-encode-encoded-word-buffer)))
1570               (goto-char (point-min))
1571               (when (re-search-forward
1572                      (concat "^" (regexp-quote mail-header-separator) "$")
1573                      nil t)
1574                 (replace-match "" t t ))
1575               (unless (setq group-art
1576                             (gnus-request-accept-article group method t t))
1577                 (gnus-message 1 "Couldn't store article in group %s: %s"
1578                               group (gnus-status-message method))
1579                 (sit-for 2))
1580               (when (and group-art
1581                          (or gnus-gcc-mark-as-read
1582                              gnus-inews-mark-gcc-as-read))
1583                 (gnus-group-mark-article-read group (cdr group-art)))
1584               (kill-buffer (current-buffer)))))))))
1585
1586 (defun gnus-inews-insert-gcc ()
1587   "Insert Gcc headers based on `gnus-outgoing-message-group'."
1588   (save-excursion
1589     (save-restriction
1590       (message-narrow-to-headers)
1591       (let* ((group gnus-outgoing-message-group)
1592              (gcc (cond
1593                    ((gnus-functionp group)
1594                     (funcall group))
1595                    ((or (stringp group) (list group))
1596                     group))))
1597         (when gcc
1598           (insert "Gcc: "
1599                   (if (stringp gcc) gcc
1600                     (mapconcat 'identity gcc " "))
1601                   "\n"))))))
1602
1603 (defun gnus-inews-insert-archive-gcc (&optional group)
1604   "Insert the Gcc to say where the article is to be archived."
1605   (let* ((var gnus-message-archive-group)
1606          (group (or group gnus-newsgroup-name ""))
1607          (gcc-self-val
1608           (and gnus-newsgroup-name
1609                (not (equal gnus-newsgroup-name ""))
1610                (gnus-group-find-parameter
1611                 gnus-newsgroup-name 'gcc-self)))
1612          result
1613          (groups
1614           (cond
1615            ((null gnus-message-archive-method)
1616             ;; Ignore.
1617             nil)
1618            ((stringp var)
1619             ;; Just a single group.
1620             (list var))
1621            ((null var)
1622             ;; We don't want this.
1623             nil)
1624            ((and (listp var) (stringp (car var)))
1625             ;; A list of groups.
1626             var)
1627            ((gnus-functionp var)
1628             ;; A function.
1629             (funcall var group))
1630            (t
1631             ;; An alist of regexps/functions/forms.
1632             (while (and var
1633                         (not
1634                          (setq result
1635                                (cond
1636                                 ((stringp (caar var))
1637                                  ;; Regexp.
1638                                  (when (string-match (caar var) group)
1639                                    (cdar var)))
1640                                 ((gnus-functionp (car var))
1641                                  ;; Function.
1642                                  (funcall (car var) group))
1643                                 (t
1644                                  (eval (car var)))))))
1645               (setq var (cdr var)))
1646             result)))
1647          name)
1648     (when (or groups gcc-self-val)
1649       (when (stringp groups)
1650         (setq groups (list groups)))
1651       (save-excursion
1652         (save-restriction
1653           (message-narrow-to-headers)
1654           (goto-char (point-max))
1655           (insert "Gcc: ")
1656           (if gcc-self-val
1657               ;; Use the `gcc-self' param value instead.
1658               (progn
1659                 (insert
1660                  (if (stringp gcc-self-val)
1661                      gcc-self-val
1662                    group))
1663                 (if (not (eq gcc-self-val 'none))
1664                     (insert "\n")
1665                   (progn
1666                     (beginning-of-line)
1667                     (kill-line))))
1668             ;; Use the list of groups.
1669             (while (setq name (pop groups))
1670               (insert (if (string-match ":" name)
1671                           name
1672                         (gnus-group-prefixed-name
1673                          name gnus-message-archive-method)))
1674               (when groups
1675                 (insert " ")))
1676             (insert "\n")))))))
1677
1678 ;;; Posting styles.
1679
1680 (defun gnus-configure-posting-styles (&optional group-name)
1681   "Configure posting styles according to `gnus-posting-styles'."
1682   (unless gnus-inhibit-posting-styles
1683     (let ((group (or group-name gnus-newsgroup-name ""))
1684           (styles gnus-posting-styles)
1685           style match variable attribute value v results
1686           filep name address element)
1687       ;; If the group has a posting-style parameter, add it at the end with a
1688       ;; regexp matching everything, to be sure it takes precedence over all
1689       ;; the others.
1690       (when gnus-newsgroup-name
1691         (let ((tmp-style (gnus-group-find-parameter group 'posting-style t)))
1692           (when tmp-style
1693             (setq styles (append styles (list (cons ".*" tmp-style)))))))
1694       ;; Go through all styles and look for matches.
1695       (dolist (style styles)
1696         (setq match (pop style))
1697         (goto-char (point-min))
1698         (when (cond
1699                ((stringp match)
1700                 ;; Regexp string match on the group name.
1701                 (string-match match group))
1702                ((eq match 'header)
1703                 ;; Obsolete format of header match.
1704                 (and (gnus-buffer-live-p gnus-article-copy)
1705                      (with-current-buffer gnus-article-copy
1706                        (let ((header (message-fetch-field (pop style))))
1707                          (and header
1708                               (string-match (pop style) header))))))
1709                ((or (symbolp match)
1710                     (gnus-functionp match))
1711                 (cond
1712                  ((gnus-functionp match)
1713                   ;; Function to be called.
1714                   (funcall match))
1715                  ((boundp match)
1716                   ;; Variable to be checked.
1717                   (symbol-value match))))
1718                ((listp match)
1719                 (cond
1720                  ((eq (car match) 'header)
1721                   ;; New format of header match.
1722                   (and (gnus-buffer-live-p gnus-article-copy)
1723                        (with-current-buffer gnus-article-copy
1724                          (let ((header (message-fetch-field (nth 1 match))))
1725                            (and header
1726                                 (string-match (nth 2 match) header))))))
1727                  (t
1728                   ;; This is a form to be evaled.
1729                   (eval match)))))
1730           ;; We have a match, so we set the variables.
1731           (dolist (attribute style)
1732             (setq element (pop attribute)
1733                   variable nil
1734                   filep nil)
1735             (setq value
1736                   (cond
1737                    ((eq (car attribute) :file)
1738                     (setq filep t)
1739                     (cadr attribute))
1740                    ((eq (car attribute) :value)
1741                     (cadr attribute))
1742                    (t
1743                     (car attribute))))
1744             ;; We get the value.
1745             (setq v
1746                   (cond
1747                    ((stringp value)
1748                     value)
1749                    ((or (symbolp value)
1750                         (gnus-functionp value))
1751                     (cond ((gnus-functionp value)
1752                            (funcall value))
1753                           ((boundp value)
1754                            (symbol-value value))))
1755                    ((listp value)
1756                     (eval value))))
1757             ;; Translate obsolescent value.
1758             (cond
1759              ((eq element 'signature-file)
1760               (setq element 'signature
1761                     filep t))
1762              ((eq element 'x-face-file)
1763               (setq element 'x-face
1764                     filep t)))
1765             ;; Get the contents of file elems.
1766             (when (and filep v)
1767               (setq v (with-temp-buffer
1768                         (insert-file-contents v)
1769                         (goto-char (point-max))
1770                         (while (bolp)
1771                           (delete-char -1))
1772                         (buffer-string))))
1773             (setq results (delq (assoc element results) results))
1774             (push (cons element v) results))))
1775       ;; Now we have all the styles, so we insert them.
1776       (setq name (assq 'name results)
1777             address (assq 'address results))
1778       (setq results (delq name (delq address results)))
1779       ;; make-local-hook is not obsolete in Emacs 20 or XEmacs.
1780       (make-local-hook 'message-setup-hook)
1781       (dolist (result results)
1782         (add-hook 'message-setup-hook
1783                   (cond
1784                    ((eq 'eval (car result))
1785                     'ignore)
1786                    ((eq 'body (car result))
1787                     `(lambda ()
1788                        (save-excursion
1789                          (message-goto-body)
1790                          (insert ,(cdr result)))))
1791                    ((eq 'signature (car result))
1792                     (set (make-local-variable 'message-signature) nil)
1793                     (set (make-local-variable 'message-signature-file) nil)
1794                     (if (not (cdr result))
1795                         'ignore
1796                       `(lambda ()
1797                          (save-excursion
1798                            (let ((message-signature ,(cdr result)))
1799                              (when message-signature
1800                                (message-insert-signature)))))))
1801                    (t
1802                     (let ((header
1803                            (if (symbolp (car result))
1804                                (capitalize (symbol-name (car result)))
1805                              (car result))))
1806                       `(lambda ()
1807                          (save-excursion
1808                            (message-remove-header ,header)
1809                            (let ((value ,(cdr result)))
1810                              (when value
1811                                (message-goto-eoh)
1812                                (insert ,header ": " value "\n"))))))))
1813                   nil 'local))
1814       (when (or name address)
1815         (add-hook 'message-setup-hook
1816                   `(lambda ()
1817                      (set (make-local-variable 'user-mail-address)
1818                           ,(or (cdr address) user-mail-address))
1819                      (let ((user-full-name ,(or (cdr name) (user-full-name)))
1820                            (user-mail-address
1821                             ,(or (cdr address) user-mail-address)))
1822                        (save-excursion
1823                          (message-remove-header "From")
1824                          (message-goto-eoh)
1825                          (insert "From: " (message-make-from) "\n"))))
1826                   nil 'local)))))
1827
1828 ;;; Allow redefinition of functions.
1829
1830 (gnus-ems-redefine)
1831
1832 (provide 'gnus-msg)
1833
1834 ;;; gnus-msg.el ends here