unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* hooks and mail
@ 2003-11-30 16:54 Guldo K
  2003-11-30 18:59 ` François Fleuret
  0 siblings, 1 reply; 4+ messages in thread
From: Guldo K @ 2003-11-30 16:54 UTC (permalink / raw)


Hello.
I'm sorry, but I can't understand how do hooks work.
I'd like to set reply-to to a certain value;
I wrote:
(add-hook 'vm-mail-hook
  '(lambda()
    (setq mail-default-reply-to "me@host.xyz")
  )
)

but it does not work.
I tried some other sintaxes, with no luck.
How can it be achieved?
What's that lambda() I found in emacs manual,
I can't understand.

Can't the value of a variable be used in a hook?
Such as '(setq variable 'other-var-value) ?

Thanks,

Guldo

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

* Re: hooks and mail
  2003-11-30 16:54 hooks and mail Guldo K
@ 2003-11-30 18:59 ` François Fleuret
  2003-11-30 23:00   ` Guldo K
  0 siblings, 1 reply; 4+ messages in thread
From: François Fleuret @ 2003-11-30 18:59 UTC (permalink / raw)


Hi,

> I'm sorry, but I can't understand how do hooks work.
> I'd like to set reply-to to a certain value;

There are two issues here ... How to set mail-default-reply-to's value
and how to make hooks.

To set mail-default-reply-to, I guess a simple

(setq-default mail-default-reply-to "my.other.name@my.other.address")

somewhere in your .emacs should do it.

For the hook

> (add-hook 'vm-mail-hook
>   '(lambda()
>     (setq mail-default-reply-to "me@host.xyz")
>   )
> )

I guess you should remove the ' before the function definition (at
least I dont have it in my own hook definitions).

Regards,

-- 
François Fleuret

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

* Re: hooks and mail
  2003-11-30 18:59 ` François Fleuret
@ 2003-11-30 23:00   ` Guldo K
  2003-12-01 21:50     ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Guldo K @ 2003-11-30 23:00 UTC (permalink / raw)


François Fleuret <francois.fleuret@inria.fr> writes:

> There are two issues here ... How to set mail-default-reply-to's value
> and how to make hooks.
> 
> To set mail-default-reply-to, I guess a simple
> (setq-default mail-default-reply-to "my.other.name@my.other.address")
> somewhere in your .emacs should do it.

This is OK, thanks.

> For the hook
> 
> > (add-hook 'vm-mail-hook
> >   '(lambda()
> >     (setq mail-default-reply-to "me@host.xyz")
> >   )
> > )
> 
> I guess you should remove the ' before the function definition (at
> least I dont have it in my own hook definitions).

It does not work.

In fact, what I'm trying to achieve is:
set reply-to to the active user-mail-address,
whenever I start composing a new message.
(or a reply, or a follow-up)
So that if I change user-mail-address while
vm is open, and then I compose a new message,
this new message has already a right reply-to
field in its header.

Thanks a lot,

Guldo

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

* Re: hooks and mail
  2003-11-30 23:00   ` Guldo K
@ 2003-12-01 21:50     ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-12-01 21:50 UTC (permalink / raw)


Guldo K wrote:
 > Franc,ois Fleuret <francois.fleuret@inria.fr> writes:
 >>>(add-hook 'vm-mail-hook
 >>>  '(lambda()
 >>>    (setq mail-default-reply-to "me@host.xyz")
 >>>  )
 >>>)
 >>>
 >>I guess you should remove the ' before the function definition (at
 >>least I dont have it in my own hook definitions).

Yes, lambda is self-quoting.

 > It does not work.
 >
 > In fact, what I'm trying to achieve is: set reply-to to the active
 > user-mail-address, whenever I start composing a new message.  (or a
 > reply, or a follow-up) So that if I change user-mail-address while vm
 > is open, and then I compose a new message, this new message has
 > already a right reply-to field in its header.

It might be that since vm-mail-hook is run after the composition buffer
is created, it is too late to specify mail-default-reply-to for the
intended effect.  How about this instead:

(defadvice vm-mail-internal (before mail-default-reply-to activate)
   "Set `mail-default-reply-to' to `user-mail-address'."
   (setq mail-default-reply-to user-mail-address))

-- 
Kevin Rodgers

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

end of thread, other threads:[~2003-12-01 21:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-30 16:54 hooks and mail Guldo K
2003-11-30 18:59 ` François Fleuret
2003-11-30 23:00   ` Guldo K
2003-12-01 21:50     ` Kevin Rodgers

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