Gnus development mailing list
 help / color / mirror / Atom feed
* Posting styles override message-alternative-emails
@ 2005-09-10 11:36 Reiner Steib
  2005-09-10 20:37 ` Romain Francoise
  0 siblings, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2005-09-10 11:36 UTC (permalink / raw)


Hi,

assume you have this values for `gnus-posting-styles'[1] and
`message-alternative-emails'[2]:

(setq
 gnus-posting-styles
 '((".*"
    (address "from-posting-styles@some-domain.invalid")
    (x-other "stuff")))
 message-alternative-emails "reiner.*steib"
 user-mail-address "user-mail@address.invalid")

When replying to a message with "To: Reiner Steib <reinersteib+gmane@imap.cc>"
the function `message-setup-1' inserts...

| From: reinersteib+gmane@imap.cc

But after this, `message-mode-hook' (?) modified by `gnus-msg.el'
unconditionally replaces the From with the value from
`gnus-posting-styles':

| From: Reiner Steib <from-posting-styles@some-domain.invalid>

Suggestions:

(1a) It should be documented that posting styles overwrite values from
     `message-alternative-emails'.

*or*

(1b) Posting styles should *not* overwrite the From if it was derived
     from `message-alternative-emails'.

I'd clearly prefer (1b).

(2) `message-alternative-emails' should also use `user-full-name'.

The feature to use "To" or "Cc" as "From" has often been requested (at
least in the German Gnus newsgroup).  Unaware of
`message-alternative-emails', I used this code[3] based on posting
styles upto now.

Bye, Reiner.

[1] (info "(gnus)Posting Styles")

[2]
,----[ (info "(message)Message Headers") ]
| `message-alternative-emails'
|      A regexp to match the alternative email addresses.  The first
|      matched address (not primary one) is used in the `From' field.
`----

