I am using the following code to archive replies to messages in the same group they come from; it works well.
;; Store sent messages in the same group they came from
(setq gnus-message-archive-method '(nnml ""))
(setq gnus-message-archive-group
'((lambda (x)
(cond
;; Store personal mail messages in the same group I started out in
((string-match ".*" group) group)
;; Store everything else in misc until I can sort it out
(t "mail.misc")))))
However, if I use C-x m
from a non-GNUs buffer, or create a message without a group selected, there seems to be no archiving at all; the message is lost unless I manually fill in a GCC: mail.misc
line. How can I make this happen automatically for all messages not made from within a group?
First you have to set gnus as mail handler.
(setq mail-user-agent 'gnus-user-agent)
Still this doesn't work, if gnus is not running when starting to write a mail with C-x m. Here a advice helps.
(defadvice gnus-msg-mail (before start-gnus activate)
(require 'gnus-start)
(unless (gnus-alive-p)
(save-window-excursion
(let ((inhibit-redisplay t))
(gnus)))))