I did find a much better way to fill the To address. The sequence of the
fields is also not changed. It is possible to later still fill the To
field with the correct value, after having emptied it. (For example when
the reply the field is filled with the address of the sender instead of
with the address of the mailing list.) Is there a function to empty the
To field?

The only problem is that I know how to check for message-mode, but I do
not know how to differentiate between an article and an e-mail message.
With an article for a newsgroup there is no To field. Properly not a
very important problem. What is the chance that the name of a e-mail
folder will look like the name of a newsgroup? Still, if someone knows
how to differentiate ...

    (defvar dcbl-gnus-to-addresses nil
      "A list of group names and to-addesses to use;")
    (setq   dcbl-gnus-to-addresses  '(
        ("INBOX\\.Info\\.bbdb"         . "bbdb-i...@lists.sourceforge.net")
        ("INBOX\\.Info\\.clisp"        . "clisp-l...@lists.sourceforge.net")
        ("INBOX\\.Info\\.ffmpeg"       . "ffmpeg-u...@mplayerhq.hu")
        ("INBOX\\.Info.\\Floss"        . "fl...@vrijschrift.nl")
        ("INBOX\\.Info\\.OpenOffice"   . "gebruik...@nl.openoffice.org")
        ("INBOX\\.Info\\.openSUSE"     . "opensuse-fact...@opensuse.org")
        ("INBOX\\.Info\\.org-mode"     . "emacs-orgm...@gnu.org")
        ("INBOX\\.Info\\.slime"        . "slime-de...@common-lisp.net")
        ("INBOX\\.Info\\.spamassassin" . "us...@spamassassin.apache.org")
        ("INBOX\\.KDE"                 . "kde-i18n...@kde.org")
        ("INBOX\\.NLLGG\\.Leden"       . "stamta...@lists.nllgg.nl")
        ("INBOX\\.NLLGG\\.Linux"       . "li...@lists.nllgg.nl")
        ("INBOX\\.NLLGG\\.Starter"     . "linux-star...@lists.nllgg.nl")
        ))

    ;; Fill To-address
    (defadvice gnus-summary-mail-other-window (after formalities () activate)
      (dcbl-fill-to-address))

    (defun dcbl-fill-to-address ()
      "Determine what to-address to use on the current message;"
      (let ((to-address nil))
        (when (and (string= major-mode "message-mode")
                   gnus-newsgroup-name
                   (not (message-fetch-field "To")))
          (dolist (item dcbl-gnus-to-addresses)
            (when (string-match (car item) gnus-newsgroup-name)
              (setq to-address (cdr item))))
          (when to-address
            (message-goto-to)
            (insert to-address)
            (message-goto-subject)))))

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

Reply via email to