From: Jani Nikula Date: Sat, 15 Aug 2015 09:05:15 +0000 (+0300) Subject: [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by default with --client X-Git-Url: http://git.tremily.us/?p=notmuch-archives.git;a=commitdiff_plain;h=87284436c60b89ac818c583f4bdcb351bbab194d [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by default with --client --- diff --git a/50/9ca0866dbe5591003ab8bd25189bfb33733c27 b/50/9ca0866dbe5591003ab8bd25189bfb33733c27 new file mode 100644 index 000000000..f47e2b59f --- /dev/null +++ b/50/9ca0866dbe5591003ab8bd25189bfb33733c27 @@ -0,0 +1,163 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id C01E06DE1A3A + for ; Sat, 15 Aug 2015 02:05:36 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.126 +X-Spam-Level: +X-Spam-Status: No, score=-0.126 tagged_above=-999 required=5 tests=[AWL=0.594, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id sJ5hIBbdlHLx for ; + Sat, 15 Aug 2015 02:05:35 -0700 (PDT) +Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com + [209.85.212.182]) + by arlo.cworth.org (Postfix) with ESMTPS id 29A506DE1A1C + for ; Sat, 15 Aug 2015 02:05:21 -0700 (PDT) +Received: by wicne3 with SMTP id ne3so35939740wic.0 + for ; Sat, 15 Aug 2015 02:05:19 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=xzaayMHM26NsqHwVFkIeSFyM+hUzgiHOcOBsNHoClw0=; + b=Dsr3h9yZ4sTYJ6KFqUQgtA67pOqpyO1mcRqMaryDqxBRT8SVWtIuRQPR0FENgCwOCu + AT9JdsmjobaGifaocgM2DTPjFqynBZwyuvKl3zwa21CqUCLHOFX+aFUTxe2d+15/RxVx + JbJgydJLNZ2y5Cd0FiyjfZ6VAhxNIw7FcQk52RbTOjmjs1pK+cDc1ASWyvXMKe2LlbuN + AtMyanXWGTkjne3PLlUI+ktVelH2RbBo11cU08Awp0k1NfNJx4YFnsEOlR33jsePvr+X + MAbG5Ifxp22mv3tVNQ33utvDJSBFHbBAgkXj/xhhdGLBrDvum6aXZ4pAUzMhxoLO/qn4 + fDIA== +X-Gm-Message-State: + ALoCoQkFhTlZ3WX/uUufUdPpmaSUm1f4y+JCmKsS9E4rh+Xw8tje0sKivI0ECwh6EKzhSNs5K/5V +X-Received: by 10.194.122.200 with SMTP id lu8mr8124032wjb.83.1439629519716; + Sat, 15 Aug 2015 02:05:19 -0700 (PDT) +Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi. + [188.238.79.131]) + by smtp.gmail.com with ESMTPSA id kb1sm12021350wjc.24.2015.08.15.02.05.18 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 15 Aug 2015 02:05:19 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v4 5/5] notmuch-emacs-mua: do not create a frame by default + with --client +Date: Sat, 15 Aug 2015 12:05:15 +0300 +Message-Id: + <455026447d3f75b1038ac11cebe734431604be9d.1439629384.git.jani@nikula.org> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: +References: +In-Reply-To: +References: +Cc: Tomi Ollila +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 15 Aug 2015 09:05:36 -0000 + +Make the default behaviour for --client the same as emacsclient +default: do not create a new frame. Add a new option --create-frame, +passing the same option to emacsclient to create a frame. + +--- + +v2: fix killing frame with --create-frame + +v3: fix --create-frame w/o --client parameter check + +v4: fix kill terminal logic, document behaviour with daemon mode +--- + doc/man1/notmuch-emacs-mua.rst | 6 ++++++ + notmuch-emacs-mua | 14 ++++++++++---- + 2 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst +index 89a2fead17b1..c3689eb82c8a 100644 +--- a/doc/man1/notmuch-emacs-mua.rst ++++ b/doc/man1/notmuch-emacs-mua.rst +@@ -45,6 +45,12 @@ Supported options for **notmuch-emacs-mua** include + Automatically start Emacs in daemon mode, if the Emacs server + is not running. Applicable with ``--client``. + ++ ``--create-frame`` ++ Create a new frame instead of trying to use the current Emacs ++ frame. Applicable with ``--client``. This will be required ++ when Emacs is running (or automatically started with ++ ``--auto-daemon``) in daemon mode. ++ + ``--print`` + Output the resulting elisp to stdout instead of evaluating it. + +diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua +index ac03a4a60d56..b51d8d0e2c5b 100755 +--- a/notmuch-emacs-mua ++++ b/notmuch-emacs-mua +@@ -37,11 +37,10 @@ PRINT_ONLY= + NO_WINDOW= + USE_EMACSCLIENT= + AUTO_DAEMON= +-CREATE_FRAME="-c" ++CREATE_FRAME= + + # The crux of it all: construct an elisp progn and eval it. + ELISP="(prog1 'done (require 'notmuch) (notmuch-mua-new-mail)" +-ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))" + + # Short options compatible with mutt(1). + while getopts :s:c:b:i:h opt; do +@@ -65,7 +64,7 @@ while getopts :s:c:b:i:h opt; do + opt=${opt%%=*} + ;; + # Long options without arguments. +- --help|--print|--no-window-system|--client|--auto-daemon) ++ --help|--print|--no-window-system|--client|--auto-daemon|--create-frame) + ;; + *) + echo "$0: unknown long option ${opt}, or argument mismatch." >&2 +@@ -103,7 +102,6 @@ while getopts :s:c:b:i:h opt; do + ;; + --no-window-system) + NO_WINDOW="-nw" +- CREATE_FRAME= + ;; + --client) + USE_EMACSCLIENT="yes" +@@ -111,6 +109,9 @@ while getopts :s:c:b:i:h opt; do + --auto-daemon) + AUTO_DAEMON="--alternate-editor=" + ;; ++ --create-frame) ++ CREATE_FRAME="-c" ++ ;; + *) + # We should never end up here. + echo "$0: internal error (option ${opt})." >&2 +@@ -128,6 +129,11 @@ for arg; do + ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")" + done + ++# Kill the terminal/frame if we're creating one. ++if [ -z "$USE_EMACSCLIENT" -o -n "$CREATE_FRAME" -o -n "$NO_WINDOW" ]; then ++ ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))" ++fi ++ + # End progn. + ELISP="${ELISP})" + +-- +2.1.4 +