notmuch.el: controlling what does and doesn't get expanded in searches
[notmuch-archives.git] / 13 / 0918fb360260c4a960cfad37642160fd69784a
1 Return-Path: <jani@nikula.org>\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 arlo.cworth.org (Postfix) with ESMTP id 9F66E6DE0AF8\r
6  for <notmuch@notmuchmail.org>; Fri, 28 Aug 2015 11:22:35 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.296\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.296 tagged_above=-999 required=5 tests=[AWL=0.424,\r
12   RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]\r
13  autolearn=disabled\r
14 Received: from arlo.cworth.org ([127.0.0.1])\r
15  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
16  with ESMTP id PtTBGu0Ci5Gy for <notmuch@notmuchmail.org>;\r
17  Fri, 28 Aug 2015 11:22:33 -0700 (PDT)\r
18 Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com\r
19  [209.85.212.177])\r
20  by arlo.cworth.org (Postfix) with ESMTPS id 4E8676DE005F\r
21  for <notmuch@notmuchmail.org>; Fri, 28 Aug 2015 11:22:33 -0700 (PDT)\r
22 Received: by wicfv10 with SMTP id fv10so19246010wic.0\r
23  for <notmuch@notmuchmail.org>; Fri, 28 Aug 2015 11:22:31 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25  d=1e100.net; s=20130820;\r
26  h=x-gm-message-state:from:to:cc:subject:in-reply-to:references\r
27  :user-agent:date:message-id:mime-version:content-type;\r
28  bh=WMQTSKtAXpvzr4+UBJ1BO0gf8S7dw2fK+iiK9fGBElw=;\r
29  b=h27mpvL1YsvFcAOFW1Lzkws42Ori3brS2nFFW5JZyJZEn+USIHDVIE/TkIVe015Coq\r
30  37ea2w6aZ3B1k1WO/rjLyF378ym0ctUI4g+ZBSicHNdQSr1IoRnQFUg3QieonXTlff70\r
31  qaXwAhzZL7CKHFHvFogZUUpZ96EAGhfMBEa1q4UKg8P8O7gOfmojmTfYr60YHfgLhDBB\r
32  UAoJYxRXH0xWFYuTGdjLGDc3B9aQPg8TW+paKTLvTsnFuHmV2FciigfKjVm5JimMF+kH\r
33  v4okaHbueGhyT+i7AIFBz5US3XvOfrFYryfj82ZAIf/1zzo0UVJ824MC/E90PEK3j7Hi\r
34  x0yg==\r
35 X-Gm-Message-State:\r
36  ALoCoQmagIm60FgX0znythkZhfbBaos51pbWGBeoMvti9GnGAnUF5VYCPs+U1N0uhtesD/urelOc\r
37 X-Received: by 10.180.91.14 with SMTP id ca14mr6126367wib.5.1440786151486;\r
38  Fri, 28 Aug 2015 11:22:31 -0700 (PDT)\r
39 Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.\r
40  [188.238.79.131])\r
41  by smtp.gmail.com with ESMTPSA id fs8sm4926800wib.0.2015.08.28.11.22.30\r
42  (version=TLSv1/SSLv3 cipher=OTHER);\r
43  Fri, 28 Aug 2015 11:22:30 -0700 (PDT)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
46 Subject: Re: [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by\r
47  default with --client\r
48 In-Reply-To: <m21tepvpm5.fsf@guru.guru-group.fi>\r
49 References: <cover.1439629384.git.jani@nikula.org>\r
50  <455026447d3f75b1038ac11cebe734431604be9d.1439629384.git.jani@nikula.org>\r
51  <m21tepvpm5.fsf@guru.guru-group.fi>\r
52 User-Agent: Notmuch/0.20.2+60~gcb08a2e (http://notmuchmail.org) Emacs/24.4.1\r
53  (x86_64-pc-linux-gnu)\r
54 Date: Fri, 28 Aug 2015 21:22:29 +0300\r
55 Message-ID: <87si73uvbu.fsf@nikula.org>\r
56 MIME-Version: 1.0\r
57 Content-Type: text/plain\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.18\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62  <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Fri, 28 Aug 2015 18:22:35 -0000\r
71 \r
72 On Wed, 26 Aug 2015, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
73 > On Sat, Aug 15 2015, Jani Nikula <jani@nikula.org> wrote:\r
74 >\r
75 >> Make the default behaviour for --client the same as emacsclient\r
76 >> default: do not create a new frame. Add a new option --create-frame,\r
77 >> passing the same option to emacsclient to create a frame.\r
78 >>\r
79 >> ---\r
80 >>\r
81 >> v2: fix killing frame with --create-frame\r
82 >>\r
83 >> v3: fix --create-frame w/o --client parameter check\r
84 >>\r
85 >> v4: fix kill terminal logic, document behaviour with daemon mode\r
86 >> ---\r
87 >>  doc/man1/notmuch-emacs-mua.rst |  6 ++++++\r
88 >>  notmuch-emacs-mua              | 14 ++++++++++----\r
89 >>  2 files changed, 16 insertions(+), 4 deletions(-)\r
90 >>\r
91 >> diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst\r
92 >> index 89a2fead17b1..c3689eb82c8a 100644\r
93 >> --- a/doc/man1/notmuch-emacs-mua.rst\r
94 >> +++ b/doc/man1/notmuch-emacs-mua.rst\r
95 >> @@ -45,6 +45,12 @@ Supported options for **notmuch-emacs-mua** include\r
96 >>          Automatically start Emacs in daemon mode, if the Emacs server\r
97 >>          is not running. Applicable with ``--client``.\r
98 >>  \r
99 >> +    ``--create-frame``\r
100 >> +        Create a new frame instead of trying to use the current Emacs\r
101 >> +        frame. Applicable with ``--client``. This will be required\r
102 >> +        when Emacs is running (or automatically started with\r
103 >> +        ``--auto-daemon``) in daemon mode.\r
104 >> +\r
105 >>      ``--print``\r
106 >>          Output the resulting elisp to stdout instead of evaluating it.\r
107 >>  \r
108 >> diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua\r
109 >> index ac03a4a60d56..b51d8d0e2c5b 100755\r
110 >> --- a/notmuch-emacs-mua\r
111 >> +++ b/notmuch-emacs-mua\r
112 >> @@ -37,11 +37,10 @@ PRINT_ONLY=\r
113 >>  NO_WINDOW=\r
114 >>  USE_EMACSCLIENT=\r
115 >>  AUTO_DAEMON=\r
116 >> -CREATE_FRAME="-c"\r
117 >> +CREATE_FRAME=\r
118 >>  \r
119 >>  # The crux of it all: construct an elisp progn and eval it.\r
120 >>  ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"\r
121 >> -ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
122 >>  \r
123 >>  # Short options compatible with mutt(1).\r
124 >>  while getopts :s:c:b:i:h opt; do\r
125 >> @@ -65,7 +64,7 @@ while getopts :s:c:b:i:h opt; do\r
126 >>                  opt=${opt%%=*}\r
127 >>                  ;;\r
128 >>              # Long options without arguments.\r
129 >> -            --help|--print|--no-window-system|--client|--auto-daemon)\r
130 >> +            --help|--print|--no-window-system|--client|--auto-daemon|--create-frame)\r
131 >>                  ;;\r
132 >>              *)\r
133 >>                  echo "$0: unknown long option ${opt}, or argument mismatch." >&2\r
134 >> @@ -103,7 +102,6 @@ while getopts :s:c:b:i:h opt; do\r
135 >>          ;;\r
136 >>      --no-window-system)\r
137 >>          NO_WINDOW="-nw"\r
138 >> -        CREATE_FRAME=\r
139 >>          ;;\r
140 >>      --client)\r
141 >>          USE_EMACSCLIENT="yes"\r
142 >> @@ -111,6 +109,9 @@ while getopts :s:c:b:i:h opt; do\r
143 >>      --auto-daemon)\r
144 >>          AUTO_DAEMON="--alternate-editor="\r
145 >>          ;;\r
146 >> +    --create-frame)\r
147 >> +        CREATE_FRAME="-c"\r
148 >> +        ;;\r
149 >>      *)\r
150 >>          # We should never end up here.\r
151 >>          echo "$0: internal error (option ${opt})." >&2\r
152 >\r
153 > This looks pretty good now; I player quite a bit with --client,\r
154 > --create-frame and --auto-daemon \r
155 > (with and without setting EMACSCLIENT='echo emacsclient')\r
156 >\r
157 > Based on that I think this check should be added here (after option\r
158 > parsing):\r
159 >\r
160 > if [ -n "$AUTO_DAEMON" -a -z "$CREATE_FRAME" ]; then\r
161 >     echo "$0: --auto-daemon is only applicable with --create-frame." >&2\r
162 >     exit 1       \r
163 > fi\r
164 >\r
165 > without this one may execute ./notmuch-emacs-mua --client --auto-daemon\r
166 > which yields starting emacs in daemon mode (in this example it is expected\r
167 > emacs is not running; otherwise --auto-daemon has no use in this example)\r
168 > -- but no ui to that newly-running emacs is provided. Similar behaviour\r
169 > can be observed by the following\r
170 \r
171 This problem is present with the current code already, right now. I\r
172 don't see the need to fix everything in my series.\r
173 \r
174 > $ emacsclient --eval '(kill emacs) ;; but beware! ' \r
175 > $ emacsclient --alternate-editor= --eval '(find-file "/etc/passwd")'\r
176 >\r
177 > (side note: using this --alternate-editor= is pretty nifty way to get it done)\r
178 >\r
179 > emacs --daemon is executed which loaded /etc/passwd but w/o ui\r
180 >\r
181 > Note the difference in:\r
182 >\r
183 > emacsclient --alternate-editor= /etc/passwd\r
184 >\r
185 > now emacs --daemon is executed *and* ui where /etc/passwd is available is\r
186 > provided!\r
187 >\r
188 > otoh,\r
189 > emacsclient --alternate-editor= -c [-nw] --eval '(find-file "/etc/passwd")'\r
190 >\r
191 > works fine, albeit a bit different than the one where /etc/passwd was given\r
192 > as a simple filename argument.\r
193 >\r
194 > comparative to ./notmuch-emacs-mua --client --create-frame --auto-daemon \r
195 >\r
196 >> @@ -128,6 +129,11 @@ for arg; do\r
197 >>      ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"\r
198 >>  done\r
199 >>  \r
200 >> +# Kill the terminal/frame if we're creating one.\r
201 >> +if [ -z "$USE_EMACSCLIENT" -o -n "$CREATE_FRAME" -o -n "$NO_WINDOW" ]; then\r
202 >> +    ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
203 >> +fi\r
204 >\r
205 > I am not very happy that message-exit-actions was added to $ELISP when\r
206 > not using emacsclient; when emacs is started its sole (initial) purpose is\r
207 > to serve mail sending (and not lending a frame in some other emacs) -- in\r
208 > this case it would be nice to be able to retrieve the sent mail buffer.\r
209 \r
210 And I am not very happy with being expected to modify these patches ad\r
211 infinitum while trying to get back the *one* use case I wrote this\r
212 script for in the first place, and that got broken somewhere down the\r
213 line.\r
214 \r
215 Sincerely,\r
216 Jani.\r
217 \r
218 \r
219 >\r
220 > perhaps the above could be changed to just \r
221 >\r
222 > if [ -n "$CREATE_FRAME" ]; then\r
223 >     ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
224 > fi\r
225 >\r
226 > another option is --yet-another-option ;/\r
227 >\r
228 > No other issues (relevant to this series).\r
229 >\r
230 > Tomi\r
231 >\r
232 >\r
233 >> +\r
234 >>  # End progn.\r
235 >>  ELISP="${ELISP})"\r
236 >>  \r
237 >> -- \r
238 >> 2.1.4\r