[PATCH v4 4/5] notmuch-emacs-mua: add --auto-daemon option to start Emacs daemon...
authorJani Nikula <jani@nikula.org>
Sat, 15 Aug 2015 09:05:14 +0000 (12:05 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:49:21 +0000 (14:49 -0700)
dd/56be342cd8a1516f25a43ff11397e8d734e12c [new file with mode: 0644]

diff --git a/dd/56be342cd8a1516f25a43ff11397e8d734e12c b/dd/56be342cd8a1516f25a43ff11397e8d734e12c
new file mode 100644 (file)
index 0000000..80feb80
--- /dev/null
@@ -0,0 +1,142 @@
+Return-Path: <jani@nikula.org>\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 65FC46DE1A2F\r
+ for <notmuch@notmuchmail.org>; Sat, 15 Aug 2015 02:05:35 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.121\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.121 tagged_above=-999 required=5 tests=[AWL=0.599,\r
+  RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]\r
+ 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 LT2DbgYHoBRN for <notmuch@notmuchmail.org>;\r
+ Sat, 15 Aug 2015 02:05:33 -0700 (PDT)\r
+Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
+ [209.85.212.173])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 54F936DE1A3A\r
+ for <notmuch@notmuchmail.org>; Sat, 15 Aug 2015 02:05:19 -0700 (PDT)\r
+Received: by wicja10 with SMTP id ja10so40755502wic.1\r
+ for <notmuch@notmuchmail.org>; Sat, 15 Aug 2015 02:05:17 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=YPz7r5fuWFOOc5iIi8DHQoZHFeUlgGrPligRyITtfAc=;\r
+ b=cK3korgwOgwJOy2YE++uS6qsB7iQKNSkMk8q4STrv1a4DbzreyLQJ/zezjBBsIhHd8\r
+ z6cEmTuXxF2l1oCok13XFJVv/2WWGQIDcYi5u8OBoE4RFXnKBr49vMDJmRt+lswkZsh/\r
+ 3GcG+rryeBEyW/dJ45arahUhkOKpqVjxTCwaP6hi/HU7OUAztBhEWt2gmKSIeNvOI8MI\r
+ khj1xXRjp0cwU2Tf/Pnn5L2kdYuOwgQMWMHe1dU5vFrEkL9bQpCZIBRMIBH+5F7F5Yci\r
+ T3IcCkO8+4ytdoijJ9FmCTChj83Bklkyq4q1jlfIHjAb9YWAIwyBVOp3zBKRfy1C/YUv\r
+ SC0Q==\r
+X-Gm-Message-State:\r
+ ALoCoQk7EVT2QXNBZ4GQkWTx240Ev7UpghOyKBoVELwXZL9ZXw+f9hcdBAc8ZM2TY0bb00xilz2J\r
+X-Received: by 10.180.12.148 with SMTP id y20mr14249367wib.80.1439629517897;\r
+ Sat, 15 Aug 2015 02:05:17 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.\r
+ [188.238.79.131])\r
+ by smtp.gmail.com with ESMTPSA id cd16sm6880084wib.19.2015.08.15.02.05.17\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 15 Aug 2015 02:05:17 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 4/5] notmuch-emacs-mua: add --auto-daemon option to start\r
+ Emacs daemon as needed\r
+Date: Sat, 15 Aug 2015 12:05:14 +0300\r
+Message-Id:\r
+ <ed5cc25f2dfb978192f69c7f458771115381c359.1439629384.git.jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <cover.1439629384.git.jani@nikula.org>\r
+References: <cover.1439629384.git.jani@nikula.org>\r
+In-Reply-To: <cover.1439629384.git.jani@nikula.org>\r
+References: <cover.1439629384.git.jani@nikula.org>\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\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: Sat, 15 Aug 2015 09:05:35 -0000\r
+\r
+Automatically starting Emacs in daemon mode if the Emacs server is not\r
+running is a matter of preference better not hard coded in\r
+notmuch-emacs-mua. Add an option to control the behaviour.\r
+---\r
+ doc/man1/notmuch-emacs-mua.rst | 9 +++++++--\r
+ notmuch-emacs-mua              | 8 ++++++--\r
+ 2 files changed, 13 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst\r
+index 7c2f5c24f1c0..89a2fead17b1 100644\r
+--- a/doc/man1/notmuch-emacs-mua.rst\r
++++ b/doc/man1/notmuch-emacs-mua.rst\r
+@@ -37,8 +37,13 @@ Supported options for **notmuch-emacs-mua** include\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
++        Use **emacsclient**, rather than **emacs**. For\r
++        **emacsclient** to work, you need an already running Emacs\r
++        with a server, or use ``--auto-daemon``.\r
++\r
++    ``--auto-daemon``\r
++        Automatically start Emacs in daemon mode, if the Emacs server\r
++        is not running. Applicable with ``--client``.\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 1f088c42feb9..ac03a4a60d56 100755\r
+--- a/notmuch-emacs-mua\r
++++ b/notmuch-emacs-mua\r
+@@ -36,6 +36,7 @@ EMACSCLIENT=${EMACSCLIENT-emacsclient}\r
+ PRINT_ONLY=\r
+ NO_WINDOW=\r
+ USE_EMACSCLIENT=\r
++AUTO_DAEMON=\r
+ CREATE_FRAME="-c"\r
\r
+ # The crux of it all: construct an elisp progn and eval it.\r
+@@ -64,7 +65,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|--auto-daemon)\r
+                   ;;\r
+               *)\r
+                   echo "$0: unknown long option ${opt}, or argument mismatch." >&2\r
+@@ -107,6 +108,9 @@ while getopts :s:c:b:i:h opt; do\r
+       --client)\r
+           USE_EMACSCLIENT="yes"\r
+           ;;\r
++      --auto-daemon)\r
++          AUTO_DAEMON="--alternate-editor="\r
++          ;;\r
+       *)\r
+           # We should never end up here.\r
+           echo "$0: internal error (option ${opt})." >&2\r
+@@ -134,7 +138,7 @@ fi\r
\r
+ if [ -n "$USE_EMACSCLIENT" ]; then\r
+     # Evaluate the progn.\r
+-    exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} -a '' --eval "${ELISP}"\r
++    exec ${EMACSCLIENT} ${NO_WINDOW} ${CREATE_FRAME} ${AUTO_DAEMON} --eval "${ELISP}"\r
+ else\r
+     exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}"\r
+ fi\r
+-- \r
+2.1.4\r
+\r