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

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



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:

(defun my-wl-set-draft-folder ()
  "Set the right folder for the draft"
  (if (not (eq nil (string-match "work.domain" wl-draft-parent-folder)))
      (setq wl-draft-folder "%Drafts:user/plain@work.domain")
    (setq wl-draft-folder "%[Gmail]/Drafts") ))

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?

Thanks!

-Nick