Re: [PATCH v3 0/6] Make Emacs search use sexp format
[notmuch-archives.git] / b1 / 6dd1047525b569ea12bb6f7d0b7c3086cf7b55
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 166CE431FAF\r
6         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 21:53:46 -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.699\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,\r
13         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 TYEKiBC1cMSL for <notmuch@notmuchmail.org>;\r
17         Thu, 19 Jan 2012 21:53:45 -0800 (PST)\r
18 Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com\r
19         [209.85.216.53]) (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 2AEA7431FAE\r
22         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 21:53:45 -0800 (PST)\r
23 Received: by qabg24 with SMTP id g24so166088qab.5\r
24         for <notmuch@notmuchmail.org>; Thu, 19 Jan 2012 21:53:43 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type:content-transfer-encoding;\r
28         bh=NbEpseEEe7zp5nzdDM0oUUsuEPMKK8i2g4oaPpEzbq8=;\r
29         b=a5pt8su5b7iwg00Id+QXLIT83FUf9wz3VmxPmtbf4MdhmuwXf9ux7eAJmwa4DyZQtq\r
30         5zVQ4upbllHh6S53MN3DKus3Pyvj+NDbOjpCoJSyIlpv6rBH/GZB5UvDWokrHZwSQflM\r
31         H8EzkzF/OrGy3FQB1CND5TxLfFly9wIGTwpR4=\r
32 Received: by 10.224.108.202 with SMTP id g10mr31176908qap.24.1327038823429;\r
33         Thu, 19 Jan 2012 21:53:43 -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 f12sm4390740qad.15.2012.01.19.21.53.41\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Thu, 19 Jan 2012 21:53:42 -0800 (PST)\r
38 Sender: Aaron Ecay <aaronecay@gmail.com>\r
39 From: Aaron Ecay <ecay@sas.upenn.edu>\r
40 To: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
41 Subject: Re: [PATCH v3 5/5] emacs: Use message-citation-line-format in reply\r
42 In-Reply-To:\r
43  <CAMoJFUtn2Ls4maJGecY5Y8HzdOJSR6ZfVdUxnCZ6s4Jhq8r9yw@mail.gmail.com>\r
44 References: <1326995217-27423-1-git-send-email-awg+notmuch@xvx.ca>\r
45         <1326995217-27423-6-git-send-email-awg+notmuch@xvx.ca>\r
46         <m2k44n4jlz.fsf@wal122.wireless-pennnet.upenn.edu>\r
47         <CAMoJFUtn2Ls4maJGecY5Y8HzdOJSR6ZfVdUxnCZ6s4Jhq8r9yw@mail.gmail.com>\r
48 User-Agent: Notmuch/0.11+73~gd51b784 (http://notmuchmail.org) Emacs/24.0.92.2\r
49         (i386-apple-darwin10.8.0)\r
50 Date: Fri, 20 Jan 2012 00:53:39 -0500\r
51 Message-ID: <m2mx9i3onw.fsf@wal122.wireless-pennnet.upenn.edu>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain; charset=utf-8\r
54 Content-Transfer-Encoding: quoted-printable\r
55 Cc: notmuch@notmuchmail.org\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Fri, 20 Jan 2012 05:53:46 -0000\r
69 \r
70 On Thu, 19 Jan 2012 21:46:46 -0700, Adam Wolfe Gordon <awg+notmuch@xvx.ca> =\r
71 wrote:\r
72 > On Thu, Jan 19, 2012 at 11:45, Aaron Ecay <ecay@sas.upenn.edu> wrote:\r
73 > > Shouldn=E2=80=99t this just use message-insert-formatted-citation-line?\r
74 >=20\r
75 > Yes, good idea.  I just tried this and it almost works.  The only\r
76 > issue is that the default message-mode-citation-line-format has a\r
77 > newline at the end, and this function inserts an *additional* newline,\r
78 > so we end up with a blank line before the beginning of the quoted\r
79 > text.  This is fixable by the user, of course, but it means the\r
80 > default out-of-the-box setup will create funny-looking replies, which\r
81 > is probably bad.  Thoughts?\r
82 \r
83 (let ((message-citation-line-format\r
84        (remove ?\n message-citation-line-format)))\r
85   ...)\r
86 \r
87 (Or, if you think someone might have a newline other than at the end of\r
88 the string, you could do something a little more complicated to remove\r
89 only a newline at the end.)\r
90 \r
91 Or you could introduce a new defcustom\r
92 =E2=80=98notmuch-message-citation-line-format=E2=80=99 (with newline-less d=\r
93 efault), and\r
94 let-bind m-l-c-f to that value.  But that is pretty ugly =E2=80=93 we don=\r
95 =E2=80=99t want\r
96 to have to =E2=80=9Cwrap=E2=80=9D every variable whose default we don=E2=80=\r
97 =99t like.\r
98 \r
99 > I've also tried using message-cite-original to create the reply body,\r
100 > and it also almost works.  The issue, again, is one of defaults.  In\r
101 > addition to the blank line I mentioned above, the default\r
102 > message-citation-line-function inserts the "plain" citation line "Foo\r
103 > <foo@bar.baz> writes:" instead of the formatted one.  This is a big\r
104 > change from the current notmuch default.\r
105 >=20\r
106 > If everyone's OK with this and willing to customize it themselves,\r
107 > then I'm happy to go with this solution, but I'm pretty reluctant to\r
108 > change the default in such a significant way.\r
109 \r
110 I=E2=80=99m personally of the opinion that notmuch should just say =E2=80=\r
111 =9Cthe mail\r
112 composition facility is provided by message mode (here is the\r
113 documentation on customizing it)=E2=80=9D.  Message mode is 8,000 lines of\r
114 elisp.  We have the choice to:\r
115 - write our own message composition mode\r
116 - wrap (as explained above) the default message-mode variables we don=E2=80=\r
117 =99t\r
118   like in notmuch-prefixed variants, with suitable let-bindings.\r
119 - use only the parts of message-mode that we like\r
120 - pass composition off to message mode\r
121 \r
122 The first option just doesn=E2=80=99t make sense.  The second is also a lit=\r
123 tle\r
124 nuts.  The third is what we are trying now, but it=E2=80=99s painful =E2=80=\r
125 =93 the\r
126 message mode code has its own structure and its own defaults, which\r
127 don=E2=80=99t always agree with notmuch=E2=80=99s.  I am in favor of the fo=\r
128 urth =E2=80=93\r
129 notmuch=E2=80=99s elisp code should pass data to message mode in the most l=\r
130 ow\r
131 level form it can, and let message mode do any extra work in the way\r
132 it already does.  And users should customize message composition via\r
133 message mode, not notmuch.  There=E2=80=99s a tradeoff to this approach =E2=\r
134 =80=93 by\r
135 controlling more within notmuch, we can have nicer defaults at the\r
136 expense of more brittle code and/or fewer user-visible customizations.\r
137 \r
138 This is not in any way a criticism of your work (which is great) =E2=80=93\r
139 you=E2=80=99re right that you need =E2=80=9Cpermission=E2=80=9D to uproot t=\r
140 he defaults, and I=E2=80=99m\r
141 advocating for it to be given.\r
142 \r
143 One possible step that might ease the transition pain could be for\r
144 notmuch=E2=80=99s emacs interface to have a configuration file (similar to\r
145 Wanderlust=E2=80=99s ~/.wl; I believe Gnus also uses a ~/.gnus).  The idea =\r
146 is\r
147 that this file contains elisp code, and is loaded by notmuch the first\r
148 time any notmuch-related commands are invoked by the user.  If the file\r
149 does not exist, notmuch could create it with default content that sets\r
150 message-citation-function, message-citation-line-format,\r
151 message-yank-prefix (to get rid of the ugly default whereby message-mode\r
152 indents the original message by four spaces instead of inserting =E2=80=9C>=\r
153  =E2=80=9D),\r
154 etc.  If there is interest in this approach, I=E2=80=99d be happy to work o=\r
155 n a\r
156 patch for it.\r
157 \r
158 I=E2=80=99ve sort of stumped for this idea before\r
159 (id:"m239bgcd1d.fsf@gmail.com") and it didn=E2=80=99t exactly get rave revi=\r
160 ews.\r
161 So I=E2=80=99ll shut up if it=E2=80=99s really not something people want to=\r
162  see.\r
163 \r
164 I=E2=80=99ll close with an example of a nice feature that message mode has\r
165 (which I=E2=80=99ve been really wanting since the reply keybindings changed)\r
166 that notmuch would get for free if it hooked into message mode better:\r
167 the function message-widen-reply takes a reply-to-sender message and\r
168 makes it reply-to-all.\r
169 \r
170 --=20\r
171 Aaron Ecay\r