Hi Ken,

I'm actually just getting this set up myself and ran into the same problem. 
My solution was to replace each condition with something like this:

((and msg (mu4e-message-contact-field-matches msg :to "[email protected]"))
  "[email protected]")

If you have a lot of email addresses, it might be cleaner to put this short 
circuit outside the cond.

Chris

On Sunday, January 19, 2014 6:50:51 PM UTC-5, Ken Mankoff wrote:
>
> The example here 
> http://www.djcbsoftware.nl/code/mu/mu4e/Compose-hooks.html#Compose-hooksis 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...
>
>   -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] <javascript:>")
>   "[email protected] <javascript:>")
>  ((mu4e-message-contact-field-matches msg :to "[email protected] <javascript:>")
>   "[email protected] <javascript:>")
>  (t "[email protected] <javascript:>")))
>                     (setq user-mail-address "[email protected] <javascript:>") ; 
> default for COMPOSE
>  )))
>
>

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