Re: notmuch-tree display
[notmuch-archives.git] / 46 / b5ef5f16fb7d268d0080e649d38c3cddcdabc5
1 Return-Path: <awg@xvx.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 8B563431FB6\r
6         for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 08:29:12 -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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 6K9EiNhf0MJe for <notmuch@notmuchmail.org>;\r
16         Wed, 18 Jan 2012 08:29:12 -0800 (PST)\r
17 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
18         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id CE38D431FAE\r
21         for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 08:29:11 -0800 (PST)\r
22 Received: by bkty12 with SMTP id y12so1858077bkt.26\r
23         for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 08:29:08 -0800 (PST)\r
24 MIME-Version: 1.0\r
25 Received: by 10.205.127.132 with SMTP id ha4mr7592767bkc.35.1326904148673;\r
26         Wed, 18 Jan 2012 08:29:08 -0800 (PST)\r
27 Sender: awg@xvx.ca\r
28 Received: by 10.205.33.73 with HTTP; Wed, 18 Jan 2012 08:29:08 -0800 (PST)\r
29 X-Originating-IP: [208.77.198.202]\r
30 In-Reply-To: <cunty3to5zp.fsf@hotblack-desiato.hh.sledj.net>\r
31 References: <cuny5t6r97c.fsf@hotblack-desiato.hh.sledj.net>\r
32         <1326840818-6821-1-git-send-email-awg+notmuch@xvx.ca>\r
33         <cunty3to5zp.fsf@hotblack-desiato.hh.sledj.net>\r
34 Date: Wed, 18 Jan 2012 09:29:08 -0700\r
35 X-Google-Sender-Auth: x6foOs70-AK-jrIsMIUP91vaF_E\r
36 Message-ID:\r
37  <CAMoJFUtzGVTpAf6L3TovcXvtc=E8g+EoJj9iu7QHgga5=o3N7A@mail.gmail.com>\r
38 Subject: Re: [PATCH v2 4/5] emacs: Use the new JSON reply format.\r
39 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
40 To: David Edmondson <dme@dme.org>\r
41 Content-Type: text/plain; charset=ISO-8859-1\r
42 Content-Transfer-Encoding: quoted-printable\r
43 Cc: notmuch <notmuch@notmuchmail.org>\r
44 X-BeenThere: notmuch@notmuchmail.org\r
45 X-Mailman-Version: 2.1.13\r
46 Precedence: list\r
47 List-Id: "Use and development of the notmuch mail system."\r
48         <notmuch.notmuchmail.org>\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
52 List-Post: <mailto:notmuch@notmuchmail.org>\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
56 X-List-Received-Date: Wed, 18 Jan 2012 16:29:12 -0000\r
57 \r
58 On Tue, Jan 17, 2012 at 23:54, David Edmondson <dme@dme.org> wrote:\r
59 > On Tue, 17 Jan 2012 15:53:37 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca=\r
60 > wrote:\r
61 >> +(defun notmuch-parts-filter-by-type (parts type)\r
62 >> + =A0"Return a list of message parts with the given type"\r
63 >> + =A0(let (result)\r
64 >> + =A0 =A0(dolist (part (append parts nil) result)\r
65 >> + =A0 =A0 =A0(if (string=3D (cdr (assq 'content-type part)) type)\r
66 >> + =A0 =A0 =A0 (setq result (append result (list (cdr (assq 'content part=\r
67 )))))))\r
68 >> + =A0 =A0result))\r
69 >\r
70 > I still think that `loop' is easier to read :-) But no objection to this\r
71 > code.\r
72 \r
73 I couldn't find the loop construct initially, but after the discussion\r
74 of common lisp on IRC yesterday I found the cl package and figured out\r
75 how your example worked.  With loop and collect figured out, it is\r
76 easier to read.\r
77 \r
78 >> +(defun notmuch-mua-insert-part-quoted (part)\r
79 >> + =A0(let ((start (point))\r
80 >> + =A0 =A0 limit)\r
81 >> + =A0 =A0(insert part)\r
82 >> + =A0 =A0(setq limit (point))\r
83 >> + =A0 =A0(goto-char start)\r
84 >> + =A0 =A0(while (re-search-forward "\\(^\\)[^$]" limit 0)\r
85 >> + =A0 =A0 =A0(replace-match "> " nil nil nil 1)\r
86 >> + =A0 =A0 =A0;; We have added two characters to the quotable region\r
87 >> + =A0 =A0 =A0(setq limit (+ limit 2)))\r
88 >> + =A0 =A0(set-buffer-modified-p nil)))\r
89 >\r
90 > You could use a marker for the limit, as it would then move along\r
91 > automagically (sorry for not noticing this last time).\r
92 \r
93 Aha!  Another trick I didn't know about.\r
94 \r
95 New patch forthcoming.\r