[3]
--8<---------------cut here---------------start------------->8---
(defvar rs-message-to-from-addresses gnus-ignored-from-addresses
  "Regexp matching To headers.

When using entries like

  ((message-mail-p)
   (address (rs-message-to-from-address)))

or

  ((message-mail-p)
   (address (rs-message-to-from-address \"foo@example.invalid\")))

in `gnus-posting-styles', the address in the From header is taken
from the To header of the article you are replying to.")

;;;###autoload
(defun rs-message-to-from-address (&optional fallback)
  "Return a suitable address.

See `rs-message-to-from-addresses' for more."
  (let ((to (and (boundp 'gnus-article-buffer)
		 (gnus-buffer-live-p gnus-article-buffer)
		 ;; `gnus-buffer-live-p' already returns
		 ;; `gnus-article-buffer', but it's not documented.  So
		 ;; let's be careful.
		 gnus-article-buffer
		 (with-current-buffer gnus-article-buffer
		   (message-fetch-field "to")))))
    (cond ((and to
		(not (string-match "," to));; FIXME
		(string-match rs-message-to-from-addresses to))
	   (let ((from (cadr (mail-extract-address-components to))))
	     ;; gnus-extract-address-components fails for Outlook stuff:
	     ;; To: "'reiner.steib@...'" <reiner.steib@...>
	     (if (and (string-match rs-message-to-from-addresses from)
		      (string-match
		       (concat "^"
			       (if (boundp 'gnus-button-valid-localpart-regexp)
				   gnus-button-valid-localpart-regexp
				 "[a-z0-9-_+.]+")
			       "@" message-valid-fqdn-regexp "$")
		       from))
		 from
	       (if (y-or-n-p
		    (format "Address <%s> might be bogus.  Use anyway? "
			    from))
		   from))))
	  (fallback fallback)
	  (t user-mail-address))))
--8<---------------cut here---------------end--------------->8---
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: Posting styles override message-alternative-emails
  2005-09-10 11:36 Posting styles override message-alternative-emails Reiner Steib
@ 2005-09-10 20:37 ` Romain Francoise
  2005-09-11  9:05   ` Reiner Steib
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Francoise @ 2005-09-10 20:37 UTC (permalink / raw)


Reiner Steib <reinersteib+gmane@imap.cc> writes:

> (1b) Posting styles should *not* overwrite the From if it was derived
>      from `message-alternative-emails'.

Probably, yes.  And the documentation could use some improvement, what
this variable does isn't immediately obvious...

> (2) `message-alternative-emails' should also use `user-full-name'.

What do you mean?  By default?

-- 
Romain Francoise <romain@orebokech.com> | All you've been is a piece of
it's a miracle -- http://orebokech.com/ | blood wrapped in skin.



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

* Re: Posting styles override message-alternative-emails
  2005-09-10 20:37 ` Romain Francoise
@ 2005-09-11  9:05   ` Reiner Steib
  2005-09-11 16:53     ` Romain Francoise
  0 siblings, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2005-09-11  9:05 UTC (permalink / raw)


On Sat, Sep 10 2005, Romain Francoise wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>
>> (1b) Posting styles should *not* overwrite the From if it was derived
>>      from `message-alternative-emails'.
>
> Probably, yes.  And the documentation could use some improvement, what
> this variable does isn't immediately obvious...

ACK.  I stumbled over `message-alternative-emails' in `message.el'
when looking for something different.  ;-)

(I don't have time to work on this soon; I'd be glad if you could.) 

>> (2) `message-alternative-emails' should also use `user-full-name'.
>
> What do you mean?  By default?

Yes, because `message' also adds `user-full-name' by default
(emacs-cvs -Q ..., `M-x message-mail RET'), AFAICS.

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




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

* Re: Posting styles override message-alternative-emails
  2005-09-11  9:05   ` Reiner Steib
@ 2005-09-11 16:53     ` Romain Francoise
  2006-01-31 14:21       ` Reiner Steib
  0 siblings, 1 reply; 6+ messages in thread
From: Romain Francoise @ 2005-09-11 16:53 UTC (permalink / raw)


Reiner Steib <reinersteib+gmane@imap.cc> writes:

> (I don't have time to work on this soon; I'd be glad if you could.) 

Ok; `message-use-alternative-email-as-from' will now have precedence
over pretty much everything, it's called after `message-setup-hook'
(from where posting styles modify the buffer).  I also improved the
corresponding documentation.

Feedback welcome,

-- 
Romain Francoise <romain@orebokech.com> | 夏草や兵どもが夢の跡
it's a miracle -- http://orebokech.com/ |             (芭蕉)



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

* Re: Posting styles override message-alternative-emails
  2005-09-11 16:53     ` Romain Francoise
@ 2006-01-31 14:21       ` Reiner Steib
  2006-01-31 14:46         ` Romain Francoise
  0 siblings, 1 reply; 6+ messages in thread
From: Reiner Steib @ 2006-01-31 14:21 UTC (permalink / raw)
  Cc: Romain Francoise

On Sun, Sep 11 2005, Romain Francoise wrote:

> Reiner Steib <reinersteib+gmane@imap.cc> writes:
>
>> (I don't have time to work on this soon; I'd be glad if you could.) 
>
> Ok; `message-use-alternative-email-as-from' will now have precedence
> over pretty much everything, it's called after `message-setup-hook'
> (from where posting styles modify the buffer).  I also improved the
> corresponding documentation.

Thanks.

According to reports on the German Gnus group [1],
`message-alternative-emails' works fine in the trunk.  Is there any
reason _not_ to install it in v5-10?

Bye, Reiner.

[1] <news:87lkx4p1v3.fsf@snobis.de>
    http://www.google.com/groups?as_umsgid=87lkx4p1v3.fsf%40snobis.de
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



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

* Re: Posting styles override message-alternative-emails
  2006-01-31 14:21       ` Reiner Steib
@ 2006-01-31 14:46         ` Romain Francoise
  0 siblings, 0 replies; 6+ messages in thread
From: Romain Francoise @ 2006-01-31 14:46 UTC (permalink / raw)


Reiner Steib <reinersteib+gmane@imap.cc> writes:

> According to reports on the German Gnus group [1],
> `message-alternative-emails' works fine in the trunk.

Good.

> Is there any reason _not_ to install it in v5-10?

If it works, I guess there isn't... I've now merged my changes in the
v5-10 branch as well.

Thanks,

-- 
Romain Francoise <romain@orebokech.com> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
                                        | ever free! --Bryan W. Procter



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

end of thread, other threads:[~2006-01-31 14:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-10 11:36 Posting styles override message-alternative-emails Reiner Steib
2005-09-10 20:37 ` Romain Francoise
2005-09-11  9:05   ` Reiner Steib
2005-09-11 16:53     ` Romain Francoise
2006-01-31 14:21       ` Reiner Steib
2006-01-31 14:46         ` Romain Francoise

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).