--- /dev/null
+Return-Path: <dme@dme.org>\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 4692440D154\r
+ for <notmuch@notmuchmail.org>; Fri, 5 Nov 2010 02:51:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+ tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] 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 Ma0rrVAmfG3Y for <notmuch@notmuchmail.org>;\r
+ Fri, 5 Nov 2010 02:50:50 -0700 (PDT)\r
+Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com\r
+ [74.125.82.41]) by olra.theworths.org (Postfix) with ESMTP id 89EC94196F0 for\r
+ <notmuch@notmuchmail.org>; Fri, 5 Nov 2010 02:50:50 -0700 (PDT)\r
+Received: by wwi18 with SMTP id 18so1440957wwi.2\r
+ for <notmuch@notmuchmail.org>; Fri, 05 Nov 2010 02:50:49 -0700 (PDT)\r
+Received: by 10.216.35.78 with SMTP id t56mr1892644wea.34.1288950647751;\r
+ Fri, 05 Nov 2010 02:50:47 -0700 (PDT)\r
+Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com\r
+ [81.149.164.25])\r
+ by mx.google.com with ESMTPS id p4sm667614wej.4.2010.11.05.02.50.46\r
+ (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+ Fri, 05 Nov 2010 02:50:46 -0700 (PDT)\r
+Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
+ id 46E7459405B; Fri, 5 Nov 2010 09:50:16 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Add `notmuch-show-elide-same-subject',\r
+ controlling the appearance of collapsed messages in notmuch-show mode.\r
+Date: Fri, 5 Nov 2010 09:50:15 +0000\r
+Message-Id: <1288950615-32406-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.2.3\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: Fri, 05 Nov 2010 09:51:01 -0000\r
+\r
+If `notmuch-show-elide-same-subject' is set to `t' then collapsed\r
+messages do not show a "Subject:" line if the subject is the same as\r
+that of the previous message.\r
+---\r
+ emacs/notmuch-show.el | 38 ++++++++++++++++++++++++++++----------\r
+ 1 files changed, 28 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 7ec6aa5..07cf846 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -58,6 +58,12 @@ any given message."\r
+ :group 'notmuch\r
+ :type 'boolean)\r
+ \r
++(defcustom notmuch-show-elide-same-subject nil\r
++ "Do not show the subject of a collapsed message if it is the\r
++same as that of the previous message."\r
++ :group 'notmuch\r
++ :type 'boolean)\r
++\r
+ (defcustom notmuch-show-relative-dates t\r
+ "Display relative dates in the message summary line."\r
+ :group 'notmuch\r
+@@ -381,17 +387,24 @@ current buffer, if possible."\r
+ (defun notmuch-show-make-symbol (type)\r
+ (make-symbol (concat "notmuch-show-" type)))\r
+ \r
++(defun notmuch-show-strip-re (string)\r
++ (replace-regexp-in-string "^\\([Rr]e: *\\)+" "" string))\r
++\r
++(defvar notmuch-show-previous-subject "")\r
++(make-variable-buffer-local 'notmuch-show-previous-subject)\r
++\r
+ (defun notmuch-show-insert-msg (msg depth)\r
+ "Insert the message MSG at depth DEPTH in the current thread."\r
+- (let ((headers (plist-get msg :headers))\r
+- ;; Indentation causes the buffer offset of the start/end\r
+- ;; points to move, so we must use markers.\r
+- message-start message-end\r
+- content-start content-end\r
+- headers-start headers-end\r
+- body-start body-end\r
+- (headers-invis-spec (notmuch-show-make-symbol "header"))\r
+- (message-invis-spec (notmuch-show-make-symbol "message")))\r
++ (let* ((headers (plist-get msg :headers))\r
++ ;; Indentation causes the buffer offset of the start/end\r
++ ;; points to move, so we must use markers.\r
++ message-start message-end\r
++ content-start content-end\r
++ headers-start headers-end\r
++ body-start body-end\r
++ (headers-invis-spec (notmuch-show-make-symbol "header"))\r
++ (message-invis-spec (notmuch-show-make-symbol "message"))\r
++ (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))\r
+ \r
+ ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise\r
+ ;; removing items from `buffer-invisibility-spec' (which is what\r
+@@ -428,10 +441,15 @@ current buffer, if possible."\r
+ (insert "\n")\r
+ (save-excursion\r
+ (goto-char content-start)\r
+- (forward-line 1)\r
++ (when (and notmuch-show-elide-same-subject\r
++ (not (string= notmuch-show-previous-subject\r
++ bare-subject)))\r
++ (forward-line 1))\r
+ (setq headers-start (point-marker)))\r
+ (setq headers-end (point-marker))\r
+ \r
++ (setq notmuch-show-previous-subject bare-subject)\r
++\r
+ (setq body-start (point-marker))\r
+ (notmuch-show-insert-body msg (plist-get msg :body) depth)\r
+ ;; Ensure that the body ends with a newline.\r
+-- \r
+1.7.2.3\r
+\r