--- /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 AB5F6429E25\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Oct 2011 12:51:38 -0700 (PDT)\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 GoqMQviCDqvt for <notmuch@notmuchmail.org>;\r
+ Tue, 11 Oct 2011 12:51:38 -0700 (PDT)\r
+Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222])\r
+ by olra.theworths.org (Postfix) with ESMTP id 32840431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 11 Oct 2011 12:51:38 -0700 (PDT)\r
+Received: from localhost.localdomain (nancy.schnouki.net [78.238.0.45])\r
+ by ks3536.kimsufi.com (Postfix) with ESMTPSA id 67D886A06A9;\r
+ Tue, 11 Oct 2011 21:51:37 +0200 (CEST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net;\r
+ s=key-schnouki; t=1318362697;\r
+ bh=6toTTnsBDw5AdgYTV3Mt8TAerlDNB+Woj1ns2zOHxZA=;\r
+ h=From:To:Subject:Date:Message-Id:In-Reply-To:References;\r
+ b=EuYXJCTN2m4Ck0SmVqZ6mAb+5GMOer/yy7Ae7JIwn1T32wwvSih5ppEH5oiucBKw9\r
+ jqK7AdVeQgPIOGuBqmaaxXAYgt830psHGY3YMVW5GjsySw/mc/9y3FJBekQeyC0/Ez\r
+ icnJIM0F7zOiLVmCk/HcNBVkGzrSNpHaDyaCCKmg=\r
+From: Thomas Jost <schnouki@schnouki.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] emacs: Support a message-mode switch function in\r
+ notmuch-mua\r
+Date: Tue, 11 Oct 2011 21:51:14 +0200\r
+Message-Id: <1318362674-17652-1-git-send-email-schnouki@schnouki.net>\r
+X-Mailer: git-send-email 1.7.7\r
+In-Reply-To: <8739eztijn.fsf@schnouki.net>\r
+References: <8739eztijn.fsf@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, 11 Oct 2011 19:51:38 -0000\r
+\r
+---\r
+ emacs/notmuch-mua.el | 21 +++++++++++++++++++--\r
+ 1 files changed, 19 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 8824b08..639407f 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -31,6 +31,20 @@\r
+ :group 'notmuch\r
+ :type 'hook)\r
+ \r
++(defcustom notmuch-mua-switch-function nil\r
++ "Function used to switch to and display a new mail buffer. If\r
++this is `nil' then the buffer will be displayed in the current\r
++window. Other common values are `switch-to-buffer-other-frame'\r
++and `switch-to-buffer-other-window'. If you change this, you may\r
++also want to change `message-sent-hook' accordingly:\r
++ (setq notmuch-muas-witch-function 'switch-to-buffer-other-frame)\r
++ (add-hook 'message-sent-hook '(delete-frame))"\r
++ :group 'notmuch\r
++ :type 'function\r
++ :options '(nil\r
++ switch-to-buffer-other-frame\r
++ switch-to-buffer-other-window))\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
+@@ -99,7 +113,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-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 +127,8 @@ list."\r
+ (message-goto-body))\r
+ \r
+ (defun notmuch-mua-forward-message ()\r
++ (when notmuch-mua-switch-function\r
++ (funcall notmuch-mua-switch-function (current-buffer)))\r
+ (message-forward)\r
+ \r
+ (when notmuch-mua-user-agent-function\r
+@@ -199,7 +216,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-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.7\r
+\r