Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Follow up to group for mailing lists
@ 2012-09-09 20:06 Cecil Westerhof
  2012-09-09 21:16 ` Charles Philip Chan
       [not found] ` <mailman.8476.1347225384.855.info-gnus-english@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Cecil Westerhof @ 2012-09-09 20:06 UTC (permalink / raw)
  To: info-gnus-english

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-info@lists.sourceforge.net")
                                    .
                                    .
                                    .
                                    ("bedrijf/ontwikkeling/scala"    . "scala-user@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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-09 23:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-09 20:06 Follow up to group for mailing lists Cecil Westerhof
2012-09-09 21:16 ` Charles Philip Chan
     [not found] ` <mailman.8476.1347225384.855.info-gnus-english@gnu.org>
2012-09-09 23:00   ` Cecil Westerhof

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).