Re: Avoiding the "huge INBOX of death"
[notmuch-archives.git] / 57 / e56a66d8348bc0d97ab9b23fa7cce18dea0641
1 Return-Path: <m.walters@qmul.ac.uk>\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 D662C431FAF\r
6         for <notmuch@notmuchmail.org>; Mon, 27 May 2013 15:19:27 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id V+kyC8Rn01G9 for <notmuch@notmuchmail.org>;\r
17         Mon, 27 May 2013 15:19:21 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id AE8F0431FAE\r
22         for <notmuch@notmuchmail.org>; Mon, 27 May 2013 15:19:21 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1Uh5lA-0001WV-9R; Mon, 27 May 2013 23:19:20 +0100\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1Uh5lA-00064Y-0p; Mon, 27 May 2013 23:19:20 +0100\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH 2/4] emacs: Record part p-list in a text property\r
34 In-Reply-To: <1369687594-31774-3-git-send-email-amdragon@mit.edu>\r
35 References: <1369687594-31774-1-git-send-email-amdragon@mit.edu>\r
36         <1369687594-31774-3-git-send-email-amdragon@mit.edu>\r
37 User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
38         (i486-pc-linux-gnu)\r
39 Date: Mon, 27 May 2013 23:19:18 +0100\r
40 Message-ID: <8738t8jcbd.fsf@qmul.ac.uk>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=us-ascii\r
43 X-Sender-Host-Address: 93.97.24.31\r
44 X-QM-SPAM-Info: Sender has good ham record.  :)\r
45 X-QM-Body-MD5: c867794f7311dd3a0754b9814b8e1b0a (of first 20000 bytes)\r
46 X-SpamAssassin-Score: -0.1\r
47 X-SpamAssassin-SpamBar: /\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
49         determine if it is\r
50         spam. We require at least 5.0 points to mark a message as spam.\r
51         This message scored -0.1 points.\r
52         Summary of the scoring: \r
53         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
54         provider *      (markwalters1009[at]gmail.com)\r
55         * -0.1 AWL AWL: From: address is in the auto white-list\r
56 X-QM-Scan-Virus: ClamAV says the message is clean\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Mon, 27 May 2013 22:19:28 -0000\r
70 \r
71 \r
72 A couple of small nits:\r
73 \r
74 Austin Clements <amdragon@MIT.EDU> writes:\r
75 \r
76 > This is similar to what we already do with the message p-list, though\r
77 > we apply the part's text property to the whole part's text, in\r
78 > contrast with the message p-list, which is (rather obscurely) only\r
79 > applied to the first character.\r
80 > ---\r
81 >  emacs/notmuch-lib.el  |   16 ++++++++++++++++\r
82 >  emacs/notmuch-show.el |   13 ++++++++++++-\r
83 >  2 files changed, 28 insertions(+), 1 deletion(-)\r
84 >\r
85 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
86 > index 790136e..09ce25e 100644\r
87 > --- a/emacs/notmuch-lib.el\r
88 > +++ b/emacs/notmuch-lib.el\r
89 > @@ -360,6 +360,22 @@ OBJECT."\r
90 >     below\r
91 >     string))\r
92 >  \r
93 > +(defun notmuch-put-text-property-if-nil (start end property value\r
94 > +                                            &optional object)\r
95 > +  "Like `put-text-property', but only set the property where it is nil."\r
96 > +  (while (< start end)\r
97 > +    (let ((start-nil (text-property-any start end property nil object)))\r
98 > +      (if (null start-nil)\r
99 > +       ;; There are no more nil regions; exit the loop\r
100 > +       (setq start end)\r
101 > +     ;; Find the end of the nil region\r
102 > +     (let ((end-nil\r
103 > +            (or (text-property-not-all start-nil end property nil object)\r
104 > +                end)))\r
105 > +       ;; Set the property\r
106 > +       (put-text-property start-nil end-nil property value object)\r
107 > +       (setq start end-nil))))))\r
108 > +\r
109 >  (defun notmuch-logged-error (msg &optional extra)\r
110 >    "Log MSG and EXTRA to *Notmuch errors* and signal MSG.\r
111 >  \r
112 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
113 > index a080134..acd0b55 100644\r
114 > --- a/emacs/notmuch-show.el\r
115 > +++ b/emacs/notmuch-show.el\r
116 > @@ -900,7 +900,10 @@ If HIDE is non-nil then initially hide this part."\r
117 >      ;; Ensure that the part ends with a carriage return.\r
118 >      (unless (bolp)\r
119 >        (insert "\n"))\r
120 > -    (notmuch-show-create-part-overlays msg beg (point) hide)))\r
121 > +    (notmuch-show-create-part-overlays msg beg (point) hide)\r
122 > +    ;; Record part information.  Since we already inserted subparts,\r
123 > +    ;; don't override exiting :notmuch-part properties.\r
124                          ^^^\r
125 existing\r
126 \r
127 > +    (notmuch-put-text-property-if-nil beg (point) :notmuch-part part)))\r
128 >  \r
129 >  (defun notmuch-show-insert-body (msg body depth)\r
130 >    "Insert the body BODY at depth DEPTH in the current thread."\r
131 > @@ -1404,6 +1407,14 @@ Some useful entries are:\r
132 >      (notmuch-show-move-to-message-top)\r
133 >      (get-text-property (point) :notmuch-message-properties)))\r
134 >  \r
135 > +(defun notmuch-show-get-part-properties ()\r
136 > +  "Return the properties of the part containing point.\r
137 > +\r
138 > +This is the part property list retrieved from the CLI.  Signals\r
139 > +an error if there is no part containing point."\r
140 \r
141 I think something here should say innermost part or something similar.\r
142 \r
143 Best wishes\r
144 \r
145 Mark\r
146 \r
147 \r
148 > +  (or (get-text-property (point) :notmuch-part)\r
149 > +      (error "No message part here")))\r
150 > +\r
151 >  (defun notmuch-show-set-prop (prop val &optional props)\r
152 >    (let ((inhibit-read-only t)\r
153 >       (props (or props\r
154 > -- \r
155 > 1.7.10.4\r