mu4e: fix compose cancel orphaning a buffer

Create buffer contents _before_ creating the file.
This commit is contained in:
Thomas Moulia
2016-01-31 21:48:41 -08:00
committed by djcb
parent 420479dd94
commit e3434c2772

View File

@ -430,16 +430,17 @@ from either `mu4e~draft-reply-construct', or
(format "%s/%s/cur/%s" (format "%s/%s/cur/%s"
mu4e-maildir mu4e-maildir
draft-dir draft-dir
(mu4e~draft-message-filename-construct "DS")))) (mu4e~draft-message-filename-construct "DS")))
(if (and mu4e-compose-in-new-frame (window-system)) (initial-contents
(find-file-other-frame draft-path)
(find-file draft-path)))
(insert
(case compose-type (case compose-type
(reply (mu4e~draft-reply-construct msg)) (reply (mu4e~draft-reply-construct msg))
(forward (mu4e~draft-forward-construct msg)) (forward (mu4e~draft-forward-construct msg))
(new (mu4e~draft-newmsg-construct)) (new (mu4e~draft-newmsg-construct))
(t (mu4e-error "unsupported compose-type %S" compose-type)))) (t (mu4e-error "unsupported compose-type %S" compose-type)))))
(if (and mu4e-compose-in-new-frame (window-system))
(find-file-other-frame draft-path)
(find-file draft-path))
(insert initial-contents))
(newline) (newline)
;; include the message signature (if it's set) ;; include the message signature (if it's set)
(if (and mu4e-compose-signature-auto-include mu4e-compose-signature) (if (and mu4e-compose-signature-auto-include mu4e-compose-signature)