--- /dev/null
+Return-Path: <sojkam1@fel.cvut.cz>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id A8B196DE19CB\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Jan 2016 08:48:02 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.61\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.61 tagged_above=-999 required=5 tests=[AWL=1.240, \r
+ RCVD_IN_DNSWL_MED=-2.3,\r
+ RP_MATCHES_RCVD=-0.55] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id FC-srW3xjxo1 for <notmuch@notmuchmail.org>;\r
+ Sat, 2 Jan 2016 08:48:01 -0800 (PST)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 80A0A6DE191A\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Jan 2016 08:47:58 -0800 (PST)\r
+Received: from localhost (unknown [192.168.200.7])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id F311019F48F6\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Jan 2016 17:47:55 +0100 (CET)\r
+X-Virus-Scanned: IMAP STYX AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+ by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new, port 10044)\r
+ with ESMTP id 1JkxRsIzWXnD for <notmuch@notmuchmail.org>;\r
+ Sat, 2 Jan 2016 17:47:54 +0100 (CET)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id 821E919F48E1\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Jan 2016 17:47:53 +0100 (CET)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.86)\r
+ (envelope-from <sojkam1@fel.cvut.cz>)\r
+ id 1aFPLM-0007BN-8F; Sat, 02 Jan 2016 17:47:52 +0100\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/3] emacs: Handle switch-function argument of\r
+ notmuch-mua-mail\r
+Date: Sat, 2 Jan 2016 17:47:45 +0100\r
+Message-Id: <1451753265-26713-4-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 2.6.4\r
+In-Reply-To: <1451753265-26713-1-git-send-email-sojkam1@fel.cvut.cz>\r
+References: <1451753265-26713-1-git-send-email-sojkam1@fel.cvut.cz>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 02 Jan 2016 16:48:02 -0000\r
+\r
+notmuch-mua-mail ignored the switch-function argument and always used\r
+the function returned by notmuch-mua-get-switch-function instead. In\r
+order to support standard emacs interfaces (compose-mail in this\r
+case), this commit changes notmuch-mua-mail to use the switch-function\r
+argument if it is non-nil and notmuch-mua-get-switch-function\r
+otherwise.\r
+---\r
+ emacs/notmuch-mua.el | 9 +++++----\r
+ 1 file changed, 5 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 2d6825d..45a6daa 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -278,7 +278,7 @@ Note that these functions use `mail-citation-hook' if that is non-nil."\r
+ (define-key notmuch-message-mode-map (kbd "C-c C-c") #'notmuch-mua-send-and-exit)\r
+ (define-key notmuch-message-mode-map (kbd "C-c C-s") #'notmuch-mua-send)\r
+ \r
+-(defun notmuch-mua-pop-to-buffer (name)\r
++(defun notmuch-mua-pop-to-buffer (name switch-function)\r
+ "Pop to buffer NAME, and warn if it already exists and is\r
+ modified. This function is notmuch addaptation of\r
+ `message-pop-to-buffer'."\r
+@@ -291,7 +291,7 @@ modified. This function is notmuch addaptation of\r
+ (progn\r
+ (gnus-select-frame-set-input-focus (window-frame window))\r
+ (select-window window))\r
+- (funcall (notmuch-mua-get-switch-function) buffer)\r
++ (funcall switch-function buffer)\r
+ (set-buffer buffer))\r
+ (when (and (buffer-modified-p)\r
+ (not (prog1\r
+@@ -299,7 +299,7 @@ modified. This function is notmuch addaptation of\r
+ "Message already being composed; erase? ")\r
+ (message nil))))\r
+ (error "Message being composed")))\r
+- (funcall (notmuch-mua-get-switch-function) name)\r
++ (funcall switch-function name)\r
+ (set-buffer name))\r
+ (erase-buffer)\r
+ (notmuch-message-mode)))\r
+@@ -319,7 +319,8 @@ modified. This function is notmuch addaptation of\r
+ (push (cons 'From (concat\r
+ (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
+ \r
+- (notmuch-mua-pop-to-buffer (message-buffer-name "mail" to))\r
++ (notmuch-mua-pop-to-buffer (message-buffer-name "mail" to)\r
++ (or switch-function (notmuch-mua-get-switch-function)))\r
+ (let ((headers\r
+ ;; The following sexp is copied from `message-mail'\r
+ (nconc\r
+-- \r
+2.6.4\r
+\r