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

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



At Sun, 27 Apr 2014 19:31:20 +0200,
David Maus wrote:
> 
> 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.

Thanks for the tip.  By "set wl-draft-folder" do you mean just adding something like:

...
  ("personal"
   (wl-from . "Nick Lanham <nick@afternight.org>")
   (wl-smtp-posting-server . "afternight.org")
   (wl-draft-folder . "%Drafts:nick/login@afternight.org")
...

because that's quite similar to what I was trying before and it doesn't seem to work at all for me.  The other settings take effect (i.e. smtp server etc), but the draft folder never changes (the variable is set correctly, but wl saves the drafts to the wrong folder and the wrong folder is specified in the mode line).  This is exactly what the emacs wiki page was saying the problem was.  My function+hook made things a bit better, but I'm still looking for something that works 100%.  I might just add to summary-mode-hook which I think will work but feels a bit hacky.

Cheers,

Nick


> 
> Haven't tested this thoroughly, maybe it's a start.
> 
> Best,
>   -- David
> 
> > Thanks!
> > 
> > -Nick
> > 
>