RE: [Spam-verdenking][english 100%] RE: Reply all - issue
[notmuch-archives.git] / ea / ba5a533ad64a9dbbf9bb609193db35cee4b6c2
1 Return-Path: <bremner@pivot.cs.unb.ca>\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 CEBA3431FBC\r
6         for <notmuch@notmuchmail.org>; Wed, 24 Feb 2010 10:30:51 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.256\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.256 tagged_above=-999 required=5\r
12         tests=[AWL=-0.257, BAYES_50=0.001] 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 c0j5CWQ+W7g0 for <notmuch@notmuchmail.org>;\r
16         Wed, 24 Feb 2010 10:30:51 -0800 (PST)\r
17 Received: from convex-new.cs.unb.ca (convex-new.cs.unb.ca [131.202.245.35])\r
18         by olra.theworths.org (Postfix) with ESMTP id 0652B431FAE\r
19         for <notmuch@notmuchmail.org>; Wed, 24 Feb 2010 10:30:50 -0800 (PST)\r
20 Received: from bremner by convex-new.cs.unb.ca with local (Exim 4.69)\r
21         (envelope-from <bremner@pivot.cs.unb.ca>)\r
22         id 1NkLzz-000633-O4; Wed, 24 Feb 2010 14:30:15 -0400\r
23 From: david@tethera.net\r
24 To: notmuch@notmuchmail.org\r
25 Date: Wed, 24 Feb 2010 14:30:06 -0400\r
26 Message-Id: <1267036206-23218-1-git-send-email-david@tethera.net>\r
27 X-Mailer: git-send-email 1.6.6\r
28 In-Reply-To: <87y6iiwlth.fsf@yoom.home.cworth.org>\r
29 References: <87y6iiwlth.fsf@yoom.home.cworth.org>\r
30 Cc: David Bremner <bremner@unb.ca>\r
31 Subject: [notmuch] [PATCH] notmuch.el: hide original message in top posted\r
32         replies.\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.13\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Wed, 24 Feb 2010 18:30:52 -0000\r
46 \r
47 From: David Bremner <bremner@unb.ca>\r
48 \r
49 This code treats top posted copies essentially like signatures, except\r
50 that it doesn't sanity check their length, since neither do their\r
51 senders.\r
52 \r
53 In an unrelated cleanup, remove the let definition of sig-end, since\r
54 it was unused.\r
55 \r
56 New user-visible variable:\r
57 \r
58   notmuch-show-original-button-format:   Allow customization of button text.\r
59 ---\r
60 \r
61 This is the unsquashed version of what was new in the v3 of the\r
62 citation patch, rebased against current master.\r
63 \r
64  notmuch.el |   40 ++++++++++++++++++++++++++++++++++++----\r
65  1 files changed, 36 insertions(+), 4 deletions(-)\r
66 \r
67 diff --git a/notmuch.el b/notmuch.el\r
68 index 6482170..b1a590f 100644\r
69 --- a/notmuch.el\r
70 +++ b/notmuch.el\r
71 @@ -107,9 +107,15 @@\r
72  The regexp can (and should) include $ to match the end of the\r
73  line, but should not include ^ to match the beginning of the\r
74  line. This is because notmuch may have inserted additional space\r
75 -for indentation at the beginning of the line. But notmuch will\r
76 -move past the indentation when testing this pattern, (so that the\r
77 -pattern can still test against the entire line).")\r
78 +for indentation at the beginning of the line.")\r
79 +\r
80 +(defvar notmuch-show-original-regexp "\\(--+\s?[oO]riginal [mM]essage\s?--+\\)$"\r
81 +  "Pattern to match a line that separates original message from reply in top-posted message.\r
82 +\r
83 +The regexp can (and should) include $ to match the end of the\r
84 +line, but should not include ^ to match the beginning of the\r
85 +line. This is because notmuch may have inserted additional space\r
86 +for indentation at the beginning of the line.")\r
87  \r
88  (defvar notmuch-show-signature-button-format\r
89    "[ %d-line signature. Click/Enter to toggle visibility. ]"\r
90 @@ -123,6 +129,13 @@ Can use up to one integer format parameter, i.e. %d")\r
91  \r
92  Can use up to one integer format parameter, i.e. %d")\r
93  \r
94 +(defvar notmuch-show-original-button-format \r
95 +  "[ %d-line hidden original message. Click/Enter to show ]"\r
96 +  "String used to construct button text for hidden copies of messages\r
97 +\r
98 +Can use up to one integer format parameter, i.e. %d")\r
99 +\r
100 +\r
101  (defvar notmuch-show-signature-lines-max 12\r
102    "Maximum length of signature that will be hidden by default.")\r
103  \r
104 @@ -717,6 +730,9 @@ which this thread was originally shown."\r
105    :supertype 'notmuch-button-invisibility-toggle-type)\r
106  (define-button-type 'notmuch-button-signature-toggle-type 'help-echo "mouse-1, RET: Show signature"\r
107    :supertype 'notmuch-button-invisibility-toggle-type)\r
108 +(define-button-type 'notmuch-button-original-toggle-type 'help-echo "mouse-1, RET: Show original message"\r
109 +  :supertype 'notmuch-button-invisibility-toggle-type)\r
110 +\r
111  (define-button-type 'notmuch-button-headers-toggle-type 'help-echo "mouse-1, RET: Show headers"\r
112    :supertype 'notmuch-button-invisibility-toggle-type)\r
113  (define-button-type 'notmuch-button-body-toggle-type\r
114 @@ -768,9 +784,25 @@ is what to put on the button."\r
115    (let ((citation-regexp (notmuch-show-citation-regexp depth))\r
116         (signature-regexp (concat (format "^[[:space:]]\\{%d\\}" depth)\r
117                                   notmuch-show-signature-regexp))\r
118 +       (original-regexp (concat (format "^[[:space:]]\\{%d\\}" depth) \r
119 +                                 notmuch-show-original-regexp))\r
120 +\r
121         (indent (concat "\n" (make-string depth ? ))))\r
122      (goto-char beg)\r
123      (beginning-of-line)\r
124 +\r
125 +    (if (and (< (point) end) \r
126 +            (re-search-forward original-regexp end t))\r
127 +       (let* ((msg-start (match-beginning 0))\r
128 +              (msg-lines (1- (count-lines msg-start end))))\r
129 +         (notmuch-show-region-to-button \r
130 +          msg-start\r
131 +          end\r
132 +          "original"\r
133 +          indent\r
134 +          (format notmuch-show-original-button-format msg-lines)\r
135 +          )))\r
136 +\r
137      (while (and (< (point) end)\r
138                 (re-search-forward citation-regexp end t))\r
139        (let* ((cite-start (match-beginning 0))\r
140 @@ -786,10 +818,10 @@ is what to put on the button."\r
141            (format notmuch-show-citation-button-format\r
142                    (- cite-lines notmuch-show-citation-lines-prefix))\r
143            ))))\r
144 +\r
145      (if (and (< (point) end)\r
146              (re-search-forward signature-regexp end t))\r
147         (let* ((sig-start (match-beginning 0))\r
148 -              (sig-end (match-end 0))\r
149                (sig-lines (1- (count-lines sig-start end))))\r
150           (if (<= sig-lines notmuch-show-signature-lines-max)\r
151               (notmuch-show-region-to-button\r
152 -- \r
153 1.6.6\r
154 \r