1 ;;; gnus-msg.el --- mail and post interface for Semi-gnus
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 ;; Free Software Foundation, Inc.
5 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6 ;; Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
9 ;; Katsumi Yamaoka <yamaoka@jpl.org>
10 ;; Kiyokazu SUTO <suto@merry.xmath.ous.ac.jp>
11 ;; Keywords: mail, news, MIME
13 ;; This file is part of GNU Emacs.
15 ;; GNU Emacs is free software; you can redistribute it and/or modify
16 ;; it under the terms of the GNU General Public License as published by
17 ;; the Free Software Foundation; either version 2, or (at your option)
20 ;; GNU Emacs is distributed in the hope that it will be useful,
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;; GNU General Public License for more details.
25 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 ;; Boston, MA 02111-1307, USA.
34 (eval-when-compile (require 'cl))
35 (eval-when-compile (require 'static))
42 (defcustom gnus-post-method 'current
43 "*Preferred method for posting USENET news.
45 If this variable is `current' (which is the default), Gnus will use
46 the \"current\" select method when posting. If it is nil, Gnus will
47 use the native select method when posting.
49 This method will not be used in mail groups and the like, only in
52 If not nil nor `native', the value must be a valid method as discussed
53 in the documentation of `gnus-select-method'. It can also be a list of
54 methods. If that is the case, the user will be queried for what select
55 method to use when posting."
56 :group 'gnus-group-foreign
57 :type `(choice (const nil)
60 (sexp :tag "Methods" ,gnus-select-method)))
62 (defvar gnus-outgoing-message-group nil
63 "*All outgoing messages will be put in this group.
64 If you want to store all your outgoing mail and articles in the group
65 \"nnml:archive\", you set this variable to that value. This variable
66 can also be a list of group names.
68 If you want to have greater control over what group to put each
69 message in, you can set this variable to a function that checks the
70 current newsgroup name and then returns a suitable group name (or list
73 (defvar gnus-mailing-list-groups nil
74 "*Regexp matching groups that are really mailing lists.
75 This is useful when you're reading a mailing list that has been
76 gatewayed to a newsgroup, and you want to followup to an article in
79 (defvar gnus-add-to-list nil
80 "*If non-nil, add a `to-list' parameter automatically.")
82 (defvar gnus-crosspost-complaint
85 You posted the article below with the following Newsgroups header:
89 The %s group, at least, was an inappropriate recipient
90 of this message. Please trim your Newsgroups header to exclude this
91 group before posting in the future.
96 "Format string to be inserted when complaining about crossposts.
97 The first %s will be replaced by the Newsgroups header;
98 the second with the current group name.")
100 (defvar gnus-message-setup-hook '(gnus-maybe-setup-default-charset)
101 "Hook run after setting up a message buffer.")
103 (defvar gnus-bug-create-help-buffer t
104 "*Should we create the *Gnus Help Bug* buffer?")
106 (defvar gnus-posting-styles nil
107 "*Alist of styles to use when posting.")
109 (defvar gnus-inews-mark-gcc-as-read nil
110 "If non-nil, automatically mark Gcc articles as read.")
112 (defcustom gnus-group-posting-charset-alist
113 '(("^\\(no\\|fr\\)\\.[^,]*\\(,[ \t\n]*\\(no\\|fr\\)\\.[^,]*\\)*$" iso-8859-1 (iso-8859-1))
114 ("^\\(fido7\\|relcom\\)\\.[^,]*\\(,[ \t\n]*\\(fido7\\|relcom\\)\\.[^,]*\\)*$" koi8-r (koi8-r))
115 (message-this-is-mail nil nil)
116 (message-this-is-news nil t))
117 "Alist of regexps and permitted unencoded charsets for posting.
118 Each element of the alist has the form (TEST HEADER BODY-LIST), where
119 TEST is either a regular expression matching the newsgroup header or a
121 HEADER is the charset which may be left unencoded in the header (nil
122 means encode all charsets),
123 BODY-LIST is a list of charsets which may be encoded using 8bit
124 content-transfer encoding in the body, or one of the special values
125 nil (always encode using quoted-printable) or t (always use 8bit).
127 Note that any value other than nil for HEADER infringes some RFCs, so
128 use this option with care."
129 :type '(repeat (list :tag "Permitted unencoded charsets"
131 (regexp :tag "Group")
132 (const :tag "Mail message" :value message-this-is-mail)
133 (const :tag "News article" :value message-this-is-news))
134 (choice :tag "Header"
135 (const :tag "None" nil)
136 (symbol :tag "Charset"))
138 (const :tag "Any" :value t)
139 (const :tag "None" :value nil)
140 (repeat :tag "Charsets"
141 (symbol :tag "Charset")))))
142 :group 'gnus-charset)
144 ;;; Internal variables.
146 (defvar gnus-inhibit-posting-styles nil
147 "Inhibit the use of posting styles.")
149 (defvar gnus-message-buffer "*Mail Gnus*")
150 (defvar gnus-article-copy nil)
151 (defvar gnus-check-before-posting nil)
152 (defvar gnus-last-posting-server nil)
153 (defvar gnus-message-group-art nil)
155 (defconst gnus-bug-message
156 (format "Sending a bug report to the Gnus Towers.
157 ========================================
159 This gnus is the %s%s.
160 If you think the bug is a Semi-gnus bug, send a bug report to Semi-gnus
161 Developers. (the addresses below are mailing list addresses)
163 ========================================
165 The buffer below is a mail buffer. When you press `C-c C-c', it will
166 be sent to the Gnus Bug Exterminators.
168 The thing near the bottom of the buffer is how the environment
169 settings will be included in the mail. Please do not delete that.
170 They will tell the Bug People what your environment is, so that it
171 will be easier to locate the bugs.
173 If you have found a bug that makes Emacs go \"beep\", set
174 debug-on-error to t (`M-x set-variable RET debug-on-error RET t RET')
175 and include the backtrace in your bug report.
177 Please describe the bug in annoying, painstaking detail.
179 Thank you for your help in stamping out bugs.
182 (if (string= gnus-product-name "Semi-gnus")
184 ", a modified version of Semi-gnus")))
187 (autoload 'gnus-uu-post-news "gnus-uu" nil t)
188 (autoload 'news-setup "rnewspost")
189 (autoload 'news-reply-mode "rnewspost")
190 (autoload 'rmail-dont-reply-to "mail-utils")
191 (autoload 'rmail-output "rmailout"))
195 ;;; Gnus Posting Functions
198 (gnus-define-keys (gnus-summary-send-map "S" gnus-summary-mode-map)
199 "p" gnus-summary-post-news
200 "f" gnus-summary-followup
201 "F" gnus-summary-followup-with-original
202 "c" gnus-summary-cancel-article
203 "s" gnus-summary-supersede-article
204 "r" gnus-summary-reply
205 "y" gnus-summary-yank-message
206 "R" gnus-summary-reply-with-original
207 "w" gnus-summary-wide-reply
208 "W" gnus-summary-wide-reply-with-original
209 "v" gnus-summary-very-wide-reply
210 "V" gnus-summary-very-wide-reply-with-original
211 "n" gnus-summary-followup-to-mail
212 "N" gnus-summary-followup-to-mail-with-original
213 "m" gnus-summary-mail-other-window
214 "u" gnus-uu-post-news
215 "\M-c" gnus-summary-mail-crosspost-complaint
216 "om" gnus-summary-mail-forward
217 "op" gnus-summary-post-forward
218 "Om" gnus-summary-digest-mail-forward
219 "Op" gnus-summary-digest-post-forward)
221 (gnus-define-keys (gnus-send-bounce-map "D" gnus-summary-send-map)
222 "b" gnus-summary-resend-bounced-mail
223 ;; "c" gnus-summary-send-draft
224 "r" gnus-summary-resend-message)
226 ;;; Internal functions.
228 (defvar gnus-article-reply nil)
229 (defmacro gnus-setup-message (config &rest forms)
230 (let ((winconf (make-symbol "gnus-setup-message-winconf"))
231 (buffer (make-symbol "gnus-setup-message-buffer"))
232 (article (make-symbol "gnus-setup-message-article"))
233 (group (make-symbol "gnus-setup-message-group")))
234 `(let ((,winconf (current-window-configuration))
235 (,buffer (buffer-name (current-buffer)))
236 (,article gnus-article-reply)
237 (,group gnus-newsgroup-name)
238 (message-header-setup-hook
239 (copy-sequence message-header-setup-hook))
240 (message-mode-hook (copy-sequence message-mode-hook))
241 (message-startup-parameter-alist
242 '((reply-buffer . gnus-copy-article-buffer)
243 (original-buffer . gnus-original-article-buffer)
244 (user-agent . Gnus))))
245 (add-hook 'message-header-setup-hook 'gnus-inews-insert-gcc)
246 (add-hook 'message-header-setup-hook 'gnus-inews-insert-archive-gcc)
247 (add-hook 'message-mode-hook 'gnus-configure-posting-styles)
251 (gnus-inews-add-send-actions ,winconf ,buffer ,article ,config)
252 (gnus-inews-insert-draft-meta-information ,group ,article)
253 (setq gnus-message-buffer (current-buffer))
254 (set (make-local-variable 'gnus-message-group-art)
255 (cons ,group ,article))
256 (set (make-local-variable 'gnus-newsgroup-name) ,group)
257 (gnus-run-hooks 'gnus-message-setup-hook))
259 (gnus-configure-windows ,config t)
260 (set-buffer-modified-p nil))))
262 (defun gnus-inews-insert-draft-meta-information (group article)
265 (not (string= group ""))
266 (not (message-fetch-field gnus-draft-meta-information-header)))
267 (goto-char (point-min))
268 (insert gnus-draft-meta-information-header ": (\"" group "\" "
269 (if article (number-to-string
276 (defun gnus-msg-mail (&optional to subject other-headers continue
277 switch-action yank-action send-actions)
278 "Start editing a mail message to be sent.
279 Like `message-mail', but with Gnus paraphernalia, particularly the
280 Gcc: header for archiving purposes."
282 (let ((buf (current-buffer))
284 (gnus-setup-message 'message
285 (message-mail to subject other-headers continue
286 nil yank-action send-actions))
288 (setq mail-buf (current-buffer))
289 (switch-to-buffer buf)
290 (apply switch-action mail-buf nil)))
291 ;; COMPOSEFUNC should return t if succeed. Undocumented ???
295 (defun gnus-button-mailto (address)
297 (set-buffer (gnus-copy-article-buffer))
298 (gnus-setup-message 'message
299 (message-reply address)))
302 (defun gnus-button-reply (&optional to-address wide)
303 "Like `message-reply'."
305 (gnus-setup-message 'message
306 (message-reply to-address wide)))
309 (define-mail-user-agent 'gnus-user-agent
310 'gnus-msg-mail 'message-send-and-exit
311 'message-kill-buffer 'message-send-hook)
313 (defun gnus-setup-posting-charset (group)
314 (let ((alist gnus-group-posting-charset-alist)
315 (group (or group ""))
319 (while (setq elem (pop alist))
320 (when (or (and (stringp (car elem))
321 (string-match (car elem) group))
322 (and (gnus-functionp (car elem))
323 (funcall (car elem) group))
324 (and (symbolp (car elem))
325 (symbol-value (car elem))))
326 (throw 'found (cons (cadr elem) (caddr elem)))))))))
328 (defun gnus-inews-add-send-actions (winconf buffer article &optional config)
329 (make-local-hook 'message-sent-hook)
330 (add-hook 'message-sent-hook (if gnus-agent 'gnus-agent-possibly-do-gcc
331 'gnus-inews-do-gcc) nil t)
333 (make-local-hook 'message-header-hook)
334 (add-hook 'message-header-hook 'gnus-agent-possibly-save-gcc nil t))
335 (setq message-post-method
337 (gnus-post-method arg ,gnus-newsgroup-name)))
338 (setq message-user-agent (gnus-extended-version))
339 (when (not message-use-multi-frames)
341 `(set-window-configuration ,winconf) 'exit 'postpone 'kill))
343 `(when (gnus-buffer-exists-p ,buffer)
347 (if (eq config 'forward)
348 `(gnus-summary-mark-article-as-forwarded ',article)
349 `(gnus-summary-mark-article-as-replied ',article)))))
352 (put 'gnus-setup-message 'lisp-indent-function 1)
353 (put 'gnus-setup-message 'edebug-form-spec '(form body))
355 ;;; Post news commands of Gnus group mode and summary mode
357 (defun gnus-group-mail (&optional arg)
358 "Start composing a mail.
359 If ARG, use the group under the point to find a posting style.
360 If ARG is 1, prompt for a group name to find the posting style."
362 ;; We can't `let' gnus-newsgroup-name here, since that leads
363 ;; to local variables leaking.
364 (let ((group gnus-newsgroup-name)
365 (buffer (current-buffer)))
368 (setq gnus-newsgroup-name
370 (if (= 1 (prefix-numeric-value arg))
371 (completing-read "Use posting style of group: "
372 gnus-active-hashtb nil
373 (gnus-read-active-file-p))
374 (gnus-group-group-name))
376 (gnus-setup-message 'message (message-mail)))
379 (setq gnus-newsgroup-name group)))))
381 (defun gnus-group-post-news (&optional arg)
382 "Start composing a news message.
383 If ARG, post to the group under point.
384 If ARG is 1, prompt for a group name."
386 ;; Bind this variable here to make message mode hooks work ok.
387 (let ((gnus-newsgroup-name
389 (if (= 1 (prefix-numeric-value arg))
390 (completing-read "Newsgroup: " gnus-active-hashtb nil
391 (gnus-read-active-file-p))
392 (gnus-group-group-name))
394 (gnus-post-news 'post gnus-newsgroup-name)))
396 (defun gnus-summary-post-news ()
397 "Start composing a news message."
399 (gnus-post-news 'post gnus-newsgroup-name))
401 (defun gnus-summary-followup (yank &optional force-news)
402 "Compose a followup to an article.
403 If prefix argument YANK is non-nil, original article is yanked automatically."
405 (list (and current-prefix-arg
406 (gnus-summary-work-articles 1))))
408 (gnus-summary-goto-subject (car yank)))
409 (save-window-excursion
410 (gnus-summary-select-article))
411 (let ((headers (gnus-summary-article-header (gnus-summary-article-number)))
412 (gnus-newsgroup-name gnus-newsgroup-name))
414 (gnus-post-news nil gnus-newsgroup-name
415 headers gnus-article-buffer
416 yank nil force-news)))
418 (defun gnus-summary-followup-with-original (n &optional force-news)
419 "Compose a followup to an article and include the original article."
421 (gnus-summary-followup (gnus-summary-work-articles n) force-news))
423 (defun gnus-summary-followup-to-mail (&optional arg)
424 "Followup to the current mail message via news."
426 (list (and current-prefix-arg
427 (gnus-summary-work-articles 1))))
428 (gnus-summary-followup arg t))
430 (defun gnus-summary-followup-to-mail-with-original (&optional arg)
431 "Followup to the current mail message via news."
433 (gnus-summary-followup (gnus-summary-work-articles arg) t))
435 (defun gnus-inews-yank-articles (articles)
436 (let ((more-than-one (cdr articles))
437 (cur (current-buffer))
438 refs beg article window)
440 (while (setq article (pop articles))
441 (save-window-excursion
442 (set-buffer gnus-summary-buffer)
443 (gnus-summary-select-article nil nil nil article)
444 (gnus-summary-remove-process-mark article))
446 ;; Gathering references.
448 (setq refs (message-list-references
450 (mail-header-references gnus-current-headers)
451 (mail-header-message-id gnus-current-headers)))
452 (when message-use-multi-frames
453 (when (setq window (get-buffer-window cur t))
454 (select-frame (window-frame window)))))
456 (gnus-copy-article-buffer)
457 (let ((message-reply-buffer gnus-article-copy)
458 (message-reply-headers
459 (with-current-buffer gnus-article-copy
460 ;; The headers are decoded.
461 (nnheader-parse-head t))))
462 (message-yank-original)
463 (setq beg (or beg (mark t))))
468 ;; Replace with the gathered references.
472 (message-narrow-to-headers)
473 (let ((case-fold-search t))
474 (if (re-search-forward "^References:\\([\t ]+.+\n\\)+" nil t)
476 (goto-char (point-max))))
478 (list (or (assq 'References message-header-format-alist)
479 '(References . message-shorten-references)))
480 (list (cons 'References
481 (mapconcat 'identity (nreverse refs) " "))))
482 (backward-delete-char 1))
488 (defun gnus-summary-cancel-article (&optional n symp)
489 "Cancel an article you posted.
490 Uses the process-prefix convention. If given the symbolic
491 prefix `a', cancel using the standard posting method; if not
492 post using the current select method."
493 (interactive (gnus-interactive "P\ny"))
494 (let ((articles (gnus-summary-work-articles n))
497 (gnus-post-method (not (eq symp 'a)) ,gnus-newsgroup-name)))
499 (while (setq article (pop articles))
500 (when (gnus-summary-select-article t nil nil article)
501 (when (gnus-eval-in-buffer-window gnus-article-buffer
503 (set-buffer gnus-original-article-buffer)
504 (message-cancel-news)))
505 (gnus-summary-mark-as-read article gnus-canceled-mark)
506 (gnus-cache-remove-article 1))
507 (gnus-article-hide-headers-if-wanted))
508 (gnus-summary-remove-process-mark article))))
510 (defun gnus-summary-supersede-article ()
511 "Compose an article that will supersede a previous article.
512 This is done simply by taking the old article and adding a Supersedes
513 header line with the old Message-ID."
515 (let ((article (gnus-summary-article-number))
516 (gnus-message-setup-hook '(gnus-maybe-setup-default-charset)))
517 (gnus-setup-message 'reply-yank
518 (gnus-summary-select-article t)
519 (set-buffer gnus-original-article-buffer)
523 (when (gnus-buffer-exists-p ,gnus-summary-buffer)
525 (set-buffer ,gnus-summary-buffer)
526 (gnus-cache-possibly-remove-article ,article nil nil nil t)
527 (gnus-summary-mark-as-read ,article gnus-canceled-mark)))))
528 message-send-actions))))
532 (defun gnus-copy-article-buffer (&optional article-buffer)
533 ;; make a copy of the article buffer with all text properties removed
534 ;; this copy is in the buffer gnus-article-copy.
535 ;; if ARTICLE-BUFFER is nil, gnus-article-buffer is used
536 ;; this buffer should be passed to all mail/news reply/post routines.
537 (setq gnus-article-copy (gnus-get-buffer-create " *gnus article copy*"))
538 (let ((article-buffer (or article-buffer gnus-article-buffer))
540 (if (not (and (get-buffer article-buffer)
541 (gnus-buffer-exists-p article-buffer)))
542 (error "Can't find any article buffer")
544 (set-buffer article-buffer)
545 (let ((gnus-newsgroup-charset (or gnus-article-charset
546 gnus-newsgroup-charset))
547 (gnus-newsgroup-ignored-charsets
548 (or gnus-article-ignored-charsets
549 gnus-newsgroup-ignored-charsets)))
551 ;; Copy over the (displayed) article buffer, delete
552 ;; hidden text and remove text properties.
554 (let ((inhibit-read-only t))
555 (copy-to-buffer gnus-article-copy (point-min) (point-max))
556 (set-buffer gnus-article-copy)
557 ;; Encode bitmap smileys to ordinary text.
558 ;; Possibly, the original text might be restored.
559 (static-unless (featurep 'xemacs)
560 (when (featurep 'smiley-mule)
561 (smiley-encode-buffer)))
562 (gnus-article-delete-text-of-type 'annotation)
563 (gnus-remove-text-with-property 'gnus-prev)
564 (gnus-remove-text-with-property 'gnus-next)
565 (gnus-remove-text-with-property 'x-face-mule-bitmap-image)
568 (static-if (featurep 'xemacs)
569 ;; Revome smiley extents for (possibly) XEmacs 21.1.
571 (buffer-substring-no-properties (point-min)
573 (buffer-substring-no-properties (point-min) (point-max)))
575 ;; Find the original headers.
576 (set-buffer gnus-original-article-buffer)
577 (goto-char (point-min))
578 (while (looking-at message-unix-mail-delimiter)
581 (setq end (or (message-goto-body) beg))
582 ;; Delete the headers from the displayed articles.
583 (set-buffer gnus-article-copy)
584 (delete-region (goto-char (point-min))
585 (or (message-goto-body) (point-max)))
586 ;; Insert the original article headers.
587 (insert-buffer-substring gnus-original-article-buffer beg end)
588 (article-decode-encoded-words))))
591 (defun gnus-post-news (post &optional group header article-buffer yank subject
594 (gnus-copy-article-buffer))
595 (let ((gnus-article-reply (and article-buffer (gnus-summary-article-number)))
596 (add-to-list gnus-add-to-list))
597 (gnus-setup-message (cond (yank 'reply-yank)
598 (article-buffer 'reply)
600 (let* ((group (or group gnus-newsgroup-name))
601 (charset (gnus-group-name-charset nil group))
603 to-address to-group mailing-list to-list
606 (setq to-address (gnus-parameter-to-address group)
607 to-group (gnus-group-find-parameter group 'to-group)
608 to-list (gnus-parameter-to-list group)
609 newsgroup-p (gnus-group-find-parameter group 'newsgroup)
610 mailing-list (when gnus-mailing-list-groups
611 (string-match gnus-mailing-list-groups group))
612 group (gnus-group-name-decode (gnus-group-real-name group)
614 (if (or (and to-group
615 (gnus-news-group-p to-group))
618 (and (gnus-news-group-p
619 (or pgroup gnus-newsgroup-name)
620 (if header (mail-header-number header)
621 gnus-current-article))
627 (message-news (or to-group group))
628 (set-buffer gnus-article-copy)
629 (gnus-msg-treat-broken-reply-to)
630 (message-followup (if (or newsgroup-p force-news)
631 (if (save-restriction
632 (article-narrow-to-head)
633 (message-fetch-field "newsgroups"))
640 (message-mail (or to-address to-list))
641 ;; Arrange for mail groups that have no `to-address' to
642 ;; get that when the user sends off the mail.
643 (when (and (not to-list)
646 (push (list 'gnus-inews-add-to-address pgroup)
647 message-send-actions)))
648 (set-buffer gnus-article-copy)
649 (gnus-msg-treat-broken-reply-to)
650 (message-wide-reply to-address)))
652 (gnus-inews-yank-articles yank))))))
654 (defun gnus-msg-treat-broken-reply-to ()
655 "Remove the Reply-to header iff broken-reply-to."
656 (when (gnus-group-find-parameter
657 gnus-newsgroup-name 'broken-reply-to)
659 (message-narrow-to-head)
660 (message-remove-header "reply-to"))))
662 (defun gnus-post-method (arg group &optional silent)
663 "Return the posting method based on GROUP and ARG.
664 If SILENT, don't prompt the user."
665 (let ((group-method (gnus-find-method-for-group group)))
667 ;; If the group-method is nil (which shouldn't happen) we use
668 ;; the default method.
670 (or (and (null (eq gnus-post-method 'active)) gnus-post-method)
671 gnus-select-method message-post-method))
672 ;; We want the inverse of the default
673 ((and arg (not (eq arg 0)))
674 (if (eq gnus-post-method 'active)
677 ;; We query the user for a post method.
679 (and gnus-post-method
680 (not (eq gnus-post-method 'current))
681 (listp (car gnus-post-method))))
683 ;; Collect all methods we know about.
685 (when (and gnus-post-method
686 (not (eq gnus-post-method 'current)))
687 (if (listp (car gnus-post-method))
689 (list gnus-post-method)))
690 gnus-secondary-select-methods
691 (mapcar 'cdr gnus-server-alist)
692 (mapcar 'car gnus-opened-servers)
693 (list gnus-select-method)
694 (list group-method)))
695 method-alist post-methods method)
696 ;; Weed out all mail methods.
698 (setq method (gnus-server-get-method "" (pop methods)))
699 (when (and (or (gnus-method-option-p method 'post)
700 (gnus-method-option-p method 'post-mail))
701 (not (member method post-methods)))
702 (push method post-methods)))
703 ;; Create a name-method alist.
707 (if (equal (cadr m) "")
708 (list (symbol-name (car m)) m)
709 (list (concat (cadr m) " (" (symbol-name (car m)) ")") m)))
714 (setq gnus-last-posting-server
716 gnus-last-posting-server)
717 ;; Just use the last value.
718 gnus-last-posting-server
720 "Posting method: " method-alist nil t
721 (cons (or gnus-last-posting-server "") 0))))
723 ;; Override normal method.
724 ((and (eq gnus-post-method 'current)
725 (not (eq (car group-method) 'nndraft))
726 (gnus-get-function group-method 'request-post t)
729 ((and gnus-post-method
730 (not (eq gnus-post-method 'current)))
732 ;; Use the normal select method.
733 (t gnus-select-method))))
737 (defun gnus-message-make-user-agent (&optional include-mime-info max-column)
738 "Return user-agent info.
739 INCLUDE-MIME-INFO the optional first argument if it is non-nil and the variable
740 `mime-edit-user-agent-value' exists, the return value will include it.
741 MAX-COLUMN the optional second argument if it is specified, the return value
742 will be folded up in the proper way."
743 (let ((user-agent (if (and include-mime-info
744 (boundp 'mime-edit-user-agent-value))
745 (concat (gnus-extended-version)
747 mime-edit-user-agent-value)
748 (gnus-extended-version))))
751 (unless (natnump max-column) (setq max-column 76))
753 (insert " " user-agent)
755 (while (re-search-forward "[\n\t ]+" nil t)
758 (while (re-search-forward "[^ ()/]+\\(/[^ ()/]+\\)? ?" nil t)
759 (while (eq ?\( (char-after (point)))
761 (skip-chars-forward " "))
762 (skip-chars-backward " ")
763 (if (> (current-column) max-column)
765 (if (or (not boundary) (eq ?\n (char-after boundary)))
767 (setq boundary (point))
774 (setq boundary (point))))
775 (buffer-substring 13 (point-max))))
780 ;;; Gnus Mail Functions
783 ;;; Mail reply commands of Gnus summary mode
785 (defun gnus-summary-reply (&optional yank wide very-wide)
786 "Start composing a mail reply to the current message.
787 If prefix argument YANK is non-nil, the original article is yanked
789 If WIDE, make a wide reply.
790 If VERY-WIDE, make a very wide reply."
792 (list (and current-prefix-arg
793 (gnus-summary-work-articles 1))))
794 ;; Stripping headers should be specified with mail-yank-ignored-headers.
796 (gnus-summary-goto-subject (car yank)))
797 (let ((gnus-article-reply (or yank (gnus-summary-article-number)))
799 (gnus-setup-message (if yank 'reply-yank 'reply)
801 (gnus-summary-select-article)
802 (dolist (article very-wide)
803 (gnus-summary-select-article nil nil nil article)
805 (set-buffer (gnus-copy-article-buffer))
806 (gnus-msg-treat-broken-reply-to)
808 (message-narrow-to-head)
809 (setq headers (concat headers (buffer-string)))))))
810 (set-buffer (gnus-copy-article-buffer))
811 (gnus-msg-treat-broken-reply-to)
813 (message-narrow-to-head)
817 (goto-char (point-max)))
818 (message-reply nil wide)
820 (gnus-inews-yank-articles yank)))))
822 (defun gnus-summary-reply-with-original (n &optional wide)
823 "Start composing a reply mail to the current message.
824 The original article will be yanked."
826 (gnus-summary-reply (gnus-summary-work-articles n) wide))
828 (defun gnus-summary-wide-reply (&optional yank)
829 "Start composing a wide reply mail to the current message.
830 If prefix argument YANK is non-nil, the original article is yanked
833 (list (and current-prefix-arg
834 (gnus-summary-work-articles 1))))
835 (gnus-summary-reply yank t))
837 (defun gnus-summary-wide-reply-with-original (n)
838 "Start composing a wide reply mail to the current message.
839 The original article will be yanked."
841 (gnus-summary-reply-with-original n t))
843 (defun gnus-summary-very-wide-reply (&optional yank)
844 "Start composing a very wide reply mail to the current message.
845 If prefix argument YANK is non-nil, the original article is yanked
848 (list (and current-prefix-arg
849 (gnus-summary-work-articles 1))))
850 (gnus-summary-reply yank t (gnus-summary-work-articles yank)))
852 (defun gnus-summary-very-wide-reply-with-original (n)
853 "Start composing a very wide reply mail to the current message.
854 The original article will be yanked."
857 (gnus-summary-work-articles n) t (gnus-summary-work-articles n)))
859 (defun gnus-summary-mail-forward (&optional full-headers post)
860 "Forward the current message to another user.
861 If FULL-HEADERS (the prefix), include full headers when forwarding."
863 (gnus-setup-message 'forward
864 (gnus-summary-select-article)
865 (let ((charset default-mime-charset))
866 (set-buffer gnus-original-article-buffer)
867 (make-local-variable 'default-mime-charset)
868 (setq default-mime-charset charset))
869 (let ((message-included-forward-headers
870 (if full-headers "" message-included-forward-headers)))
871 (message-forward post))))
873 (defun gnus-summary-digest-mail-forward (&optional n post)
874 "Digests and forwards all articles in this series.
875 If N is a positive number, forward the N next articles.
876 If N is a negative number, forward the N previous articles.
877 If N is nil and any articles have been marked with the process mark,
878 forward those articles instead.
879 Optional POST will use news to forward instead of mail."
881 (let ((articles (gnus-summary-work-articles n))
883 subject article frame)
885 (gnus-setup-message 'forward
886 (gnus-summary-select-article)
888 (setq articles (sort articles '<)
889 subject "Digested Articles")
890 (with-current-buffer gnus-original-article-buffer
891 (setq subject (message-make-forward-subject))))
893 (message-news nil subject)
894 (message-mail nil subject))
895 (when (and message-use-multi-frames (cdr articles))
896 (setq frame (window-frame (get-buffer-window (current-buffer)))))
898 (while (setq article (pop articles))
899 (save-window-excursion
900 (set-buffer gnus-summary-buffer)
901 (gnus-summary-select-article nil nil nil article)
902 (setq topics (concat topics " "
903 (mail-header-subject gnus-current-headers)
905 (gnus-summary-remove-process-mark article))
907 (select-frame frame))
908 (insert (mime-make-tag "message" "rfc822") "\n")
909 (narrow-to-region (point) (point))
910 (insert-buffer-substring gnus-original-article-buffer)
912 (article-narrow-to-head)
913 (message-remove-header message-included-forward-headers t nil t))
914 (goto-char (point-max))
920 (mime-edit-enclose-digest-region (point)(mark t))))))
922 (defun gnus-summary-digest-post-forward (&optional n)
923 "Digest and forwards all articles in this series to a newsgroup.
924 If N is a positive number, forward the N next articles.
925 If N is a negative number, forward the N previous articles.
926 If N is nil and any articles have been marked with the process mark,
927 forward those articles instead."
929 (gnus-summary-digest-mail-forward n t))
931 (defun gnus-summary-resend-message (address n)
932 "Resend the current article to ADDRESS."
934 (list (message-read-from-minibuffer "Resend message(s) to: ")
936 (let ((articles (gnus-summary-work-articles n))
938 (while (setq article (pop articles))
939 (gnus-summary-select-article nil nil nil article)
941 (set-buffer gnus-original-article-buffer)
942 (message-resend address))
943 (gnus-summary-mark-article-as-forwarded article))))
945 (defun gnus-summary-post-forward (&optional full-headers)
946 "Forward the current article to a newsgroup.
947 If FULL-HEADERS (the prefix), include full headers when forwarding."
949 (gnus-summary-mail-forward full-headers t))
951 (defvar gnus-nastygram-message
952 "The following article was inappropriately posted to %s.\n\n"
953 "Format string to insert in nastygrams.
954 The current group name will be inserted at \"%s\".")
956 (defun gnus-summary-mail-nastygram (n)
957 "Send a nastygram to the author of the current article."
959 (when (or gnus-expert-user
961 "Really send a nastygram to the author of the current article? "))
962 (let ((group gnus-newsgroup-name))
963 (gnus-summary-reply-with-original n)
964 (set-buffer gnus-message-buffer)
966 (insert (format gnus-nastygram-message group))
967 (message-send-and-exit))))
969 (defun gnus-summary-mail-crosspost-complaint (n)
970 "Send a complaint about crossposting to the current article(s)."
972 (let ((articles (gnus-summary-work-articles n))
974 (while (setq article (pop articles))
975 (set-buffer gnus-summary-buffer)
976 (gnus-summary-goto-subject article)
977 (let ((group (gnus-group-real-name gnus-newsgroup-name))
978 newsgroups followup-to)
979 (gnus-summary-select-article)
980 (set-buffer gnus-original-article-buffer)
981 (if (and (<= (length (message-tokenize-header
983 (mail-fetch-field "newsgroups"))
986 (or (not (setq followup-to (mail-fetch-field "followup-to")))
987 (not (member group (message-tokenize-header
988 followup-to ", ")))))
990 (gnus-message 1 "Followup-to restricted")
991 (gnus-message 1 "Not a crossposted article"))
992 (set-buffer gnus-summary-buffer)
993 (gnus-summary-reply-with-original 1)
994 (set-buffer gnus-message-buffer)
996 (insert (format gnus-crosspost-complaint newsgroups group))
997 (message-goto-subject)
998 (re-search-forward " *$")
999 (replace-match " (crosspost notification)" t t)
1000 (gnus-deactivate-mark)
1001 (when (gnus-y-or-n-p "Send this complaint? ")
1002 (message-send-and-exit)))))))
1004 (defun gnus-summary-mail-other-window ()
1005 "Compose mail in other window."
1007 (gnus-setup-message 'message
1010 (defun gnus-mail-parse-comma-list ()
1013 (skip-chars-forward " ")
1016 (skip-chars-forward "^,")
1021 (narrow-to-region beg (point))
1024 (while (search-forward "\"" nil t)
1028 (skip-chars-forward ",")
1029 (skip-chars-forward "^,"))
1030 (skip-chars-backward " ")
1031 (push (buffer-substring beg (point))
1033 (skip-chars-forward "^,")
1034 (skip-chars-forward ", "))
1037 (defun gnus-inews-add-to-address (group)
1038 (let ((to-address (mail-fetch-field "to")))
1039 (when (and to-address
1041 ;; This mail group doesn't have a `to-list', so we add one
1043 (when (gnus-y-or-n-p
1044 (format "Do you want to add this as `to-list': %s " to-address))
1045 (gnus-group-add-parameter group (cons 'to-list to-address))))))
1047 (defun gnus-put-message ()
1048 "Put the current message in some group and return to Gnus."
1050 (let ((reply gnus-article-reply)
1051 (winconf gnus-prev-winconf)
1052 (group gnus-newsgroup-name))
1054 (not (gnus-group-read-only-p group)))
1055 (setq group (read-string "Put in group: " nil (gnus-writable-groups))))
1057 (when (gnus-gethash group gnus-newsrc-hashtb)
1058 (error "No such group: %s" group))
1062 (message-narrow-to-headers)
1063 (let ((gnus-deletable-headers nil))
1064 (message-generate-headers
1065 (if (message-news-p)
1066 message-required-news-headers
1067 message-required-mail-headers)))
1068 (goto-char (point-max))
1069 (insert "Gcc: " group "\n")
1072 (when (and (get-buffer gnus-group-buffer)
1073 (gnus-buffer-exists-p (car-safe reply))
1075 (set-buffer (car reply))
1076 (gnus-summary-mark-article-as-replied (cdr reply)))
1078 (set-window-configuration winconf))))
1080 (defun gnus-article-mail (yank)
1081 "Send a reply to the address near point.
1082 If YANK is non-nil, include the original article."
1086 (save-excursion (re-search-backward "[ \t\n]" nil t) (1+ (point)))
1087 (save-excursion (re-search-forward "[ \t\n]" nil t) (1- (point))))))
1089 (message-reply address)
1091 (gnus-inews-yank-articles (list (cdr gnus-article-current)))))))
1093 (defvar nntp-server-type)
1095 "Send a bug report to the Gnus maintainers."
1097 (unless (gnus-alive-p)
1098 (error "Gnus has been shut down"))
1099 (gnus-setup-message (if (message-mail-user-agent) 'message 'bug)
1100 (unless (message-mail-user-agent)
1101 (message-pop-to-buffer "*Gnus Bug*")
1102 (delete-other-windows)
1103 (when gnus-bug-create-help-buffer
1104 (switch-to-buffer "*Gnus Help Bug*")
1106 (insert gnus-bug-message)
1107 (goto-char (point-min))
1109 (set-buffer "*Gnus Bug*")))
1110 (let ((message-this-is-mail t))
1111 (message-setup `((To . ,gnus-maintainer) (Subject . ""))))
1112 (when gnus-bug-create-help-buffer
1113 (push `(gnus-bug-kill-buffer) message-send-actions))
1114 (goto-char (point-min))
1115 (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$"))
1117 (insert gnus-product-name " " gnus-version-number
1118 " (r" gnus-revision-number ") "
1119 "based on " gnus-original-product-name " v"
1120 gnus-original-version-number "\n"
1121 (emacs-version) "\n")
1122 (when (and (boundp 'nntp-server-type)
1123 (stringp nntp-server-type))
1124 (insert nntp-server-type))
1125 (insert "\n\n\n\n\n")
1126 (let (mime-content-types)
1127 (mime-edit-insert-tag "text" "plain" "; type=emacs-lisp"))
1128 (insert (with-temp-buffer
1131 (let (mime-content-types)
1132 (mime-edit-insert-tag "text" "plain"))
1133 (goto-char (point-min))
1134 (search-forward "Subject: " nil t)
1137 (defun gnus-bug-kill-buffer ()
1138 (when (get-buffer "*Gnus Help Bug*")
1139 (kill-buffer "*Gnus Help Bug*")))
1141 (defun gnus-summary-yank-message (buffer n)
1142 "Yank the current article into a composed message."
1144 (list (completing-read "Buffer: " (mapcar 'list (message-buffers)) nil t)
1145 current-prefix-arg))
1146 (when (gnus-buffer-live-p buffer)
1147 (let ((summary-frame (selected-frame))
1148 (message-frame (when (static-if (featurep 'xemacs)
1149 (device-on-window-system-p)
1151 (let ((window (get-buffer-window buffer t)))
1153 (window-frame window)))))
1154 (separator (concat "^" (regexp-quote mail-header-separator)
1156 (gnus-summary-iterate n
1157 (gnus-summary-select-article)
1158 (gnus-copy-article-buffer)
1159 (when (frame-live-p message-frame)
1160 (raise-frame message-frame)
1161 (select-frame message-frame))
1162 (with-current-buffer buffer
1163 (when (save-excursion
1165 (let (case-fold-search)
1166 (and (not (re-search-backward separator nil t))
1167 (re-search-forward separator nil t))))
1168 (goto-char (match-end 0)))
1169 (message-yank-buffer gnus-article-copy))
1170 (select-frame summary-frame))
1171 (when (frame-live-p message-frame)
1172 (select-frame message-frame)))))
1174 (defun gnus-debug ()
1175 "Attempts to go through the Gnus source file and report what variables have been changed.
1176 The source file has to be in the Emacs load path."
1178 (let ((files '("gnus.el" "gnus-sum.el" "gnus-group.el"
1179 "gnus-art.el" "gnus-start.el" "gnus-async.el"
1180 "gnus-msg.el" "gnus-score.el" "gnus-win.el" "gnus-topic.el"
1181 "nnmail.el" "nntp.el" "message.el"))
1183 file expr olist sym)
1184 (gnus-message 4 "Please wait while we snoop your variables...")
1185 ;; Go through all the files looking for non-default values for variables.
1188 (set-buffer (gnus-get-buffer-create " *gnus bug info*"))
1191 (when (and (setq file (locate-library (pop files)))
1192 (file-exists-p file))
1193 (insert-file-contents file)
1194 (goto-char (point-min))
1195 (if (not (re-search-forward "^;;* *Internal variables" nil t))
1196 (gnus-message 4 "Malformed sources in file %s" file)
1197 (narrow-to-region (point-min) (point))
1198 (goto-char (point-min))
1199 (while (setq expr (ignore-errors (read (current-buffer))))
1201 (and (memq (car expr) '(defvar defcustom defvoo))
1202 (stringp (nth 3 expr))
1203 (or (not (boundp (nth 1 expr)))
1204 (not (equal (eval (nth 2 expr))
1205 (symbol-value (nth 1 expr)))))
1206 (push (nth 1 expr) olist)))))))
1207 (kill-buffer (current-buffer)))
1208 (when (setq olist (nreverse olist))
1209 (insert ";----------------- Environment follows ------------------\n\n"))
1211 (if (boundp (car olist))
1213 (pp `(setq ,(car olist)
1214 ,(if (or (consp (setq sym (symbol-value (car olist))))
1216 (not (or (eq sym nil)
1218 (list 'quote (symbol-value (car olist)))
1219 (symbol-value (car olist))))
1222 (format "(setq %s 'whatever)\n" (car olist))))
1223 (insert ";; (makeunbound '" (symbol-name (car olist)) ")\n"))
1224 (setq olist (cdr olist)))
1225 ;; Remove any control chars - they seem to cause trouble for some
1226 ;; mailers. (Byte-compiled output from the stuff above.)
1228 (while (re-search-forward "[\000-\010\013-\037\200-\237]" nil t)
1229 (replace-match (format "\\%03o" (string-to-char (match-string 0)))
1231 ;; Break MIME tags purposely.
1233 (while (re-search-forward mime-edit-tag-regexp nil t)
1234 (goto-char (1+ (match-beginning 0)))
1237 ;;; Treatment of rejected articles.
1240 (defun gnus-summary-resend-bounced-mail (&optional fetch)
1241 "Re-mail the current message.
1242 This only makes sense if the current message is a bounce message than
1243 contains some mail you have written which has been bounced back to
1245 If FETCH, try to fetch the article that this is a reply to, if indeed
1248 (gnus-summary-select-article t)
1249 (set-buffer gnus-original-article-buffer)
1250 (let ((gnus-message-setup-hook '(gnus-maybe-setup-default-charset)))
1251 (gnus-setup-message 'compose-bounce
1252 (let* ((references (mail-fetch-field "references"))
1253 (parent (and references (gnus-parent-id references))))
1255 ;; If there are references, we fetch the article we answered to.
1257 (gnus-summary-refer-article parent)
1258 (gnus-summary-show-all-headers))))))
1262 (defun gnus-inews-group-method (group)
1263 (cond ((and (null (gnus-get-info group))
1264 (eq (car gnus-message-archive-method)
1266 (gnus-server-to-method
1267 (gnus-group-method group)))))
1268 ;; If the group doesn't exist, we assume
1269 ;; it's an archive group...
1270 gnus-message-archive-method)
1272 ((gnus-info-method (gnus-get-info group))
1273 (gnus-info-method (gnus-get-info group)))
1275 (t (gnus-group-method group))))
1277 ;; Do Gcc handling, which copied the message over to some group.
1278 (defun gnus-inews-do-gcc (&optional gcc)
1280 (when (gnus-alive-p)
1283 (message-narrow-to-headers)
1284 (let ((gcc (or gcc (mail-fetch-field "gcc" nil t)))
1285 (coding-system-for-write 'raw-text)
1286 (output-coding-system 'raw-text)
1287 groups group method group-art)
1289 (message-remove-header "gcc")
1291 (setq groups (message-unquote-tokens
1292 (message-tokenize-header gcc " ,")))
1293 ;; Copy the article over to some group(s).
1294 (while (setq group (pop groups))
1296 (setq method (gnus-inews-group-method group)))
1297 (unless (gnus-request-group group nil method)
1298 (gnus-request-create-group group method))
1300 (nnheader-set-temp-buffer " *acc*")
1301 (insert-buffer-substring message-encoding-buffer)
1302 (gnus-run-hooks 'gnus-before-do-gcc-hook)
1303 (goto-char (point-min))
1304 (when (re-search-forward
1305 (concat "^" (regexp-quote mail-header-separator) "$")
1307 (replace-match "" t t ))
1308 (unless (setq group-art
1309 (gnus-request-accept-article group method t t))
1310 (gnus-message 1 "Couldn't store article in group %s: %s"
1311 group (gnus-status-message method))
1313 (when (and group-art gnus-inews-mark-gcc-as-read)
1314 (gnus-group-mark-article-read group (cdr group-art)))
1315 (kill-buffer (current-buffer))))))))))
1317 (defun gnus-inews-insert-gcc ()
1318 "Insert Gcc headers based on `gnus-outgoing-message-group'."
1321 (message-narrow-to-headers)
1322 (let* ((group gnus-outgoing-message-group)
1324 ((gnus-functionp group)
1326 ((or (stringp group) (list group))
1330 (if (stringp gcc) gcc
1331 (mapconcat 'identity gcc " "))
1334 (defun gnus-inews-insert-archive-gcc (&optional group)
1335 "Insert the Gcc to say where the article is to be archived."
1336 (let* ((var gnus-message-archive-group)
1337 (group (or group gnus-newsgroup-name ""))
1339 (and gnus-newsgroup-name
1340 (not (equal gnus-newsgroup-name ""))
1341 (gnus-group-find-parameter
1342 gnus-newsgroup-name 'gcc-self)))
1346 ((null gnus-message-archive-method)
1350 ;; Just a single group.
1353 ;; We don't want this.
1355 ((and (listp var) (stringp (car var)))
1356 ;; A list of groups.
1358 ((gnus-functionp var)
1360 (funcall var group))
1362 ;; An alist of regexps/functions/forms.
1367 ((stringp (caar var))
1369 (when (string-match (caar var) group)
1371 ((gnus-functionp (car var))
1373 (funcall (car var) group))
1375 (eval (car var)))))))
1376 (setq var (cdr var)))
1379 (when (or groups gcc-self-val)
1380 (when (stringp groups)
1381 (setq groups (list groups)))
1384 (message-narrow-to-headers)
1385 (goto-char (point-max))
1388 ;; Use the `gcc-self' param value instead.
1391 (if (stringp gcc-self-val)
1394 (if (not (eq gcc-self-val 'none))
1399 ;; Use the list of groups.
1400 (while (setq name (pop groups))
1401 (insert (if (string-match ":" name)
1403 (gnus-group-prefixed-name
1404 name gnus-message-archive-method)))
1411 (defun gnus-configure-posting-styles ()
1412 "Configure posting styles according to `gnus-posting-styles'."
1413 (unless gnus-inhibit-posting-styles
1414 (let ((group (or gnus-newsgroup-name ""))
1415 (styles gnus-posting-styles)
1416 style match variable attribute value v results
1417 filep name address element)
1418 ;; If the group has a posting-style parameter, add it at the end with a
1419 ;; regexp matching everything, to be sure it takes precedence over all
1421 (when gnus-newsgroup-name
1422 (let ((tmp-style (gnus-group-find-parameter group 'posting-style t)))
1424 (setq styles (append styles (list (cons ".*" tmp-style)))))))
1425 ;; Go through all styles and look for matches.
1426 (dolist (style styles)
1427 (setq match (pop style))
1428 (goto-char (point-min))
1431 ;; Regexp string match on the group name.
1432 (string-match match group))
1434 (and (gnus-buffer-live-p gnus-article-copy)
1435 (with-current-buffer gnus-article-copy
1436 (let ((header (message-fetch-field (pop style))))
1438 (string-match (pop style) header))))))
1439 ((or (symbolp match)
1440 (gnus-functionp match))
1442 ((gnus-functionp match)
1443 ;; Function to be called.
1446 ;; Variable to be checked.
1447 (symbol-value match))))
1449 ;; This is a form to be evaled.
1451 ;; We have a match, so we set the variables.
1452 (dolist (attribute style)
1453 (setq element (pop attribute)
1458 ((eq (car attribute) ':file)
1461 ((eq (car attribute) :value)
1465 ;; We get the value.
1470 ((or (symbolp value)
1471 (gnus-functionp value))
1472 (cond ((gnus-functionp value)
1475 (symbol-value value))))
1478 ;; Translate obsolescent value.
1479 (when (eq element 'signature-file)
1480 (setq element 'signature
1482 ;; Get the contents of file elems.
1484 (setq v (with-temp-buffer
1485 (insert-file-contents v)
1487 (setq results (delq (assoc element results) results))
1488 (push (cons element v) results))))
1489 ;; Now we have all the styles, so we insert them.
1490 (setq name (assq 'name results)
1491 address (assq 'address results))
1492 (setq results (delq name (delq address results)))
1493 (make-local-variable 'message-setup-hook)
1494 (dolist (result results)
1495 (add-hook 'message-setup-hook
1497 ((eq 'eval (car result))
1499 ((eq 'body (car result))
1503 (insert ,(cdr result)))))
1504 ((eq 'signature (car result))
1505 (set (make-local-variable 'message-signature) nil)
1506 (set (make-local-variable 'message-signature-file) nil)
1507 (if (not (cdr result))
1511 (let ((message-signature ,(cdr result)))
1512 (when message-signature
1513 (message-insert-signature)))))))
1516 (if (symbolp (car result))
1517 (capitalize (symbol-name (car result)))
1521 (message-remove-header ,header)
1522 (let ((value ,(cdr result)))
1525 (insert ,header ": " value "\n"))))))))))
1526 (when (or name address)
1527 (add-hook 'message-setup-hook
1529 (set (make-local-variable 'user-mail-address)
1530 ,(or (cdr address) user-mail-address))
1531 (let ((user-full-name ,(or (cdr name) (user-full-name)))
1533 ,(or (cdr address) user-mail-address)))
1535 (message-remove-header "From")
1537 (insert "From: " (message-make-from) "\n")))))))))
1540 ;;; @ for MIME Edit mode
1543 (defun gnus-maybe-setup-default-charset ()
1545 (and (boundp 'gnus-summary-buffer)
1546 (buffer-live-p gnus-summary-buffer)
1548 (set-buffer gnus-summary-buffer)
1549 default-mime-charset))))
1552 (make-local-variable 'default-mime-charset)
1553 (setq default-mime-charset charset)
1557 ;;; @ for MIME view mode
1560 (defun gnus-following-method (buf)
1561 (gnus-setup-message 'reply-yank
1563 (if (message-news-p)
1565 (message-reply nil 'wide))
1566 (let ((message-reply-buffer buf))
1567 (message-yank-original))
1568 (message-goto-body))
1572 ;;; Allow redefinition of functions.
1578 ;;; gnus-msg.el ends here