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 65FC46DE1A2F for ; Sat, 15 Aug 2015 02:05:35 -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.121 X-Spam-Level: X-Spam-Status: No, score=-0.121 tagged_above=-999 required=5 tests=[AWL=0.599, 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 LT2DbgYHoBRN for ; Sat, 15 Aug 2015 02:05:33 -0700 (PDT) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by arlo.cworth.org (Postfix) with ESMTPS id 54F936DE1A3A for ; Sat, 15 Aug 2015 02:05:19 -0700 (PDT) Received: by wicja10 with SMTP id ja10so40755502wic.1 for ; Sat, 15 Aug 2015 02:05:17 -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=YPz7r5fuWFOOc5iIi8DHQoZHFeUlgGrPligRyITtfAc=; b=cK3korgwOgwJOy2YE++uS6qsB7iQKNSkMk8q4STrv1a4DbzreyLQJ/zezjBBsIhHd8 z6cEmTuXxF2l1oCok13XFJVv/2WWGQIDcYi5u8OBoE4RFXnKBr49vMDJmRt+lswkZsh/ 3GcG+rryeBEyW/dJ45arahUhkOKpqVjxTCwaP6hi/HU7OUAztBhEWt2gmKSIeNvOI8MI khj1xXRjp0cwU2Tf/Pnn5L2kdYuOwgQMWMHe1dU5vFrEkL9bQpCZIBRMIBH+5F7F5Yci T3IcCkO8+4ytdoijJ9FmCTChj83Bklkyq4q1jlfIHjAb9YWAIwyBVOp3zBKRfy1C/YUv SC0Q== X-Gm-Message-State: ALoCoQk7EVT2QXNBZ4GQkWTx240Ev7UpghOyKBoVELwXZL9ZXw+f9hcdBAc8ZM2TY0bb00xilz2J X-Received: by 10.180.12.148 with SMTP id y20mr14249367wib.80.1439629517897; Sat, 15 Aug 2015 02:05:17 -0700 (PDT) Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi. [188.238.79.131]) by smtp.gmail.com with ESMTPSA id cd16sm6880084wib.19.2015.08.15.02.05.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 15 Aug 2015 02:05:17 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v4 4/5] notmuch-emacs-mua: add --auto-daemon option to start Emacs daemon as needed Date: Sat, 15 Aug 2015 12:05:14 +0300 Message-Id: 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:35 -0000 Automatically starting Emacs in daemon mode if the Emacs server is not running is a matter of preference better not hard coded in notmuch-emacs-mua. Add an option to control the behaviour. --- doc/man1/notmuch-emacs-mua.rst | 9 +++++++-- notmuch-emacs-mua | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst index 7c2f5c24f1c0..89a2fead17b1 100644 --- a/doc/man1/notmuch-emacs-mua.rst +++ b/doc/man1/notmuch-emacs-mua.rst @@ -37,8 +37,13 @@ Supported options for **notmuch-emacs-mua** include Even if a window system is available, use the current terminal. ``--client`` - Use **emacsclient**, rather than **emacs**. This will start - an Emacs daemon process if necessary. + Use **emacsclient**, rather than **emacs**. For + **emacsclient** to work, you need an already running Emacs + with a server, or use ``--auto-daemon``. + + ``--auto-daemon`` + Automatically start Emacs in daemon mode, if the Emacs server + is not running. Applicable with ``--client``. ``--print`` Output the resulting elisp to stdout instead of evaluating it. diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua index 1f088c42feb9..ac03a4a60d56 100755 --- a/notmuch-emacs-mua +++ b/notmuch-emacs-mua @@ -36,6 +36,7 @@ EMACSCLIENT=${EMACSCLIENT-emacsclient} PRINT_ONLY= NO_WINDOW= USE_EMACSCLIENT= +AUTO_DAEMON= CREATE_FRAME="-c" # The crux of it all: construct an elisp progn and eval it. @@ -64,7 +65,7 @@ while getopts :s:c:b:i:h opt; do opt=${opt%%=*} ;; # Long options without arguments. - --help|--print|--no-window-system|--client) + --help|--print|--no-window-system|--client|--auto-daemon) ;; *) echo "$0: unknown long option ${opt}, or argument mismatch." >&2 @@ -107,6 +108,9 @@ while getopts :s:c:b:i:h opt; do --client) USE_EMACSCLIENT="yes" ;; + --auto-daemon) + AUTO_DAEMON="--alternate-editor=" + ;; *) # We should never end up here. echo "$0: internal error (option ${opt})." >&2 @@ -134,7 +138,7 @@ fi if [ -n "$USE_EMACSCLIENT" ]; then # Evaluate the progn. - exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} -a '' --eval "${ELISP}" + exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} ${AUTO_DAEMON} --eval "${ELISP}" else exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}" fi -- 2.1.4