1 Return-Path: <dme@dme.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 4692440D154
\r
6 for <notmuch@notmuchmail.org>; Fri, 5 Nov 2010 02:51:01 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5
\r
12 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id Ma0rrVAmfG3Y for <notmuch@notmuchmail.org>;
\r
16 Fri, 5 Nov 2010 02:50:50 -0700 (PDT)
\r
17 Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com
\r
18 [74.125.82.41]) by olra.theworths.org (Postfix) with ESMTP id 89EC94196F0 for
\r
19 <notmuch@notmuchmail.org>; Fri, 5 Nov 2010 02:50:50 -0700 (PDT)
\r
20 Received: by wwi18 with SMTP id 18so1440957wwi.2
\r
21 for <notmuch@notmuchmail.org>; Fri, 05 Nov 2010 02:50:49 -0700 (PDT)
\r
22 Received: by 10.216.35.78 with SMTP id t56mr1892644wea.34.1288950647751;
\r
23 Fri, 05 Nov 2010 02:50:47 -0700 (PDT)
\r
24 Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com
\r
26 by mx.google.com with ESMTPS id p4sm667614wej.4.2010.11.05.02.50.46
\r
27 (version=TLSv1/SSLv3 cipher=RC4-MD5);
\r
28 Fri, 05 Nov 2010 02:50:46 -0700 (PDT)
\r
29 Received: by ut.hh.sledj.net (Postfix, from userid 1000)
\r
30 id 46E7459405B; Fri, 5 Nov 2010 09:50:16 +0000 (GMT)
\r
31 From: David Edmondson <dme@dme.org>
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH] emacs: Add `notmuch-show-elide-same-subject',
\r
34 controlling the appearance of collapsed messages in notmuch-show mode.
\r
35 Date: Fri, 5 Nov 2010 09:50:15 +0000
\r
36 Message-Id: <1288950615-32406-1-git-send-email-dme@dme.org>
\r
37 X-Mailer: git-send-email 1.7.2.3
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Fri, 05 Nov 2010 09:51:01 -0000
\r
52 If `notmuch-show-elide-same-subject' is set to `t' then collapsed
\r
53 messages do not show a "Subject:" line if the subject is the same as
\r
54 that of the previous message.
\r
56 emacs/notmuch-show.el | 38 ++++++++++++++++++++++++++++----------
\r
57 1 files changed, 28 insertions(+), 10 deletions(-)
\r
59 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
60 index 7ec6aa5..07cf846 100644
\r
61 --- a/emacs/notmuch-show.el
\r
62 +++ b/emacs/notmuch-show.el
\r
63 @@ -58,6 +58,12 @@ any given message."
\r
67 +(defcustom notmuch-show-elide-same-subject nil
\r
68 + "Do not show the subject of a collapsed message if it is the
\r
69 +same as that of the previous message."
\r
73 (defcustom notmuch-show-relative-dates t
\r
74 "Display relative dates in the message summary line."
\r
76 @@ -381,17 +387,24 @@ current buffer, if possible."
\r
77 (defun notmuch-show-make-symbol (type)
\r
78 (make-symbol (concat "notmuch-show-" type)))
\r
80 +(defun notmuch-show-strip-re (string)
\r
81 + (replace-regexp-in-string "^\\([Rr]e: *\\)+" "" string))
\r
83 +(defvar notmuch-show-previous-subject "")
\r
84 +(make-variable-buffer-local 'notmuch-show-previous-subject)
\r
86 (defun notmuch-show-insert-msg (msg depth)
\r
87 "Insert the message MSG at depth DEPTH in the current thread."
\r
88 - (let ((headers (plist-get msg :headers))
\r
89 - ;; Indentation causes the buffer offset of the start/end
\r
90 - ;; points to move, so we must use markers.
\r
91 - message-start message-end
\r
92 - content-start content-end
\r
93 - headers-start headers-end
\r
94 - body-start body-end
\r
95 - (headers-invis-spec (notmuch-show-make-symbol "header"))
\r
96 - (message-invis-spec (notmuch-show-make-symbol "message")))
\r
97 + (let* ((headers (plist-get msg :headers))
\r
98 + ;; Indentation causes the buffer offset of the start/end
\r
99 + ;; points to move, so we must use markers.
\r
100 + message-start message-end
\r
101 + content-start content-end
\r
102 + headers-start headers-end
\r
103 + body-start body-end
\r
104 + (headers-invis-spec (notmuch-show-make-symbol "header"))
\r
105 + (message-invis-spec (notmuch-show-make-symbol "message"))
\r
106 + (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))
\r
108 ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
\r
109 ;; removing items from `buffer-invisibility-spec' (which is what
\r
110 @@ -428,10 +441,15 @@ current buffer, if possible."
\r
113 (goto-char content-start)
\r
115 + (when (and notmuch-show-elide-same-subject
\r
116 + (not (string= notmuch-show-previous-subject
\r
118 + (forward-line 1))
\r
119 (setq headers-start (point-marker)))
\r
120 (setq headers-end (point-marker))
\r
122 + (setq notmuch-show-previous-subject bare-subject)
\r
124 (setq body-start (point-marker))
\r
125 (notmuch-show-insert-body msg (plist-get msg :body) depth)
\r
126 ;; Ensure that the body ends with a newline.
\r