[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting wl-draft-folder depending on wl-draft-parent-folder



At Fri, 25 Apr 2014 09:41:50 -0700,
Nick Lanham wrote:
> 
> I'm trying to get my draft folder to be correct when switching
> between two different accounts.  I've got a simple function to set
> wl-draft-folder as:
> 
> ...
> 
> and then I do:
> (add-hook 'wl-mail-setup-hook 'my-wl-set-draft-folder)
> 
> 
> However, it seems the wl-draft-folder variable is actually used
> before this hook is run, so if I switch mailboxes, the first time I
> compose a draft it will use the wrong folder.  After that things
> will work until I switch back to the other account.
> 
> Is there a hook that runs early enough to fix this problem, or some
> other workaround for having the correct draft folder with multiple
> accounts?
> 

I use templates and draft config to setup two mail identities:

(setq wl-template-alist '(("default"
                           (wl-from . "David Maus <maus@hab.de>")
                           (wl-smtp-posting-server . "mail.hab.de")
                           (wl-smtp-posting-port . 25)
                           (wl-smtp-posting-user . "maus@hab.de")
                           (wl-smtp-authenticate-type . "plain")
                           (wl-smtp-connection-type . nil)
                           (mail-signature-file . (expand-file-name "signature.d/maus@hab.de" user-emacs-directory))
                           ("Organization" . "Herzog August Bibliothek Wolfenbuettel")
                           ("Fcc" . "%Sent:\"maus@hab.de\"@imap.hab.de:143")
                           ("From" . wl-from))
                          ("personal"
                           (wl-from . "David Maus <dmaus@ictsoc.de>")
                           (wl-smtp-posting-server . "mail.xlhost.de")
                           (wl-smtp-posting-port . 587)
                           (wl-smtp-posting-user . "dmaus@ictsoc.de")
                           (wl-smtp-authenticate-type . "plain")
                           (wl-smtp-connection-type . 'starttls)
                           ("Fcc" . "%Inbox:\"dmaus@ictsoc.de\"/clear@mail.xlhost.de:993!")
                           ("From" . wl-from))))

(setq wl-draft-config-alist '(((string-match "maus@hab.de" wl-draft-parent-folder)
                               (template . "default"))
                              ((string-match "dmaus@ictsoc.de" wl-draft-parent-folder)
                               (template . "personal"))))

If I set wl-draft-folder in the mail identity templates, then WL uses
the respective value if I start a draft in one of the folders
specified in wl-draft-config-alist.

Haven't tested this thoroughly, maybe it's a start.

Best,
  -- David

> Thanks!
> 
> -Nick
>