info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Personality / Alias / Posting Style State of the Union?


From: Bruno Hertz
Subject: Re: Personality / Alias / Posting Style State of the Union?
Date: Wed, 13 Apr 2005 18:07:13 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Marc <address@hidden> writes:

> "Bruno Hertz" <address@hidden> writes:
>
>> gnus-alias.el, dating back to 2003, and apart from one or two minor
>> points it worked alright, with Emacs CVS in my case (IIRC, one issue
>
> Hi,
>
> Recently I tried to use gnus-alias.el and ran into a problem concerning
> the user-mail-address. The documentation says that 
> (setq gnus-alias-override-user-mail-address t)
> should force the user-mail-addres to match the one in the From field,
> but it seems to be broken (at least, in my tests it was not working)
> (this is anoying as the Return-Path field will be set according to this
> value by the MTA).
>
> 'address' field in posting-style is working fine.

OK, here's a complete list of things I did to get gnus-alias working
for me:

(1) message-functionp/assoc-ignore-case

If you're using Emacs CVS, change

- all occurences of 'message-functionp' into 'functionp'
- all occurences of '(assoc-ignore-case blah)' into
  '(assoc-string blah t)' or else you'll get compilation
  warnings/errors.

This might not be neccessary for older Emacs versions, so check
first if byte compilation goes OK

(2) message-send-and-exit

This function sets user-mail-address, i.e. effectively reply-to, from
the 'From field. In case that field contains your full name also, like
"Tom Jones" <address@hidden> that might cause mail servers to choke. I
changed this to pick just the mail address between '<' and '>', though
in a crude way. This surely breaks easily and can be done better, so
use it just as a starting point if you need it.

(defadvice message-send-and-exit
  (around message-send-and-exit-special-user-mail-address)
  "Temporarily change the value of `user-mail-address' (maybe)."

  (let ((user-mail-address
         (save-restriction
           (message-narrow-to-headers)
           (let* ((from (message-fetch-field "From" t)))
             (if (string-match "<" from)
                 (let* ((first (1+ (string-match "<" from)))
                        (last (string-match ">" from)))
                   (substring from first last))
               from)))))
    ad-do-it)
  )


(3) Enable advice (override-user-mail, forward-as-reply)

'gnus-alias-override-user-mail-address' and 'gnus-alias-allow-forward-as-reply'
functionality is implemented as advice, which isn't enabled nowhere
but the corresponding 'customize' functions. I.e. if you enable those
variables through the 'customize' interface they will work, otherwise
not.

So to get them working anyway, I put the following into my .gnus

(setq gnus-alias-override-user-mail-address t)
(ad-enable-advice 'message-send-and-exit 'around
   'message-send-and-exit-special-user-mail-address)
(ad-activate 'message-send-and-exit)
(setq gnus-alias-allow-forward-as-reply t)
(ad-enable-advice 'message-forward 'around
   'message-forward-with-reply-buffer)
(ad-activate 'message-forward)


And that's it. All of the above is obviously just quick hacking, but
it got me a working gnus-alias setup.

Regards, Bruno.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]