Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 88ED1431FD0 for ; Tue, 25 Oct 2011 00:41:31 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TFk8uuePvlyu for ; Tue, 25 Oct 2011 00:41:31 -0700 (PDT) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id CD3A9431FB6 for ; Tue, 25 Oct 2011 00:41:30 -0700 (PDT) Received: from localhost.localdomain (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id 2667D6A0005; Tue, 25 Oct 2011 09:41:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1319528490; bh=5vrxszd3ckHNYDrSoHoSTFUNrnBGXJn8Zfrwm52XPbI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References; b=c9n8i8VwDM3YMebzPSMTMa8fxvDkVthOeBF9nPme9KCH4shj+IunuBXFp0usvOJW7 3BUs4iXj3ch+YGFbD+364oJyXlientx8nrs9TqKfNEmaiIqKfTc2h6FHVCu20bsb29 5NGIG6bkIggRBz8Jf0mz0ma6V8tSW4H2WrQy1bLQ= From: Thomas Jost To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Let the user choose where to compose new mails Date: Tue, 25 Oct 2011 09:41:04 +0200 Message-Id: <1319528464-22654-1-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.7 In-Reply-To: <87pqhlh64c.fsf@thor.loria.fr> References: <87pqhlh64c.fsf@thor.loria.fr> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Oct 2011 07:41:31 -0000 --- emacs/notmuch-mua.el | 37 +++++++++++++++++++++++++++++++++++-- 1 files changed, 35 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index 8824b08..ebc922f 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -31,6 +31,34 @@ :group 'notmuch :type 'hook) +(defvar notmuch-mua-switch-function nil + "Function used to switch and display the mail buffer. This is + normally set by `notmuch-mua-compose-in'.") +(defvar notmuch-mua-dedicated-flag nil + "Flag to pass to `set-window-dedicated-p' in the mail buffer. + This is normally set by `notmuch-mua-compose-in'.") +(defcustom notmuch-mua-compose-in 'current-window + "Where to create the mail buffer used to compose a new message. + Possible values are `current-window' (default), `new-window' + and `new-frame'. If set to `new-window' or `new-frame', the + mail buffer will be displayer in a new window/frame that will + be destroyed when the buffer is killed. You may want to + customize `message-kill-buffer-on-exit' accordingly." + :group 'notmuch + :type 'symbol + :set (lambda (sym val) + (cond ((eq val 'current-window) + (setq notmuch-mua-switch-function nil + notmuch-mua-dedicated-flag nil)) + ((eq val 'new-window) + (setq notmuch-mua-switch-function 'switch-to-buffer-other-window + notmuch-mua-dedicated-flag 1)) + ((eq val 'new-frame) + (setq notmuch-mua-switch-function 'switch-to-buffer-other-frame + notmuch-mua-dedicated-flag 1)) + (t (error (concat "Bad value for notmuch-mua-compose-in: " + (symbol-value val))))))) + (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full "Function used to generate a `User-Agent:' string. If this is `nil' then no `User-Agent:' will be generated." @@ -99,7 +127,8 @@ list." ((same-window-regexps '("\\*mail .*"))) (notmuch-mua-mail (mail-header 'to headers) (mail-header 'subject headers) - (message-headers-to-generate headers t '(to subject)))) + (message-headers-to-generate headers t '(to subject)) + nil notmuch-mua-switch-function)) ;; insert the message body - but put it in front of the signature ;; if one is present (goto-char (point-max)) @@ -112,6 +141,8 @@ list." (message-goto-body)) (defun notmuch-mua-forward-message () + (when notmuch-mua-switch-function + (funcall notmuch-mua-switch-function (current-buffer))) (message-forward) (when notmuch-mua-user-agent-function @@ -121,6 +152,7 @@ list." (message-sort-headers) (message-hide-headers) (set-buffer-modified-p nil) + (set-window-dedicated-p (selected-window) notmuch-mua-dedicated-flag) (message-goto-to)) @@ -143,6 +175,7 @@ list." (message-sort-headers) (message-hide-headers) (set-buffer-modified-p nil) + (set-window-dedicated-p (selected-window) notmuch-mua-dedicated-flag) (message-goto-to)) @@ -199,7 +232,7 @@ the From: address first." (let ((other-headers (when (or prompt-for-sender notmuch-always-prompt-for-sender) (list (cons 'from (notmuch-mua-prompt-for-sender)))))) - (notmuch-mua-mail nil nil other-headers))) + (notmuch-mua-mail nil nil other-headers nil notmuch-mua-switch-function))) (defun notmuch-mua-new-forward-message (&optional prompt-for-sender) "Invoke the notmuch message forwarding window. -- 1.7.7