unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Setting gnus-message-archive-group in message-send-hook
@ 2011-09-17 11:41 Marcin Wlodarczak
  2011-09-19  3:41 ` Tim Landscheidt
  0 siblings, 1 reply; 7+ messages in thread
From: Marcin Wlodarczak @ 2011-09-17 11:41 UTC (permalink / raw)
  To: help-gnu-emacs


Hi,

I'm trying to set gnus-message-archive-group depending on the From:
address, using the message-send-hook. Here is what I've got so
far:

(add-hook 'message-send-hook 'my-select-archive-group)
(defun my-select-archive-group ()
  (let ((from-address (mail-fetch-field "from")))
    (cond ((search "uni" from-address)
           (setq gnus-message-archive-group "nnimap+uni:Sent"))
	  ((search "gmail" from-address)
           (setq gnus-message-archive-group "nnimap+gmail:[Google Mail]/Sent Mail")))))

The problem is, however, that this only sets the Gcc line for the
*following message* not the one being sent. What am I doing wrong
here?

Best,
Marcin



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

* Re: Setting gnus-message-archive-group in message-send-hook
  2011-09-17 11:41 Setting gnus-message-archive-group in message-send-hook Marcin Wlodarczak
@ 2011-09-19  3:41 ` Tim Landscheidt
  2011-09-19  8:33   ` Marcin Wlodarczak
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Landscheidt @ 2011-09-19  3:41 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Wlodarczak <mwlodarczak@gmail.com> wrote:

> I'm trying to set gnus-message-archive-group depending on the From:
> address, using the message-send-hook. Here is what I've got so
> far:

> (add-hook 'message-send-hook 'my-select-archive-group)
> (defun my-select-archive-group ()
>   (let ((from-address (mail-fetch-field "from")))
>     (cond ((search "uni" from-address)
>            (setq gnus-message-archive-group "nnimap+uni:Sent"))
> 	  ((search "gmail" from-address)
>            (setq gnus-message-archive-group "nnimap+gmail:[Google Mail]/Sent Mail")))))

> The problem is, however, that this only sets the Gcc line for the
> *following message* not the one being sent. What am I doing wrong
> here?

Either change the Gcc: header in your hook, or - probably
preferable - see if the fine manual for
gnus-message-archive-group can be applied in your case:

| If you want to save your mail in one group and the news articles you
| write in another group, you could say something like:

|  (setq gnus-message-archive-group
| 	'((if (message-news-p)
| 	      "misc-news"
| 	    "misc-mail")))

Tim




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

* Re: Setting gnus-message-archive-group in message-send-hook
  2011-09-19  3:41 ` Tim Landscheidt
@ 2011-09-19  8:33   ` Marcin Wlodarczak
  2011-09-20 22:53     ` Tim Landscheidt
  0 siblings, 1 reply; 7+ messages in thread
From: Marcin Wlodarczak @ 2011-09-19  8:33 UTC (permalink / raw)
  To: help-gnu-emacs

Tim Landscheidt <tim@tim-landscheidt.de> writes:
>> The problem is, however, that this only sets the Gcc line for the
>> *following message* not the one being sent. What am I doing wrong
>> here?
>
> Either change the Gcc: header in your hook, or - probably
> preferable - see if the fine manual for
> gnus-message-archive-group can be applied in your case:

Thanks but I don't quite follow. I thought setting
gnus-message-archive-group is the way to change the Gcc header.
Anyway, as I mentioned, it does work (it sets the Gcc line to the
specified group) but too late as it were.



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

* Re: Setting gnus-message-archive-group in message-send-hook
  2011-09-19  8:33   ` Marcin Wlodarczak
@ 2011-09-20 22:53     ` Tim Landscheidt
  2011-09-21  9:05       ` Marcin Wlodarczak
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Landscheidt @ 2011-09-20 22:53 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Wlodarczak <mwlodarczak@gmail.com> wrote:

>>> The problem is, however, that this only sets the Gcc line for the
>>> *following message* not the one being sent. What am I doing wrong
>>> here?

>> Either change the Gcc: header in your hook, or - probably
>> preferable - see if the fine manual for
>> gnus-message-archive-group can be applied in your case:

> Thanks but I don't quite follow. I thought setting
> gnus-message-archive-group is the way to change the Gcc header.
> Anyway, as I mentioned, it does work (it sets the Gcc line to the
> specified group) but too late as it were.

gnus-message-archive-group specifies which (if any) Gcc:
header is inserted when a message buffer is *created*. The
Gcc: header at the time of *sending* the message specifies
where it is archived.

Tim

P. S.: Please don't post and mail at the same time. Thanks!




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

* Re: Setting gnus-message-archive-group in message-send-hook
  2011-09-20 22:53     ` Tim Landscheidt
