1 Return-Path: <tomi.ollila@iki.fi>
\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 BF9916DE02DD
\r
6 for <notmuch@notmuchmail.org>; Wed, 26 Aug 2015 12:05:22 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.859 tagged_above=-999 required=5 tests=[AWL=0.207,
\r
12 SPF_NEUTRAL=0.652] autolearn=disabled
\r
13 Received: from arlo.cworth.org ([127.0.0.1])
\r
14 by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id SqmYe6owfXOF for <notmuch@notmuchmail.org>;
\r
16 Wed, 26 Aug 2015 12:05:20 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by arlo.cworth.org (Postfix) with ESMTP id 4C0856DE0275
\r
19 for <notmuch@notmuchmail.org>; Wed, 26 Aug 2015 12:05:19 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id C1C5E10008E;
\r
22 Wed, 26 Aug 2015 22:03:46 +0300 (EEST)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by
\r
26 default with --client
\r
28 <455026447d3f75b1038ac11cebe734431604be9d.1439629384.git.jani@nikula.org>
\r
29 References: <cover.1439629384.git.jani@nikula.org>
\r
30 <455026447d3f75b1038ac11cebe734431604be9d.1439629384.git.jani@nikula.org>
\r
31 User-Agent: Notmuch/0.20.2+67~g287e782 (http://notmuchmail.org) Emacs/24.3.1
\r
32 (x86_64-unknown-linux-gnu)
\r
33 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
34 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
35 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
36 Date: Wed, 26 Aug 2015 22:03:46 +0300
\r
37 Message-ID: <m21tepvpm5.fsf@guru.guru-group.fi>
\r
39 Content-Type: text/plain
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.18
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Wed, 26 Aug 2015 19:05:22 -0000
\r
54 On Sat, Aug 15 2015, Jani Nikula <jani@nikula.org> wrote:
\r
56 > Make the default behaviour for --client the same as emacsclient
\r
57 > default: do not create a new frame. Add a new option --create-frame,
\r
58 > passing the same option to emacsclient to create a frame.
\r
62 > v2: fix killing frame with --create-frame
\r
64 > v3: fix --create-frame w/o --client parameter check
\r
66 > v4: fix kill terminal logic, document behaviour with daemon mode
\r
68 > doc/man1/notmuch-emacs-mua.rst | 6 ++++++
\r
69 > notmuch-emacs-mua | 14 ++++++++++----
\r
70 > 2 files changed, 16 insertions(+), 4 deletions(-)
\r
72 > diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
\r
73 > index 89a2fead17b1..c3689eb82c8a 100644
\r
74 > --- a/doc/man1/notmuch-emacs-mua.rst
\r
75 > +++ b/doc/man1/notmuch-emacs-mua.rst
\r
76 > @@ -45,6 +45,12 @@ Supported options for **notmuch-emacs-mua** include
\r
77 > Automatically start Emacs in daemon mode, if the Emacs server
\r
78 > is not running. Applicable with ``--client``.
\r
80 > + ``--create-frame``
\r
81 > + Create a new frame instead of trying to use the current Emacs
\r
82 > + frame. Applicable with ``--client``. This will be required
\r
83 > + when Emacs is running (or automatically started with
\r
84 > + ``--auto-daemon``) in daemon mode.
\r
87 > Output the resulting elisp to stdout instead of evaluating it.
\r
89 > diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
\r
90 > index ac03a4a60d56..b51d8d0e2c5b 100755
\r
91 > --- a/notmuch-emacs-mua
\r
92 > +++ b/notmuch-emacs-mua
\r
93 > @@ -37,11 +37,10 @@ PRINT_ONLY=
\r
97 > -CREATE_FRAME="-c"
\r
100 > # The crux of it all: construct an elisp progn and eval it.
\r
101 > ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"
\r
102 > -ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
\r
104 > # Short options compatible with mutt(1).
\r
105 > while getopts :s:c:b:i:h opt; do
\r
106 > @@ -65,7 +64,7 @@ while getopts :s:c:b:i:h opt; do
\r
109 > # Long options without arguments.
\r
110 > - --help|--print|--no-window-system|--client|--auto-daemon)
\r
111 > + --help|--print|--no-window-system|--client|--auto-daemon|--create-frame)
\r
114 > echo "$0: unknown long option ${opt}, or argument mismatch." >&2
\r
115 > @@ -103,7 +102,6 @@ while getopts :s:c:b:i:h opt; do
\r
117 > --no-window-system)
\r
122 > USE_EMACSCLIENT="yes"
\r
123 > @@ -111,6 +109,9 @@ while getopts :s:c:b:i:h opt; do
\r
125 > AUTO_DAEMON="--alternate-editor="
\r
127 > + --create-frame)
\r
128 > + CREATE_FRAME="-c"
\r
131 > # We should never end up here.
\r
132 > echo "$0: internal error (option ${opt})." >&2
\r
134 This looks pretty good now; I player quite a bit with --client,
\r
135 --create-frame and --auto-daemon
\r
136 (with and without setting EMACSCLIENT='echo emacsclient')
\r
138 Based on that I think this check should be added here (after option
\r
141 if [ -n "$AUTO_DAEMON" -a -z "$CREATE_FRAME" ]; then
\r
142 echo "$0: --auto-daemon is only applicable with --create-frame." >&2
\r
146 without this one may execute ./notmuch-emacs-mua --client --auto-daemon
\r
147 which yields starting emacs in daemon mode (in this example it is expected
\r
148 emacs is not running; otherwise --auto-daemon has no use in this example)
\r
149 -- but no ui to that newly-running emacs is provided. Similar behaviour
\r
150 can be observed by the following
\r
152 $ emacsclient --eval '(kill emacs) ;; but beware! '
\r
153 $ emacsclient --alternate-editor= --eval '(find-file "/etc/passwd")'
\r
155 (side note: using this --alternate-editor= is pretty nifty way to get it done)
\r
157 emacs --daemon is executed which loaded /etc/passwd but w/o ui
\r
159 Note the difference in:
\r
161 emacsclient --alternate-editor= /etc/passwd
\r
163 now emacs --daemon is executed *and* ui where /etc/passwd is available is
\r
167 emacsclient --alternate-editor= -c [-nw] --eval '(find-file "/etc/passwd")'
\r
169 works fine, albeit a bit different than the one where /etc/passwd was given
\r
170 as a simple filename argument.
\r
172 comparative to ./notmuch-emacs-mua --client --create-frame --auto-daemon
\r
174 > @@ -128,6 +129,11 @@ for arg; do
\r
175 > ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"
\r
178 > +# Kill the terminal/frame if we're creating one.
\r
179 > +if [ -z "$USE_EMACSCLIENT" -o -n "$CREATE_FRAME" -o -n "$NO_WINDOW" ]; then
\r
180 > + ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
\r
183 I am not very happy that message-exit-actions was added to $ELISP when
\r
184 not using emacsclient; when emacs is started its sole (initial) purpose is
\r
185 to serve mail sending (and not lending a frame in some other emacs) -- in
\r
186 this case it would be nice to be able to retrieve the sent mail buffer.
\r
188 perhaps the above could be changed to just
\r
190 if [ -n "$CREATE_FRAME" ]; then
\r
191 ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
\r
194 another option is --yet-another-option ;/
\r
196 No other issues (relevant to this series).
\r
203 > ELISP="${ELISP})"
\r