On Monday Jan 20 2014, [email protected] wrote:

> The example 
> here http://www.djcbsoftware.nl/code/mu/mu4e/Compose-hooks.html#Compose-hooks 
> is a nice example and when I hit "reply" my outgoing message is now based 
> on who the incoming message was sent to.
>
> But when I try to compose a new message, rather than reply, it fails, with 
> "message must be non-nil".
>
> I've tried modifying that function (see below), but cannot get it to work. 
> Advice much appreciated...

Yeah, 'msg' is nil in the compose case; this was left as an excercise
for the reader; I see you almost fixed it, but you'd use
     (when msg
instead of the fboundp.

Cheers,
Dirk.

>   -k.
>
>
> (add-hook 'mu4e-compose-pre-hook
>   (defun my-set-from-address ()
>     "Set the From address based on the To address of the original."
>     (let ((msg mu4e-compose-parent-message)) ;; msg is shorter...
>                   (if (boundp 'msg) 
>   (setq user-mail-address 
> (cond
>  ((mu4e-message-contact-field-matches msg :to "[email protected]")
>   "[email protected]")
>  ((mu4e-message-contact-field-matches msg :to "[email protected]")
>   "[email protected]")
>  (t "[email protected]")))
>                     (setq user-mail-address "[email protected]") ; default for 
> COMPOSE
>  )))
 



-- 
Dirk-Jan C. Binnema                  Helsinki, Finland
e:[email protected]           w:www.djcbsoftware.nl
pgp: D09C E664 897D 7D39 5047 A178 E96A C7A1 017D DA3C

-- 
You received this message because you are subscribed to the Google Groups 
"mu-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to