From: Jani Nikula Date: Sun, 22 Mar 2015 20:14:29 +0000 (+0200) Subject: [PATCH] notmuch-emacs-mua: do not create a frame by default with --client X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8090e60200dde2ce95881e248b0e8b953cd01b15;p=notmuch-archives.git [PATCH] notmuch-emacs-mua: do not create a frame by default with --client --- diff --git a/ac/6505f2b7eefaffb24d63dabb77bcc9544e2a43 b/ac/6505f2b7eefaffb24d63dabb77bcc9544e2a43 new file mode 100644 index 000000000..4e8128a46 --- /dev/null +++ b/ac/6505f2b7eefaffb24d63dabb77bcc9544e2a43 @@ -0,0 +1,191 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 8E0FE431FBF + for ; Sun, 22 Mar 2015 13:14:15 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 1.738 +X-Spam-Level: * +X-Spam-Status: No, score=1.738 tagged_above=-999 required=5 + tests=[DNS_FROM_AHBL_RHSBL=2.438, RCVD_IN_DNSWL_LOW=-0.7] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id puO0+LDqRKhM for ; + Sun, 22 Mar 2015 13:14:12 -0700 (PDT) +Received: from mail-we0-f178.google.com (mail-we0-f178.google.com + [74.125.82.178]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 2CAF6431FBC + for ; Sun, 22 Mar 2015 13:14:11 -0700 (PDT) +Received: by webee49 with SMTP id ee49so12857002web.2 + for ; Sun, 22 Mar 2015 13:14:10 -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; + bh=oAboX8COGcDdCna+9MXMvbW1nNZWWeNtyrOwhvZ10W4=; + b=XyP+UtK9wc3EKJw13xZqBXuuu97+g+sqiDl43n40ncphkRsODeWBxoiNyf19Nf2Wqs + hfCeVqHByomEM+7660k3gLksIJ8YJ6okOQs07baFT0Fu+nwOpCAQEU8lWLu5zzUjEr+X + 83xD9dHcJXtgreIKZWHhcpeQNqLD5L3TNQv3s9tfmkHRNulHtuq63N/jWEEnbgJBRnM6 + gjcuugXg73O+kfQTU9g37fT1GnwzkjW9fKtJMIHow30DLRQAE8tUUf/bzPKDG9CVQiK+ + 8G0tau3Hqk4g7YGbZL3w9W9JO12SRg/nutcWF2cIDbfiVFKoB1GbtMUbPM9Nw+i/1Q1R + n/rw== +X-Gm-Message-State: + ALoCoQkjuGS+Lo46FFSzEQU6J65+hDezf+s6HBC5jQNm7Cx4f9CpCXccoUyZL1YCguyZbx+Xu1xY +X-Received: by 10.180.207.227 with SMTP id lz3mr13430518wic.47.1427055250708; + Sun, 22 Mar 2015 13:14:10 -0700 (PDT) +Received: from localhost (mobile-internet-bcee3b-76.dhcp.inet.fi. + [188.238.59.76]) + by mx.google.com with ESMTPSA id o10sm4295654wiy.18.2015.03.22.13.14.09 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 22 Mar 2015 13:14:09 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH] notmuch-emacs-mua: do not create a frame by default with + --client +Date: Sun, 22 Mar 2015 22:14:29 +0200 +Message-Id: <1427055269-4742-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 2.1.4 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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: Sun, 22 Mar 2015 20:14:15 -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. + +--- + +With this, 'notmuch-emacs-mua --client' does what I want, which was +not possible with any combination of options before. Please see if you +can still do what you want! +--- + doc/man1/notmuch-emacs-mua.rst | 14 +++++++++----- + notmuch-emacs-mua | 29 ++++++++++++++++++++--------- + 2 files changed, 29 insertions(+), 14 deletions(-) + +diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst +index 36b51cdc3b18..e39d9e5fba1f 100644 +--- a/doc/man1/notmuch-emacs-mua.rst ++++ b/doc/man1/notmuch-emacs-mua.rst +@@ -18,10 +18,6 @@ Supported options for **notmuch-emacs-mua** include + ``-h, --help`` + Display help. + +- ``--client`` +- Use emacsclient, rather than emacs. This will start +- an emacs daemon process if necessary. +- + ``-s, --subject=``\ + Specify the subject of the message. + +@@ -38,7 +34,15 @@ Supported options for **notmuch-emacs-mua** include + Specify a file to include into the body of the message. + + ``--no-window-system`` +- Even if a window system is available, use the current terminal ++ 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. ++ ++ ``--create-frame`` ++ When --client is specified, create a new frame instead of trying ++ to use the current Emacs frame. + + ``--print`` + Output the resulting elisp to stdout instead of evaluating it. +diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua +index 13f67bee4417..68c2643df581 100755 +--- a/notmuch-emacs-mua ++++ b/notmuch-emacs-mua +@@ -31,12 +31,12 @@ EMACS=${EMACS-emacs} + EMACSCLIENT=${EMACSCLIENT-emacsclient} + + PRINT_ONLY= ++NO_WINDOW= + USE_EMACSCLIENT= +-CLIENT_TYPE="-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 +@@ -60,7 +60,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|--create-frame) + ;; + *) + echo "$0: unknown long option ${opt}, or argument mismatch." >&2 +@@ -80,9 +80,6 @@ while getopts :s:c:b:i:h opt; do + --help|h) + exec man notmuch-emacs-mua + ;; +- --client) +- USE_EMACSCLIENT="yes" +- ;; + --subject|s) + ELISP="${ELISP} (message-goto-subject) (insert \"${OPTARG}\")" + ;; +@@ -102,7 +99,13 @@ while getopts :s:c:b:i:h opt; do + PRINT_ONLY=1 + ;; + --no-window-system) +- CLIENT_TYPE="-t" ++ NO_WINDOW="-nw" ++ ;; ++ --client) ++ USE_EMACSCLIENT="yes" ++ ;; ++ --create-frame) ++ CREATE_FRAME="--create-frame" + ;; + *) + # We should never end up here. +@@ -121,6 +124,14 @@ for arg; do + ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")" + done + ++# If reusing a frame in emacsclient, don't kill the buffer. ++if [ -z "$CREATE_FRAME" ]; then ++ ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))" ++elif [ -z "$USE_EMACSCLIENT" ]; then ++ echo "$0: --create-frame is only applicable with --client." >&2 ++ exit 1 ++fi ++ + # End progn. + ELISP="${ELISP})" + +@@ -131,7 +142,7 @@ fi + + if [ -n "$USE_EMACSCLIENT" ]; then + # Evaluate the progn. +- exec ${EMACSCLIENT} ${CLIENT_TYPE} -a '' --eval "${ELISP}" ++ exec ${EMACSCLIENT} ${CREATE_FRAME} ${NO_WINDOW} -a '' --eval "${ELISP}" + else +- exec ${EMACS} --eval "${ELISP}" ++ exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}" + fi +-- +2.1.4 +