[PATCH] emacs: Elide the display of repeated subjects in thread display mode.
authorDavid Edmondson <dme@dme.org>
Mon, 8 Nov 2010 10:44:08 +0000 (10:44 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:24 +0000 (09:37 -0800)
a5/d885aeac59e519878ea2dba8005ab7c433294d [new file with mode: 0644]

diff --git a/a5/d885aeac59e519878ea2dba8005ab7c433294d b/a5/d885aeac59e519878ea2dba8005ab7c433294d
new file mode 100644 (file)
index 0000000..5550151
--- /dev/null
@@ -0,0 +1,123 @@
+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 D3F4F40DAC7\r
+       for <notmuch@notmuchmail.org>; Mon,  8 Nov 2010 02:45:24 -0800 (PST)\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 mdHNGTRPjUHe for <notmuch@notmuchmail.org>;\r
+       Mon,  8 Nov 2010 02:45:14 -0800 (PST)\r
+Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
+       [74.125.82.181])\r
+       by olra.theworths.org (Postfix) with ESMTP id 51AF840DAC2\r
+       for <notmuch@notmuchmail.org>; Mon,  8 Nov 2010 02:45:14 -0800 (PST)\r
+Received: by wyb40 with SMTP id 40so5745544wyb.26\r
+       for <notmuch@notmuchmail.org>; Mon, 08 Nov 2010 02:45:13 -0800 (PST)\r
+Received: by 10.216.179.81 with SMTP id g59mr4084696wem.35.1289213113406;\r
+       Mon, 08 Nov 2010 02:45:13 -0800 (PST)\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 e12sm2991684wer.36.2010.11.08.02.45.11\r
+       (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+       Mon, 08 Nov 2010 02:45:12 -0800 (PST)\r
+Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
+       id 9854259405B; Mon,  8 Nov 2010 10:44:09 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Elide the display of repeated subjects in thread\r
+       display mode.\r
+Date: Mon,  8 Nov 2010 10:44:08 +0000\r
+Message-Id: <1289213048-24332-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <878w17psjr.fsf@yoom.home.cworth.org>\r
+References: <878w17psjr.fsf@yoom.home.cworth.org>\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: Mon, 08 Nov 2010 10:45:25 -0000\r
+\r
+Collapsed messages do not show a "Subject:" line if the subject is the\r
+same as that of the previous message.\r
+---\r
+\r
+Remove the preference setting.\r
+\r
+ emacs/notmuch-show.el |   34 ++++++++++++++++++++++++----------\r
+ 1 files changed, 24 insertions(+), 10 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 7ec6aa5..13964c2 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -381,17 +381,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 +435,17 @@ current buffer, if possible."\r
+     (insert "\n")\r
+     (save-excursion\r
+       (goto-char content-start)\r
+-      (forward-line 1)\r
++      ;; If the subject of this message is the same as that of the\r
++      ;; previous message, don't display it when this message is\r
++      ;; collapsed.\r
++      (when (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