A lot of mailing lists do not set the reply-to to the mailing list. It
is considered evil, but I like it. But lets not get into a discussion
about that.

The only way to get the email to the mailing list is a wide follow up,
but then the sender gets an email from me and from the mailing list.
That is why I made follow up only going to the mailing list. (With
reply I still can reply to the author.)

I defined a 'tuple':
    (setq dcbl-gnus-mailing-lists '(
                                    ("INBOX.Info.bbdb"               . 
"bbdb-i...@lists.sourceforge.net")
                                    .
                                    .
                                    .
                                    ("bedrijf/ontwikkeling/scala"    . 
"scala-u...@googlegroups.com")
                                    ))


I made the following advice:
    (defadvice gnus-summary-followup-with-original (after formalities () 
activate)
      (let ((to-address (dcbl-gnus-get-mailing-list-address)))
        (when to-address
          (when (message-fetch-field "To")
            (message-goto-to)
            (message-beginning-of-line)
            (kill-line))
          (when (message-fetch-field "Cc")
            (message-goto-cc)
            (message-beginning-of-line)
            (message-beginning-of-line)
            (kill-line)
            (kill-line))
          (dcbl-fill-to-address)
          (message-goto-body))))

When gnus-newsgroup-name is from a mailing list, I empty the To field,
I delete the Cc field, fill the To field and go to the body.


The function to get the address:
    (defun dcbl-gnus-get-mailing-list-address ()
      "Get gnus-newsgroup-name mailing list address (if it has one);"
      (string-match "[^:]*$" gnus-newsgroup-name)
      (dcbl-get-tuple-value dcbl-gnus-mailing-lists (match-string 0 
gnus-newsgroup-name)))


The general function to get a value from a 'tuple':
    (defun dcbl-get-tuple-value (tuple index)
      "Get value from tuple indexed by index (if it exist);"
      (assoc-default index tuple))


The function to fill the To field (I use it also to fill when creating
an article, that is why I go to the subject field here.):
    (defun dcbl-fill-to-address ()
      "Determine what to-address to use on the current message;"
      (interactive)
      (let ((to-address nil))
        (when (and (string= major-mode "message-mode")
                   gnus-newsgroup-name
                   (not (message-fetch-field "To"))
                   (setq to-address (dcbl-gnus-get-mailing-list-address)))
          (message-goto-to)
          (insert to-address)
          (message-goto-subject))))

I check that I am in message-mode, that gnu-newsgroup-name is filled,
that the To field is not filled and that it is a mailing list.
If that is the case I fill the To field and go to the subject field.


The advice for sending a message:
    (defadvice gnus-summary-mail-other-window (after formalities () activate)
      (dcbl-fill-to-address))


I hope it is useful to someone. And if I could do things better: let
me know.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

Reply via email to