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
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
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
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
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
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
57 Content-Type: text/plain
\r
58 X-BeenThere: notmuch@notmuchmail.org
\r
59 X-Mailman-Version: 2.1.18
\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
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
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
81 >> v2: fix killing frame with --create-frame
\r
83 >> v3: fix --create-frame w/o --client parameter check
\r
85 >> v4: fix kill terminal logic, document behaviour with daemon mode
\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
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
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
106 >> Output the resulting elisp to stdout instead of evaluating it.
\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
114 >> USE_EMACSCLIENT=
\r
116 >> -CREATE_FRAME="-c"
\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
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
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
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
136 >> --no-window-system)
\r
141 >> USE_EMACSCLIENT="yes"
\r
142 >> @@ -111,6 +109,9 @@ while getopts :s:c:b:i:h opt; do
\r
144 >> AUTO_DAEMON="--alternate-editor="
\r
146 >> + --create-frame)
\r
147 >> + CREATE_FRAME="-c"
\r
150 >> # We should never end up here.
\r
151 >> echo "$0: internal error (option ${opt})." >&2
\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
157 > Based on that I think this check should be added here (after option
\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
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
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
174 > $ emacsclient --eval '(kill emacs) ;; but beware! '
\r
175 > $ emacsclient --alternate-editor= --eval '(find-file "/etc/passwd")'
\r
177 > (side note: using this --alternate-editor= is pretty nifty way to get it done)
\r
179 > emacs --daemon is executed which loaded /etc/passwd but w/o ui
\r
181 > Note the difference in:
\r
183 > emacsclient --alternate-editor= /etc/passwd
\r
185 > now emacs --daemon is executed *and* ui where /etc/passwd is available is
\r
189 > emacsclient --alternate-editor= -c [-nw] --eval '(find-file "/etc/passwd")'
\r
191 > works fine, albeit a bit different than the one where /etc/passwd was given
\r
192 > as a simple filename argument.
\r
194 > comparative to ./notmuch-emacs-mua --client --create-frame --auto-daemon
\r
196 >> @@ -128,6 +129,11 @@ for arg; do
\r
197 >> ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"
\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
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
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
220 > perhaps the above could be changed to just
\r
222 > if [ -n "$CREATE_FRAME" ]; then
\r
223 > ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
\r
226 > another option is --yet-another-option ;/
\r
228 > No other issues (relevant to this series).
\r
235 >> ELISP="${ELISP})"
\r