--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 6C0E06DE0AC7\r
+ for <notmuch@notmuchmail.org>; Sun, 10 May 2015 11:45:49 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.08\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.08 tagged_above=-999 required=5 tests=[AWL=0.428,\r
+ SPF_NEUTRAL=0.652] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id tA4v0pKgR6NV for <notmuch@notmuchmail.org>;\r
+ Sun, 10 May 2015 11:45:46 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 4936C6DE02C9\r
+ for <notmuch@notmuchmail.org>; Sun, 10 May 2015 11:45:45 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id A7371100046;\r
+ Sun, 10 May 2015 21:45:20 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jani Nikula <jani@nikula.org>, Jani Nikula <jani@nikula.org>,\r
+ notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] notmuch-emacs-mua: do not create a frame by default with\r
+ --client\r
+In-Reply-To: <1431194464-2595-1-git-send-email-jani@nikula.org>\r
+References: <m2twwt9zn6.fsf@guru.guru-group.fi>\r
+ <1431194464-2595-1-git-send-email-jani@nikula.org>\r
+User-Agent: Notmuch/0.19+115~g9a981cb (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Sun, 10 May 2015 21:45:20 +0300\r
+Message-ID: <m2zj5cw9tr.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 10 May 2015 18:45:49 -0000\r
+\r
+On Sat, May 09 2015, Jani Nikula <jani@nikula.org> wrote:\r
+\r
+> Make the default behaviour for --client the same as emacsclient\r
+> default: do not create a new frame. Add a new option --create-frame,\r
+> passing the same option to emacsclient to create a frame.\r
+\r
+I apologize for not testing the previous version beyond the initial failure\r
+of running notmuch-emacs-mua w/o the --client...\r
+\r
+... as now further testing shows IMO a expectation problem when plain\r
+--client argument is given -- it behaves similar to\r
+\r
+emacsclient -a '' --no-wait /dev/null\r
+\r
+(currently I don't have access to X environment so I cannot check this\r
+fully, anyway try this without emacs server running to see yourselves)\r
+\r
+IMO the interface would be cleaner if these would pairs be somewhat analogous:\r
+\r
+\r
+notmuch-emacs-mua --client\r
+emacsclient -a '' /dev/null\r
+\r
+and\r
+\r
+notmuch-emacs-mua --client --no-wait\r
+emacsclient -a '' --no-wait /dev/null\r
+\r
+\r
+this also makes documentation so much easier\r
+\r
+\r
+Tomi\r
+\r
+\r
+\r
+>\r
+> ---\r
+>\r
+> v2: fix killing frame with --create-frame\r
+>\r
+> v3: fix --create-frame w/o --client parameter check\r
+> ---\r
+> doc/man1/notmuch-emacs-mua.rst | 14 +++++++++-----\r
+> notmuch-emacs-mua | 30 +++++++++++++++++++++---------\r
+> 2 files changed, 30 insertions(+), 14 deletions(-)\r
+>\r
+> diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst\r
+> index 36b51cdc3b18..e39d9e5fba1f 100644\r
+> --- a/doc/man1/notmuch-emacs-mua.rst\r
+> +++ b/doc/man1/notmuch-emacs-mua.rst\r
+> @@ -18,10 +18,6 @@ Supported options for **notmuch-emacs-mua** include\r
+> ``-h, --help``\r
+> Display help.\r
+>\r
+> - ``--client``\r
+> - Use emacsclient, rather than emacs. This will start\r
+> - an emacs daemon process if necessary.\r
+> -\r
+> ``-s, --subject=``\ <subject>\r
+> Specify the subject of the message.\r
+>\r
+> @@ -38,7 +34,15 @@ Supported options for **notmuch-emacs-mua** include\r
+> Specify a file to include into the body of the message.\r
+>\r
+> ``--no-window-system``\r
+> - Even if a window system is available, use the current terminal\r
+> + Even if a window system is available, use the current terminal.\r
+> +\r
+> + ``--client``\r
+> + Use **emacsclient**, rather than **emacs**. This will start\r
+> + an emacs daemon process if necessary.\r
+> +\r
+> + ``--create-frame``\r
+> + When --client is specified, create a new frame instead of trying\r
+> + to use the current Emacs frame.\r
+>\r
+> ``--print``\r
+> Output the resulting elisp to stdout instead of evaluating it.\r
+> diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua\r
+> index 79714305b3e2..102410a23f3e 100755\r
+> --- a/notmuch-emacs-mua\r
+> +++ b/notmuch-emacs-mua\r
+> @@ -34,12 +34,12 @@ EMACS=${EMACS-emacs}\r
+> EMACSCLIENT=${EMACSCLIENT-emacsclient}\r
+>\r
+> PRINT_ONLY=\r
+> +NO_WINDOW=\r
+> USE_EMACSCLIENT=\r
+> -CLIENT_TYPE="-c"\r
+> +CREATE_FRAME=\r
+>\r
+> # The crux of it all: construct an elisp progn and eval it.\r
+> ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)"\r
+> -ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
+>\r
+> # Short options compatible with mutt(1).\r
+> while getopts :s:c:b:i:h opt; do\r
+> @@ -63,7 +63,7 @@ while getopts :s:c:b:i:h opt; do\r
+> opt=${opt%%=*}\r
+> ;;\r
+> # Long options without arguments.\r
+> - --help|--print|--no-window-system|--client)\r
+> + --help|--print|--no-window-system|--client|--create-frame)\r
+> ;;\r
+> *)\r
+> echo "$0: unknown long option ${opt}, or argument mismatch." >&2\r
+> @@ -81,9 +81,6 @@ while getopts :s:c:b:i:h opt; do\r
+> --help|h)\r
+> exec man notmuch-emacs-mua\r
+> ;;\r
+> - --client)\r
+> - USE_EMACSCLIENT="yes"\r
+> - ;;\r
+> --subject|s)\r
+> ELISP="${ELISP} (message-goto-subject) (insert \"${OPTARG}\")"\r
+> ;;\r
+> @@ -103,7 +100,13 @@ while getopts :s:c:b:i:h opt; do\r
+> PRINT_ONLY=1\r
+> ;;\r
+> --no-window-system)\r
+> - CLIENT_TYPE="-t"\r
+> + NO_WINDOW="-nw"\r
+> + ;;\r
+> + --client)\r
+> + USE_EMACSCLIENT="yes"\r
+> + ;;\r
+> + --create-frame)\r
+> + CREATE_FRAME="--create-frame"\r
+> ;;\r
+> *)\r
+> # We should never end up here.\r
+> @@ -122,6 +125,15 @@ for arg; do\r
+> ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"\r
+> done\r
+>\r
+> +# If reusing a frame in emacsclient, don't kill the buffer.\r
+> +if [ -n "$CREATE_FRAME" ]; then\r
+> + if [ -z "$USE_EMACSCLIENT" ]; then\r
+> + echo "$0: --create-frame is only applicable with --client." >&2\r
+> + exit 1\r
+> + fi\r
+> + ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"\r
+> +fi\r
+> +\r
+> # End progn.\r
+> ELISP="${ELISP})"\r
+>\r
+> @@ -132,7 +144,7 @@ fi\r
+>\r
+> if [ -n "$USE_EMACSCLIENT" ]; then\r
+> # Evaluate the progn.\r
+> - exec ${EMACSCLIENT} ${CLIENT_TYPE} -a '' --eval "${ELISP}"\r
+> + exec ${EMACSCLIENT} ${CREATE_FRAME} ${NO_WINDOW} -a '' --eval "${ELISP}"\r
+> else\r
+> - exec ${EMACS} --eval "${ELISP}"\r
+> + exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}"\r
+> fi\r
+> --\r
+> 2.1.4\r