mu4e: better handling of closing compose frames

Use message-mode actions to close the compose
frame (`mu4e-compose-in-new-frame') whenever we're finished editing a
message.
This commit is contained in:
djcb 2016-02-20 12:25:21 +02:00
parent ace2f2ad2c
commit a0f0e95344
2 changed files with 10 additions and 11 deletions

View File

@ -438,7 +438,14 @@ tempfile)."
;; hide some headers
(mu4e~compose-hide-headers)
;; switch on the mode
(mu4e-compose-mode))
(mu4e-compose-mode)
(when mu4e-compose-in-new-frame
;; make sure to close the frame when we're done with
;; the message
;; these are all buffer-local;
(push 'delete-frame message-exit-actions)
(push 'delete-frame message-kill-actions)
(push 'delete-frame message-postpone-actions)))
(defun mu4e-sent-handler (docid path)
"Handler function, called with DOCID and PATH for the just-sent
@ -452,16 +459,8 @@ the appropriate flag at the message forwarded or replied-to."
(dolist (buf (buffer-list))
(when (and (buffer-file-name buf)
(string= (buffer-file-name buf) path))
(if (and mu4e-compose-in-new-frame (window-system))
(progn
(switch-to-buffer buf)
(when (and (get-buffer-window buf)
(window-frame (get-buffer-window buf)))
(delete-frame (window-frame (get-buffer-window buf)))))
)
(if message-kill-buffer-on-exit
(kill-buffer buf))
))
(kill-buffer buf))))
;; now, try to go back to some previous buffer, in the order
;; view->headers->main
(if (buffer-live-p mu4e~view-buffer)

View File

@ -404,7 +404,7 @@ fields will be the same as in the original."
(defun mu4e~draft-open-file (path)
"Open the the draft file at PATH."
(if (and mu4e-compose-in-new-frame (window-system))
(if mu4e-compose-in-new-frame
(find-file-other-frame path)
(find-file path)))