Re: [PATCH v4 02/16] Move crypto.c into libutil
[notmuch-archives.git] / b3 / 43579aed710cbd3bba409725909808d27677e6
1 Return-Path: <amdragon@mit.edu>\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 25A75431FC3\r
6         for <notmuch@notmuchmail.org>; Sat, 14 Jul 2012 12:50:07 -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: -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 LJUYhY2cVAj5 for <notmuch@notmuchmail.org>;\r
16         Sat, 14 Jul 2012 12:50:06 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU\r
18         [18.9.25.12])\r
19         by olra.theworths.org (Postfix) with ESMTP id 8119C431FBC\r
20         for <notmuch@notmuchmail.org>; Sat, 14 Jul 2012 12:50:06 -0700 (PDT)\r
21 X-AuditID: 1209190c-b7f806d000006b87-3f-5001cd6d3c9b\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 2E.3C.27527.D6DC1005; Sat, 14 Jul 2012 15:50:05 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q6EJo4WJ003195; \r
27         Sat, 14 Jul 2012 15:50:05 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6EJo3qX023524\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sat, 14 Jul 2012 15:50:04 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1Sq8Lr-0003bK-57; Sat, 14 Jul 2012 15:50:03 -0400\r
37 Date: Sat, 14 Jul 2012 15:50:03 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Jameson Graef Rollins <jrollins@finestructure.net>\r
40 Subject: Re: [PATCH v2 4/7] emacs: Use result text properties for search\r
41         result iteration\r
42 Message-ID: <20120714195003.GF31670@mit.edu>\r
43 References: <1342140319-19859-1-git-send-email-amdragon@mit.edu>\r
44         <1342237406-32507-1-git-send-email-amdragon@mit.edu>\r
45         <1342237406-32507-5-git-send-email-amdragon@mit.edu>\r
46         <87d33yf8bi.fsf@servo.finestructure.net>\r
47 MIME-Version: 1.0\r
48 Content-Type: text/plain; charset=us-ascii\r
49 Content-Disposition: inline\r
50 In-Reply-To: <87d33yf8bi.fsf@servo.finestructure.net>\r
51 User-Agent: Mutt/1.5.21 (2010-09-15)\r
52 X-Brightmail-Tracker:\r
53  H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IR4hRV1s09yxhg8HGKpcWefV4W12/OZHZg\r
54         8rh7msvj2apbzAFMUVw2Kak5mWWpRfp2CVwZlzp+Mhf0CFfcWTmXrYHxCl8XIyeHhICJRNfT\r
55         bewQtpjEhXvr2UBsIYF9jBLnjgd1MXIB2RsYJX62zGGEcE4ySVzYNZ8JwlnCKPGvez5zFyMH\r
56         B4uAqsSjudog3WwCGhLb9i9nBLFFBMwker78AbOZBaQlvv1uZgKxhQWiJXp654Jt4xXQkWif\r
57         u5sNYuZNRolLy95AJQQlTs58wgLRrCVx499LJpBdIIOW/+MACXMKmErc33IabL6ogIrElJPb\r
58         2CYwCs1C0j0LSfcshO4FjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdA31cjNL9FJTSjcxgkNa\r
59         kmcH45uDSocYBTgYlXh40/0ZAoRYE8uKK3MPMUpyMCmJ8rqeZAwQ4kvKT6nMSCzOiC8qzUkt\r
60         PsQowcGsJMLL3wmU401JrKxKLcqHSUlzsCiJ815OuekvJJCeWJKanZpakFoEk5Xh4FCS4J10\r
61         BqhRsCg1PbUiLTOnBCHNxMEJMpwHaPhWkBre4oLE3OLMdIj8KUZFKXHeFSAJAZBERmkeXC8s\r
62         5bxiFAd6RZj3KEgVDzBdwXW/AhrMBDR41s9//kCDSxIRUlINjCpqf098aJ67+UISZ+OxQ/Ld\r
63         vfcKMmNfm649v0DTvNt0zSEnhnL9Hu8dMw5dXSm//+3sXc23KmceMnUxviMbFl9SIHvF8ryN\r
64         /Z58I/1ZD6f/O5xYZXvq6ebgJbzqqZ1NFV92KUU5/Di+eVmxaORlNmPLZ+V5T6oCnqo+uPpz\r
65         Rf3K3Qcf/+1gElNiKc5INNRiLipOBACRbAabFAMAAA==\r
66 Cc: notmuch@notmuchmail.org\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Sat, 14 Jul 2012 19:50:07 -0000\r
80 \r
81 Quoth Jameson Graef Rollins on Jul 14 at 12:31 pm:\r
82 > On Fri, Jul 13 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
83 > > Coincidentally, this also essentially enables multi-line search result\r
84 > > formats; the only remaining non-multi-line-capable functions are\r
85 > > notmuch-search-{next,previous}-thread, which are only used\r
86 > > interactively.\r
87\r
88 > So I tried to experiment with multi-line search results with this patch\r
89 > series, but it didn't work.  I tried adding a '\n' in one of the\r
90 > formatter fields, but I got a series of errors for each result insertion\r
91 > in the buffer.  What's the way to get multi-line to work?\r
92 \r
93 That's strange.  What was the error?\r
94 \r
95 I've been testing with\r
96    (("date" . "%12s ")\r
97     ("count" . "%-7s ")\r
98     ("authors" . "%-20s ")\r
99     ("subject" . "\n%s ")\r
100     ("tags" . "(%s)"))\r
101 But maybe there are other cases it doesn't handle correctly?\r
102 \r
103 > > +(defmacro notmuch-search-do-results (beg end pos-sym &rest body)\r
104 > > +  "Invoke BODY for each result between BEG and END.\r
105 > > +\r
106 > > +POS-SYM will be bound to the point at the beginning of the\r
107 > > +current result."\r
108 > > +  (declare (indent 3))\r
109 > > +  (let ((end-sym (make-symbol "end"))\r
110 > > +   (first-sym (make-symbol "first")))\r
111 > > +    `(let ((,pos-sym (notmuch-search-result-beginning ,beg))\r
112 > > +      ;; End must be a marker in case body changes the text\r
113 > > +      (,end-sym (copy-marker ,end))\r
114 > > +      ;; Make sure we examine one result, even if (= beg end)\r
115 > > +      (,first-sym t))\r
116 > > +       ;; We have to be careful if the region extends beyond the\r
117 > > +       ;; results.  In this case, pos could be null or there could be\r
118 > > +       ;; no result at pos.\r
119 > > +       (while (and ,pos-sym (or (< ,pos-sym ,end-sym) ,first-sym))\r
120 > > +    (when (notmuch-search-get-result ,pos-sym)\r
121 > > +      ,@body)\r
122 > > +    (setq ,pos-sym (notmuch-search-result-end ,pos-sym)\r
123 > > +          ,first-sym nil)))))\r
124\r
125 > Austin, can you explain why you use a defmacro here?  I'm honestly have\r
126 > a hard time parsing what's going on here.  I understand in principle how\r
127 > elisp macros work, but I don't see why it's needed here.\r
128\r
129 > I'm also trying to understand what the commas are doing\r
130 > (e.g. ",pos-sym").  Are they doing some sort of escaping?  \r
131\r
132 > Some sophisticated elisp here!\r
133 \r
134 I did this as a macro to parallel things like dolist and loop, I'll\r
135 try this out with a higher-order procedure and see if the results are\r
136 less opaque.\r