Mu4e: add support for composing in a new frame

Adds the variable mu4e-compose-in-new-frame and when set to t, message
are composed in a new frame rather than the current one.
This commit is contained in:
Pan Jie 2014-09-24 22:06:26 +08:00 committed by djcb
parent 976711c16c
commit 64959382b9
3 changed files with 25 additions and 5 deletions

View File

@ -1,3 +1,4 @@
;; -*-mode: emacs-lisp; tab-width: 8; indent-tabs-mode: t -*-
;; mu4e-compose.el -- part of mu4e, the mu mail user agent for emacs ;; mu4e-compose.el -- part of mu4e, the mu mail user agent for emacs
;; ;;
;; Copyright (C) 2011-2012 Dirk-Jan C. Binnema ;; Copyright (C) 2011-2012 Dirk-Jan C. Binnema
@ -401,7 +402,14 @@ the appropriate flag at the message forwarded or replied-to."
(when (and (buffer-file-name buf) (when (and (buffer-file-name buf)
(string= (buffer-file-name buf) path) (string= (buffer-file-name buf) path)
message-kill-buffer-on-exit) message-kill-buffer-on-exit)
(kill-buffer buf))) (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)))
(kill-buffer buf)
(delete-frame (window-frame (get-buffer-window buf))))
(kill-buffer buf)))))
;; now, try to go back to some previous buffer, in the order ;; now, try to go back to some previous buffer, in the order
;; view->headers->main ;; view->headers->main
(if (buffer-live-p mu4e~view-buffer) (if (buffer-live-p mu4e~view-buffer)

View File

@ -73,6 +73,12 @@ message; if nil, only do so when sending the message."
:type 'boolean :type 'boolean
:group 'mu4e-compose) :group 'mu4e-compose)
(defcustom mu4e-compose-in-new-frame nil
"Whether to compose messages in a new frame instead of the
current window."
:type 'boolean
:group 'mu4e-compose)
(defun mu4e~draft-user-agent-construct () (defun mu4e~draft-user-agent-construct ()
"Return the User-Agent string for mu4e. "Return the User-Agent string for mu4e.
This is either the value of `mu4e-user-agent', or, if not set, a This is either the value of `mu4e-user-agent', or, if not set, a
@ -414,7 +420,9 @@ from either `mu4e~draft-reply-construct', or
;; path, but we cannot really know 'drafts folder'... we make a guess ;; path, but we cannot really know 'drafts folder'... we make a guess
(progn (progn
(setq draft-dir (mu4e~guess-maildir (mu4e-message-field msg :path))) (setq draft-dir (mu4e~guess-maildir (mu4e-message-field msg :path)))
(find-file (mu4e-message-field msg :path))) (if (and mu4e-compose-in-new-frame (window-system))
(find-file-other-frame (mu4e-message-field msg :path))
(find-file (mu4e-message-field msg :path))))
;; case-2: creating a new message; in this case, we can determing ;; case-2: creating a new message; in this case, we can determing
;; mu4e-get-drafts-folder ;; mu4e-get-drafts-folder
(progn (progn
@ -424,7 +432,9 @@ from either `mu4e~draft-reply-construct', or
mu4e-maildir mu4e-maildir
draft-dir draft-dir
(mu4e~draft-message-filename-construct "DS")))) (mu4e~draft-message-filename-construct "DS"))))
(find-file draft-path)) (if (and mu4e-compose-in-new-frame (window-system))
(find-file-other-frame draft-path)
(find-file draft-path)))
(insert (insert
(case compose-type (case compose-type
(reply (mu4e~draft-reply-construct msg)) (reply (mu4e~draft-reply-construct msg))

View File

@ -3428,6 +3428,8 @@ Sending...done
@end verbatim @end verbatim
The first and final messages are the most important, and there may be The first and final messages are the most important, and there may be
considerable time between them, depending on the size of the message. considerable time between them, depending on the size of the message.
@item @emph{Is it possible to compose messages in a separate frame?}
Yes - set the variable @code{mu4e-compose-in-new-frame} to @code{t}.
@item @emph{How can I apply format=flowed to my outgoing messages, enabling @item @emph{How can I apply format=flowed to my outgoing messages, enabling
receiving clients that support this feature to reflow my paragraphs?} receiving clients that support this feature to reflow my paragraphs?}
Plain text emails with @t{Content-Type: text/plain; format=flowed} can Plain text emails with @t{Content-Type: text/plain; format=flowed} can
@ -3486,8 +3488,8 @@ when sending a reply to some e-mail. This seems to be caused by
@t{mu4e} is working on it. To prevent this, deactivate @t{notmuch} in @t{mu4e} is working on it. To prevent this, deactivate @t{notmuch} in
your Emacs setup. your Emacs setup.
@item @emph{The PDF-version of the manual does not show any of the non-ASCII @item @emph{The PDF-version of the manual does not show any of the non-ASCII
characters} - this is because, sadly, @t{texi2pdf} documentation system characters} - this is because the @t{texi2pdf} documentation system does
does not support those. There is not much we can do about that. not support those. There is not much we can do about that.
@end itemize @end itemize
For a more complete list, please refer to the issues-list in the For a more complete list, please refer to the issues-list in the