--- /dev/null
+Return-Path: <prvs=jrosenthal=663949bcc@jhu.edu>\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 8104D431FBC\r
+ for <notmuch@notmuchmail.org>; Tue, 23 Feb 2010 07:22:42 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -3.467\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-3.467 tagged_above=-999 required=5 tests=[AWL=0.718,\r
+ BAYES_40=-0.185, RCVD_IN_DNSWL_MED=-4] autolearn=ham\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 g2dapuNfWKm6 for <notmuch@notmuchmail.org>;\r
+ Tue, 23 Feb 2010 07:22:40 -0800 (PST)\r
+Received: from ipex2.johnshopkins.edu (ipex2.johnshopkins.edu [162.129.8.151])\r
+ by olra.theworths.org (Postfix) with ESMTP id A8147431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 23 Feb 2010 07:22:40 -0800 (PST)\r
+X-IronPort-AV: E=Sophos;i="4.49,526,1262581200"; d="scan'208";a="306798320"\r
+Received: from c-69-255-36-229.hsd1.md.comcast.net (HELO lucky)\r
+ ([69.255.36.229])\r
+ by ipex2.johnshopkins.edu with ESMTP/TLS/AES256-SHA;\r
+ 23 Feb 2010 10:22:38 -0500\r
+Received: from jkr by lucky with local (Exim 4.69)\r
+ (envelope-from <jrosenthal@jhu.edu>)\r
+ id 1Njwa5-0002nM-LD; Tue, 23 Feb 2010 10:21:49 -0500\r
+From: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+To: notmuch@notmuchmail.org\r
+In-Reply-To: <m1wryiayhg.fsf@watt.gilman.jhu.edu>\r
+References: <m1y6iybc5h.fsf@watt.gilman.jhu.edu>\r
+ <m1wryiayhg.fsf@watt.gilman.jhu.edu>\r
+Date: Tue, 23 Feb 2010 10:21:49 -0500\r
+Message-ID: <87ljekq8oi.fsf@jhu.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Subject: [notmuch] [PATCH V3] notmuch.el: Make notmuch-show buffer name\r
+ first subject, instead of thread-id (supersedes V1 and V2)\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, 23 Feb 2010 15:22:42 -0000\r
+\r
+Change the buffer name to a uniquified subject of the thread (i.e. the\r
+subject of the first message in the thread) instead of the thread-id. This\r
+is more meaningful to the user, and will make it easier to scroll through\r
+numerous open buffers.\r
+\r
+Note that this patch adds an optional `buffer-name' argument to notmuch\r
+show.\r
+\r
+This version supersedes V1 and V2 of this patch. It is rebased on HEAD,\r
+ensures that the buffer names are unique, and that the `notmuch-show'\r
+command can still be used interactively (fixing a clumsy bug in V2 which\r
+prevented that).\r
+\r
+Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>\r
+---\r
+ notmuch.el | 21 +++++++++++++++++----\r
+ 1 files changed, 17 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/notmuch.el b/notmuch.el\r
+index 6482170..685b2cd 100644\r
+--- a/notmuch.el\r
++++ b/notmuch.el\r
+@@ -1162,7 +1162,7 @@ All currently available key bindings:\r
+ (lambda()\r
+ (hl-line-mode 1) ))\r
+ \r
+-(defun notmuch-show (thread-id &optional parent-buffer query-context)\r
++(defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)\r
+ "Run \"notmuch show\" with the given thread ID and display results.\r
+ \r
+ The optional PARENT-BUFFER is the notmuch-search buffer from\r
+@@ -1172,7 +1172,10 @@ thread from that buffer can be show when done with this one).\r
+ The optional QUERY-CONTEXT is a notmuch search term. Only messages from the thread\r
+ matching this search term are shown if non-nil. "\r
+ (interactive "sNotmuch show: ")\r
+- (let ((buffer (get-buffer-create (concat "*notmuch-show-" thread-id "*"))))\r
++ (when (null (buffer-name))\r
++ (setq buffer-name (concat "*notmuch-" thread-id "*")))\r
++ (let* ((thread-buffer-name (generate-new-buffer-name buffer-name))\r
++ (buffer (get-buffer-create thread-buffer-name)))\r
+ (switch-to-buffer buffer)\r
+ (notmuch-show-mode)\r
+ (set (make-local-variable 'notmuch-show-parent-buffer) parent-buffer)\r
+@@ -1363,9 +1366,19 @@ Complete list of currently available key bindings:\r
+ (defun notmuch-search-show-thread ()\r
+ "Display the currently selected thread."\r
+ (interactive)\r
+- (let ((thread-id (notmuch-search-find-thread-id)))\r
++ (let ((thread-id (notmuch-search-find-thread-id))\r
++ (subject (notmuch-search-find-subject))\r
++ buffer-name)\r
++ (when (string-match "^[ \t]*$" subject)\r
++ (setq subject "[No Subject]"))\r
++ (setq buffer-name (concat "*"\r
++ (truncate-string-to-width subject 32 nil nil t)\r
++ "*"))\r
+ (if (> (length thread-id) 0)\r
+- (notmuch-show thread-id (current-buffer) notmuch-search-query-string)\r
++ (notmuch-show thread-id\r
++ (current-buffer)\r
++ notmuch-search-query-string\r
++ buffer-name)\r
+ (error "End of search results"))))\r
+ \r
+ (defun notmuch-search-reply-to-thread ()\r
+-- \r
+1.6.3.3\r
+\r