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 1CF696DE0B38
\r
6 for <notmuch@notmuchmail.org>; Sat, 9 May 2015 11:00:50 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org
\r
11 X-Spam-Status: No, score=0.375 tagged_above=-999 required=5 tests=[AWL=1.095,
\r
12 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,
\r
13 RCVD_IN_MSPIKE_WL=-0.01] 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 lJHtSVJWQngp for <notmuch@notmuchmail.org>;
\r
17 Sat, 9 May 2015 11:00:48 -0700 (PDT)
\r
18 Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com
\r
19 [74.125.82.44]) by arlo.cworth.org (Postfix) with ESMTPS id BD7FC6DE0B20 for
\r
20 <notmuch@notmuchmail.org>; Sat, 9 May 2015 11:00:47 -0700 (PDT)
\r
21 Received: by wgin8 with SMTP id n8so96791605wgi.0
\r
22 for <notmuch@notmuchmail.org>; Sat, 09 May 2015 11:00:45 -0700 (PDT)
\r
23 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
24 d=1e100.net; s=20130820;
\r
25 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
\r
27 bh=j/6j5jXpn5apxoH0sd96oVb5Dx5qrbvUS0dtuyyQAjQ=;
\r
28 b=XCZnWQ6m7S5GuewBDK1hSahNU9s5FKw4CA6s2F+eLzeR3VU/Qivl2SRcL8VI0kA3aH
\r
29 61DVS0uZIhmyKu663kDNgyTRUhU33ikoN7KTAfogSbXlw821Sx9MiNfav/bwoJI+pBxD
\r
30 HFvwqu0+ivudyDz8h1wzJog7i7frn1tjHiOm8z3abmdFXn2VA4PMip1iGXIRd61S+qr2
\r
31 +2iqYNK05Q8MpxFYTtnSS8i1snROFmLnzDHdQqPvgm/HSR+YY1POQAym46wGXceNMqKC
\r
32 6MLs8wF/+1zDFR0SYniu5ZQwNDGoQ7PJteZxKQlGvUKI+4aFFIPlNcblbHRQ6HWNIVVU
\r
35 ALoCoQmI+OWS34dc9gKSLxeDkoNtVmKF0SpydCOC0MHhFrxRNJzMcnbK65EaP9o3yqUDkR1ZQCvU
\r
36 X-Received: by 10.194.134.40 with SMTP id ph8mr6533103wjb.147.1431194444264;
\r
37 Sat, 09 May 2015 11:00:44 -0700 (PDT)
\r
38 Received: from localhost (mobile-access-bcee39-176.dhcp.inet.fi.
\r
40 by mx.google.com with ESMTPSA id r9sm14353192wjo.26.2015.05.09.11.00.43
\r
41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
\r
42 Sat, 09 May 2015 11:00:43 -0700 (PDT)
\r
43 From: Jani Nikula <jani@nikula.org>
\r
44 To: Tomi Ollila <tomi.ollila@iki.fi>, Jani Nikula <jani@nikula.org>,
\r
45 notmuch@notmuchmail.org
\r
46 Subject: [PATCH] notmuch-emacs-mua: do not create a frame by default with
\r
48 Date: Sat, 9 May 2015 21:01:04 +0300
\r
49 Message-Id: <1431194464-2595-1-git-send-email-jani@nikula.org>
\r
50 X-Mailer: git-send-email 2.1.4
\r
51 In-Reply-To: <m2twwt9zn6.fsf@guru.guru-group.fi>
\r
52 References: <m2twwt9zn6.fsf@guru.guru-group.fi>
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.18
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Sat, 09 May 2015 18:00:50 -0000
\r
67 Make the default behaviour for --client the same as emacsclient
\r
68 default: do not create a new frame. Add a new option --create-frame,
\r
69 passing the same option to emacsclient to create a frame.
\r
73 v2: fix killing frame with --create-frame
\r
75 v3: fix --create-frame w/o --client parameter check
\r
77 doc/man1/notmuch-emacs-mua.rst | 14 +++++++++-----
\r
78 notmuch-emacs-mua | 30 +++++++++++++++++++++---------
\r
79 2 files changed, 30 insertions(+), 14 deletions(-)
\r
81 diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
\r
82 index 36b51cdc3b18..e39d9e5fba1f 100644
\r
83 --- a/doc/man1/notmuch-emacs-mua.rst
\r
84 +++ b/doc/man1/notmuch-emacs-mua.rst
\r
85 @@ -18,10 +18,6 @@ Supported options for **notmuch-emacs-mua** include
\r
90 - Use emacsclient, rather than emacs. This will start
\r
91 - an emacs daemon process if necessary.
\r
93 ``-s, --subject=``\ <subject>
\r
94 Specify the subject of the message.
\r
96 @@ -38,7 +34,15 @@ Supported options for **notmuch-emacs-mua** include
\r
97 Specify a file to include into the body of the message.
\r
99 ``--no-window-system``
\r
100 - Even if a window system is available, use the current terminal
\r
101 + Even if a window system is available, use the current terminal.
\r
104 + Use **emacsclient**, rather than **emacs**. This will start
\r
105 + an emacs daemon process if necessary.
\r
107 + ``--create-frame``
\r
108 + When --client is specified, create a new frame instead of trying
\r
109 + to use the current Emacs frame.
\r
112 Output the resulting elisp to stdout instead of evaluating it.
\r
113 diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
\r
114 index 79714305b3e2..102410a23f3e 100755
\r
115 --- a/notmuch-emacs-mua
\r
116 +++ b/notmuch-emacs-mua
\r
117 @@ -34,12 +34,12 @@ EMACS=${EMACS-emacs}
\r
118 EMACSCLIENT=${EMACSCLIENT-emacsclient}
\r
126 # The crux of it all: construct an elisp progn and eval it.
\r
127 ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"
\r
128 -ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
\r
130 # Short options compatible with mutt(1).
\r
131 while getopts :s:c:b:i:h opt; do
\r
132 @@ -63,7 +63,7 @@ while getopts :s:c:b:i:h opt; do
\r
135 # Long options without arguments.
\r
136 - --help|--print|--no-window-system|--client)
\r
137 + --help|--print|--no-window-system|--client|--create-frame)
\r
140 echo "$0: unknown long option ${opt}, or argument mismatch." >&2
\r
141 @@ -81,9 +81,6 @@ while getopts :s:c:b:i:h opt; do
\r
143 exec man notmuch-emacs-mua
\r
146 - USE_EMACSCLIENT="yes"
\r
149 ELISP="${ELISP} (message-goto-subject) (insert \"${OPTARG}\")"
\r
151 @@ -103,7 +100,13 @@ while getopts :s:c:b:i:h opt; do
\r
154 --no-window-system)
\r
159 + USE_EMACSCLIENT="yes"
\r
162 + CREATE_FRAME="--create-frame"
\r
165 # We should never end up here.
\r
166 @@ -122,6 +125,15 @@ for arg; do
\r
167 ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"
\r
170 +# If reusing a frame in emacsclient, don't kill the buffer.
\r
171 +if [ -n "$CREATE_FRAME" ]; then
\r
172 + if [ -z "$USE_EMACSCLIENT" ]; then
\r
173 + echo "$0: --create-frame is only applicable with --client." >&2
\r
176 + ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
\r
182 @@ -132,7 +144,7 @@ fi
\r
184 if [ -n "$USE_EMACSCLIENT" ]; then
\r
185 # Evaluate the progn.
\r
186 - exec ${EMACSCLIENT} ${CLIENT_TYPE} -a '' --eval "${ELISP}"
\r
187 + exec ${EMACSCLIENT} ${CREATE_FRAME} ${NO_WINDOW} -a '' --eval "${ELISP}"
\r
189 - exec ${EMACS} --eval "${ELISP}"
\r
190 + exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}"
\r