--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 B23C1431FB6\r
+ for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 03:47:20 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_DNSWL_LOW=-0.7] 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 HbaoozFY4dIU for <notmuch@notmuchmail.org>;\r
+ Tue, 25 Dec 2012 03:47:20 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+ [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 0A902431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 03:47:19 -0800 (PST)\r
+Received: by mail-wi0-f181.google.com with SMTP id hm9so4396319wib.14\r
+ for <notmuch@notmuchmail.org>; Tue, 25 Dec 2012 03:47:18 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to\r
+ :references; bh=x86aCTQG0pbWn0QDbnfFRqxURSBPbhK0zoZ1d/q7F50=;\r
+ b=bGxfB0gK2EradHRJQuKzIMPq5IsNI7Kaww/MeBOyb0BzlK2T+R8dB6ONZ1YWbhoKjA\r
+ Jwcvl7uDFXAacUJbmvllbRqFOhrhbhTdisLYHB7xyfXSPmoiiKZkioO/2g2Jg0WJYwyZ\r
+ 6FIiBGTO0PPkbrdUZD3lVEedRGp+w5QSUBxYhOia1eArwXlLbIxJtT1gYtrGdjJ0dXmL\r
+ IkdTb5o5mOU041jdYlktFml095ZusL3bVXREiB0oiHUx+JmSm3cJyjUn5E7HO6oCCqTc\r
+ P8gGfgDO9ocTwrVP/DHfjlDXSrBhatExBbtcsZa+HKvseyZYKtkXBJebCfspGL86THEd\r
+ R4vw==\r
+X-Received: by 10.194.71.140 with SMTP id v12mr39400114wju.36.1356436038906;\r
+ Tue, 25 Dec 2012 03:47:18 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPS id bw9sm20886001wib.5.2012.12.25.03.47.17\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Tue, 25 Dec 2012 03:47:18 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] contrib: pick: close message pane when quitting from show in\r
+ the message pane\r
+Date: Tue, 25 Dec 2012 11:47:17 +0000\r
+Message-Id: <1356436037-15597-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1355650241-27196-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1355650241-27196-1-git-send-email-markwalters1009@gmail.com>\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, 25 Dec 2012 11:47:20 -0000\r
+\r
+We add a hook to the show buffer in the message window to close the\r
+message window when that buffer quits. It checks that the\r
+message-window is still displaying the show-message buffer and then\r
+closes it.\r
+---\r
+This is just a slightly tidier version of the previous patch. It is\r
+more natural to reuse the nomuch-pick-message-window variable (as it\r
+serves the same pupose) rather than adding a new variable and\r
+cluttering up the name space (and it also keeps the clutter in the\r
+notmuch-pick namespace).\r
+\r
+I think this a good candidate for 0.15: it fixes an annoying bug in pick. \r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+ contrib/notmuch-pick/notmuch-pick.el | 19 +++++++++++++++++++\r
+ 1 files changed, 19 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el\r
+index 1a553d4..7d01f4c 100644\r
+--- a/contrib/notmuch-pick/notmuch-pick.el\r
++++ b/contrib/notmuch-pick/notmuch-pick.el\r
+@@ -157,6 +157,10 @@\r
+ (make-variable-buffer-local 'notmuch-pick-query-context)\r
+ (defvar notmuch-pick-buffer-name nil)\r
+ (make-variable-buffer-local 'notmuch-pick-buffer-name)\r
++;; This variable is the window used for the message pane. It is set\r
++;; in both the parent pick buffer and the child show buffer. It is\r
++;; used to try and close the message pane when quitting pick or the\r
++;; child show buffer.\r
+ (defvar notmuch-pick-message-window nil)\r
+ (make-variable-buffer-local 'notmuch-pick-message-window)\r
+ (put 'notmuch-pick-message-window 'permanent-local t)\r
+@@ -324,6 +328,16 @@ Does NOT change the database."\r
+ (notmuch-prettify-subject (notmuch-search-find-subject)))\r
+ (notmuch-pick-show-match-message-with-wait))\r
+ \r
++(defun notmuch-pick-message-window-kill-hook ()\r
++ (let ((buffer (current-buffer)))\r
++ (when (and (window-live-p notmuch-pick-message-window)\r
++ (eq (window-buffer notmuch-pick-message-window) buffer))\r
++ ;; We do not want an error if this is the sole window in the\r
++ ;; frame and I do not know how to test for that in emacs pre\r
++ ;; 24. Hence we just ignore-errors.\r
++ (ignore-errors\r
++ (delete-window notmuch-pick-message-window)))))\r
++\r
+ (defun notmuch-pick-show-message ()\r
+ "Show the current message (in split-pane)."\r
+ (interactive)\r
+@@ -341,6 +355,11 @@ Does NOT change the database."\r
+ (let ((notmuch-show-indent-messages-width 0))\r
+ (setq current-prefix-arg '(4))\r
+ (setq buffer (notmuch-show id nil nil nil))))\r
++ ;; We need the `let' as notmuch-pick-message-window is buffer local.\r
++ (let ((window notmuch-pick-message-window))\r
++ (with-current-buffer buffer\r
++ (setq notmuch-pick-message-window window)\r
++ (add-hook 'kill-buffer-hook 'notmuch-pick-message-window-kill-hook)))\r
+ (notmuch-pick-tag-update-display (list "-unread"))\r
+ (setq notmuch-pick-message-buffer buffer))))\r
+ \r
+-- \r
+1.7.9.1\r
+\r