notmuch.el: controlling what does and doesn't get expanded in searches
[notmuch-archives.git] / 60 / c1c5aacf840bd16488f61e09627720af882b60
1 Return-Path: <aaronecay@gmail.com>\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 458AF429E26\r
6         for <notmuch@notmuchmail.org>; Sun,  8 Jan 2012 21:02:27 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 jZv+b0IlPyKV for <notmuch@notmuchmail.org>;\r
17         Sun,  8 Jan 2012 21:02:26 -0800 (PST)\r
18 Received: from mail-iy0-f181.google.com (mail-iy0-f181.google.com\r
19         [209.85.210.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 8FC0A431FB6\r
22         for <notmuch@notmuchmail.org>; Sun,  8 Jan 2012 21:02:26 -0800 (PST)\r
23 Received: by iakk12 with SMTP id k12so6993797iak.26\r
24         for <notmuch@notmuchmail.org>; Sun, 08 Jan 2012 21:02:26 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type:content-transfer-encoding;\r
28         bh=ovQ1Z1+6Lz3YeAw4o2euPQec8Axhyw9A4Lk8m/qNA2o=;\r
29         b=aa8Tm9X4jnO92q8YM0bclYn4XLn4kgtEoZkQCUFD4uQHDkNOlIeMmVVZ+f0mytDaQc\r
30         nIa/NToPl8OUlyNmvc6JsLWnu3l4SyhTXwfH09Xjk5FfdSaWOoVMTZHCkQQwwGS6VMDo\r
31         6Yk70/nWF5nIpwc4YnoCc0/8tgPSXbgGLQd5A=\r
32 Received: by 10.50.157.229 with SMTP id wp5mr17584473igb.22.1326085346218;\r
33         Sun, 08 Jan 2012 21:02:26 -0800 (PST)\r
34 Received: from localhost (c-68-80-94-73.hsd1.pa.comcast.net. [68.80.94.73])\r
35         by mx.google.com with ESMTPS id aq5sm14079348igc.5.2012.01.08.21.02.23\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Sun, 08 Jan 2012 21:02:25 -0800 (PST)\r
38 From: Aaron Ecay <aaronecay@gmail.com>\r
39 To: Jameson Graef Rollins <jrollins@finestructure.net>,\r
40         Notmuch Mail <notmuch@notmuchmail.org>\r
41 Subject: Re: [PATCH 2/4] emacs: repurpose notmuch-show-archive-thread-internal\r
42         function for general thread tagging\r
43 In-Reply-To: <87boqdr3mz.fsf@servo.finestructure.net>\r
44 References: <1325975294-646-1-git-send-email-jrollins@finestructure.net>\r
45         <1325975294-646-2-git-send-email-jrollins@finestructure.net>\r
46         <1325975294-646-3-git-send-email-jrollins@finestructure.net>\r
47         <m239bpk7h0.fsf@gmail.com> <87boqdr3mz.fsf@servo.finestructure.net>\r
48 User-Agent: Notmuch/0.10.1+56~gd709fd6 (http://notmuchmail.org)\r
49         Emacs/24.0.92.3 (i386-apple-darwin10.8.0)\r
50 Date: Mon, 09 Jan 2012 00:02:20 -0500\r
51 Message-ID: <m2obudii3n.fsf@gmail.com>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain; charset=utf-8\r
54 Content-Transfer-Encoding: quoted-printable\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Mon, 09 Jan 2012 05:02:27 -0000\r
68 \r
69 On Sun, 08 Jan 2012 18:49:56 -0800, Jameson Graef Rollins <jrollins@finestr=\r
70 ucture.net> wrote:\r
71 > Thanks so much for the review, Aaron.\r
72 >=20\r
73 > On Sun, 08 Jan 2012 20:08:59 -0500, Aaron Ecay <aaronecay@gmail.com> wrot=\r
74 e:\r
75 > > A couple of comments on the arguments:\r
76 > > - It would be good to make show-next &optional.  This will enable code\r
77 > >   to call the fn with only two arguments, and not showing next will be\r
78 > >   the default behavior.\r
79 >=20\r
80 > That's a nice idea.  Probably better for a separate patch, though.\r
81 \r
82 This patch introduces show-next as a new argument to the function.  So it\r
83 can and should make it &optional, if that is the appropriate semantics\r
84 for it to have.\r
85 \r
86 >=20\r
87 > > - A more lispy way of specifying the sign would be to use a\r
88 > >   boolean.  Perhaps you could call this =E2=80=9Cremove=E2=80=9D; a val=\r
89 ue of =E2=80=98t=E2=80=99 would\r
90 > >   remove the tag; =E2=80=98nil=E2=80=99 would add it.  Moving this argu=\r
91 ment after =E2=80=98tag=E2=80=99\r
92 > >   and also making it &optional woudl allow this fn to be called with one\r
93 > >   arg to add a tag.  (Maybe this is too minimalist and API, however.)=20\r
94 >=20\r
95 > That might be more lispy, but it seems a lot less clear to me.  It might\r
96 > save a few keystrokes when coding, but it would definitely make the code\r
97 > a lot harder to read ("remove" to add a tag?).  I think I would prefer\r
98 > people to give the sign explicitly.\r
99 \r
100 Using a string value makes it harder to interface with other code.  For\r
101 example, the prefix argument (C-u) is delivered to emacs commands as a\r
102 boolean value (nil if no arg, something truthy if the arg is given).  A\r
103 plausible custom end user function/keybinding would be one to add a tag\r
104 to the open messages, or remove that tag if the prefix arg is given to\r
105 the same command.  (So that =E2=80=98d=E2=80=99 deletes and =E2=80=98C-u d=\r
106 =E2=80=99 undeletes, for\r
107 example.)  In order to do that, the user=E2=80=99s code has to convert the\r
108 prefix arg into a string.  Making something =E2=80=9Clispy=E2=80=9D isn=E2=\r
109 =80=99t just about\r
110 code readability/saving keystrokes, but also refers to how well the\r
111 code interfaces with the conventions used by the rest of the emacs\r
112 environment.\r
113 \r
114 That said, here=E2=80=99s an alternate proposal: provide two functions as t=\r
115 he\r
116 =E2=80=9Cexternal=E2=80=9D API, namely =E2=80=98notmuch-show-{add,remove}-t=\r
117 ag-thread=E2=80=99 (by\r
118 parallelism with =E2=80=98notmuch-show-{add,remove}-tag=E2=80=99).  These c=\r
119 ould be\r
120 thin wrappers around =E2=80=98notmuch-show-tag-thread-internal=E2=80=99, wh=\r
121 ich would\r
122 then not be intended to be called by user code.\r
123 \r
124 >=20\r
125 > > No second set of parens is needed around tag-function.\r
126 >=20\r
127 > Yeah, I've seen this either way.  I guess it's just a stylistic\r
128 > choice.\r
129 \r
130 Using double parens is semantically correct, but makes the code less\r
131 idiomatic and harder to read (IMO).  To test my intuition, I looked at\r
132 =E2=80=98let=E2=80=99 invocations in the Emacs source that have a non-initi=\r
133 alized\r
134 variable (because the multiple variable case is hard to grep for).\r
135 Double parens are used only 3% of the time (44 double vs 1468 single).\r
136 Make of this data what you will.\r
137 \r
138 --=20\r
139 Aaron Ecay\r