--- /dev/null
+Return-Path: <schnouki@schnouki.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 92171429E25\r
+ for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 09:32:31 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id UEyR5jUf4ZRr for <notmuch@notmuchmail.org>;\r
+ Tue, 13 Dec 2011 09:32:30 -0800 (PST)\r
+Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
+ by olra.theworths.org (Postfix) with ESMTP id 1209B429E26\r
+ for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 09:32:30 -0800 (PST)\r
+Received: from thor.loria.fr (thor.loria.fr [152.81.12.250])\r
+ by ks3536.kimsufi.com (Postfix) with ESMTPSA id 6749D6A0028;\r
+ Tue, 13 Dec 2011 18:32:29 +0100 (CET)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
+ s=key-schnouki; t=1323797549;\r
+ bh=/mU8q2lhptXpKRUhKjUrVmoxFF1hX6Jw0wR4NjZFo8I=;\r
+ h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
+ b=OUkRsa6Y2+kFsa0LoffWalLcpGRrMd+IomIdQbUxWAfLLmydYBFSttgHjwijRcB5q\r
+ 00cfY8+fPX/JV5r+QvYK2S/0IBGxR2v0wt287EItVfDAnDNdi9FRSJkhpNNZ+wZfGc\r
+ m4URxAt4oea04GlYYfr+Ig7IVYebKZEYqXeCa5eY=\r
+From: Thomas Jost <schnouki@schnouki.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 1/4] emacs: Let the user choose where to compose new mails\r
+Date: Tue, 13 Dec 2011 18:32:09 +0100\r
+Message-Id: <1323797532-597-2-git-send-email-schnouki@schnouki.net>\r
+X-Mailer: git-send-email 1.7.8\r
+In-Reply-To: <1323797532-597-1-git-send-email-schnouki@schnouki.net>\r
+References: <87d3cx2t38.fsf@rocinante.cs.unb.ca>\r
+ <1323797532-597-1-git-send-email-schnouki@schnouki.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 13 Dec 2011 17:32:31 -0000\r
+\r
+Reusing the current window to compose a new mail may be troublesome for the\r
+user. This patch introduces a new customizable variable, notmuch-mua-compose-in,\r
+which lets the user choose where to create the mail buffer: in the current\r
+window (current and default behaviour), in a new window, or in a new frame.\r
+---\r
+ emacs/notmuch-mua.el | 40 ++++++++++++++++++++++++++++++++++++++--\r
+ 1 files changed, 38 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 8824b08..90834d6 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -31,6 +31,21 @@\r
+ :group 'notmuch\r
+ :type 'hook)\r
+ \r
++(defcustom notmuch-mua-compose-in 'current-window\r
++ "Where to create the mail buffer used to compose a new message.\r
++ Possible values are `current-window' (default), `new-window'\r
++ and `new-frame'. If set to `current-window', the mail buffer\r
++ will be displayed in the current window, so the old buffer will\r
++ be restored when the mail buffer is killed. If set to\r
++ `new-window' or `new-frame', the mail buffer will be displayed\r
++ in a new window/frame that will be destroyed when the buffer is\r
++ killed. You may want to customize `message-kill-buffer-on-exit'\r
++ accordingly."\r
++ :group 'notmuch\r
++ :type '(choice (const :tag "Compose in the current window" current-window)\r
++ (const :tag "Compose mail in a new window" new-window)\r
++ (const :tag "Compose mail in a new frame" new-frame)))\r
++\r
+ (defcustom notmuch-mua-user-agent-function 'notmuch-mua-user-agent-full\r
+ "Function used to generate a `User-Agent:' string. If this is\r
+ `nil' then no `User-Agent:' will be generated."\r
+@@ -48,6 +63,23 @@ list."\r
+ \r
+ ;;\r
+ \r
++(defun notmuch-mua-get-switch-function ()\r
++ "Get a switch function according to `notmuch-mua-compose-in'."\r
++ (cond ((eq notmuch-mua-compose-in 'current-window)\r
++ 'switch-to-buffer)\r
++ ((eq notmuch-mua-compose-in 'new-window)\r
++ 'switch-to-buffer-other-window)\r
++ ((eq notmuch-mua-compose-in 'new-frame)\r
++ 'switch-to-buffer-other-frame)\r
++ (t (error "Invalid value for `notmuch-mua-compose-in'"))))\r
++\r
++(defun notmuch-mua-maybe-set-window-dedicated ()\r
++ "Set the selected window as dedicated according to\r
++`notmuch-mua-compose-in'."\r
++ (when (or (eq notmuch-mua-compose-in 'new-frame)\r
++ (eq notmuch-mua-compose-in 'new-window))\r
++ (set-window-dedicated-p (selected-window) t)))\r
++\r
+ (defun notmuch-mua-user-agent-full ()\r
+ "Generate a `User-Agent:' string suitable for notmuch."\r
+ (concat (notmuch-mua-user-agent-notmuch)\r
+@@ -99,7 +131,8 @@ list."\r
+ ((same-window-regexps '("\\*mail .*")))\r
+ (notmuch-mua-mail (mail-header 'to headers)\r
+ (mail-header 'subject headers)\r
+- (message-headers-to-generate headers t '(to subject))))\r
++ (message-headers-to-generate headers t '(to subject))\r
++ nil (notmuch-mua-get-switch-function)))\r
+ ;; insert the message body - but put it in front of the signature\r
+ ;; if one is present\r
+ (goto-char (point-max))\r
+@@ -112,6 +145,7 @@ list."\r
+ (message-goto-body))\r
+ \r
+ (defun notmuch-mua-forward-message ()\r
++ (funcall (notmuch-mua-get-switch-function) (current-buffer))\r
+ (message-forward)\r
+ \r
+ (when notmuch-mua-user-agent-function\r
+@@ -121,6 +155,7 @@ list."\r
+ (message-sort-headers)\r
+ (message-hide-headers)\r
+ (set-buffer-modified-p nil)\r
++ (notmuch-mua-maybe-set-window-dedicated)\r
+ \r
+ (message-goto-to))\r
+ \r
+@@ -143,6 +178,7 @@ list."\r
+ (message-sort-headers)\r
+ (message-hide-headers)\r
+ (set-buffer-modified-p nil)\r
++ (notmuch-mua-maybe-set-window-dedicated)\r
+ \r
+ (message-goto-to))\r
+ \r
+@@ -199,7 +235,7 @@ the From: address first."\r
+ (let ((other-headers\r
+ (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
+ (list (cons 'from (notmuch-mua-prompt-for-sender))))))\r
+- (notmuch-mua-mail nil nil other-headers)))\r
++ (notmuch-mua-mail nil nil other-headers nil (notmuch-mua-get-switch-function))))\r
+ \r
+ (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
+ "Invoke the notmuch message forwarding window.\r
+-- \r
+1.7.8\r
+\r