@ 2011-09-21  9:05       ` Marcin Wlodarczak
  2011-09-23 16:15         ` Tim Landscheidt
  0 siblings, 1 reply; 7+ messages in thread
From: Marcin Wlodarczak @ 2011-09-21  9:05 UTC (permalink / raw)
  To: help-gnu-emacs

On 21.09.2011 00:53, Tim Landscheidt wrote:
> gnus-message-archive-group specifies which (if any) Gcc:
> header is inserted when a message buffer is *created*. The
> Gcc: header at the time of *sending* the message specifies
> where it is archived.

OK, got it now thanks. Using

(progn (setq gnus-outgoing-message-group "nnimap+uni+Sent")
       (gnus-inews-insert gcc))

does the trick. Thanks.

> P. S.: Please don't post and mail at the same time. Thanks!

Sorry. Still getting to grips with Gnus.

Cheers,
Marcin




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

* Re: Setting gnus-message-archive-group in message-send-hook
  2011-09-21  9:05       ` Marcin Wlodarczak
@ 2011-09-23 16:15         ` Tim Landscheidt
  2011-09-23 22:26           ` Marcin Wlodarczak
  0 siblings, 1 reply; 7+ messages in thread
From: Tim Landscheidt @ 2011-09-23 16:15 UTC (permalink / raw)
  To: help-gnu-emacs

Marcin Wlodarczak <mwlodarczak@gmail.com> wrote:

>> gnus-message-archive-group specifies which (if any) Gcc:
>> header is inserted when a message buffer is *created*. The
>> Gcc: header at the time of *sending* the message specifies
>> where it is archived.

> OK, got it now thanks. Using

> (progn (setq gnus-outgoing-message-group "nnimap+uni+Sent")
>        (gnus-inews-insert gcc))

> does the trick. Thanks.
> [...]

If possible, I would follow the manual more closely though.
Using the hook will mean that any changes you make to the
Gcc: header manually while composing the message will be
overwritten. This is probably not disastrous, but can be
irritating.

Tim




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

* Re: Setting gnus-message-archive-group in message-send-hook
  2011-09-23 16:15         ` Tim Landscheidt
@ 2011-09-23 22:26           ` Marcin Wlodarczak
  0 siblings, 0 replies; 7+ messages in thread
From: Marcin Wlodarczak @ 2011-09-23 22:26 UTC (permalink / raw)
  To: help-gnu-emacs

On 09/23/2011 06:15 PM, Tim Landscheidt wrote:
> Marcin Wlodarczak <mwlodarczak@gmail.com> wrote:
> 
>>> gnus-message-archive-group specifies which (if any) Gcc:
>>> header is inserted when a message buffer is *created*. The
>>> Gcc: header at the time of *sending* the message specifies
>>> where it is archived.
>> OK, got it now thanks. Using
>> (progn (setq gnus-outgoing-message-group "nnimap+uni+Sent")
>>        (gnus-inews-insert gcc))
>> does the trick. Thanks.
>> [...]
> If possible, I would follow the manual more closely though.
> Using the hook will mean that any changes you make to the
> Gcc: header manually while composing the message will be
> overwritten. This is probably not disastrous, but can be
> irritating.

I see what you mean but I think I'm going to stick to this solution
right now. Thanks. -- M.




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

end of thread, other threads:[~2011-09-23 22:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-17 11:41 Setting gnus-message-archive-group in message-send-hook Marcin Wlodarczak
2011-09-19  3:41 ` Tim Landscheidt
2011-09-19  8:33   ` Marcin Wlodarczak
2011-09-20 22:53     ` Tim Landscheidt
2011-09-21  9:05       ` Marcin Wlodarczak
2011-09-23 16:15         ` Tim Landscheidt
2011-09-23 22:26           ` Marcin Wlodarczak

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 read-only IMAP folder(s) and NNTP newsgroup(s).