* [PATCH] notmuch-emacs-mua: do not create a frame by default with --client
@ 2015-03-22 20:14 Jani Nikula
2015-03-22 20:35 ` Tomi Ollila
2015-04-01 4:20 ` David Bremner
0 siblings, 2 replies; 10+ messages in thread
From: Jani Nikula @ 2015-03-22 20:14 UTC (permalink / raw)
To: notmuch
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=``\ <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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] notmuch-emacs-mua: do not create a frame by default with --client
2015-03-22 20:14 [PATCH] notmuch-emacs-mua: do not create a frame by default with --client Jani Nikula
@ 2015-03-22 20:35 ` Tomi Ollila
2015-04-01 4:20 ` David Bremner
1 sibling, 0 replies; 10+ messages in thread
From: Tomi Ollila @ 2015-03-22 20:35 UTC (permalink / raw)
To: Jani Nikula, notmuch
On Sun, Mar 22 2015, Jani Nikula <jani@nikula.org> wrote:
> 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.
>
> ---
Changes LGTM.
Tomi
>
> 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=``\ <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
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] notmuch-emacs-mua: do not create a frame by default with --client
2015-03-22 20:14 [PATCH] notmuch-emacs-mua: do not create a frame by default with --client Jani Nikula
2015-03-22 20:35 ` Tomi Ollila
@ 2015-04-01 4:20 ` David Bremner
2015-04-04 7:30 ` [PATCH v2] " Jani Nikula
1 sibling, 1 reply; 10+ messages in thread
From: David Bremner @ 2015-04-01 4:20 UTC (permalink / raw)
To: Jani Nikula, notmuch
Jani Nikula <jani@nikula.org> writes:
> 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!
I don't mind the UI, but it doesn't destroy the frame after sending anymore,
which I also liked.
d
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2] notmuch-emacs-mua: do not create a frame by default with --client
2015-04-01 4:20 ` David Bremner
@ 2015-04-04 7:30 ` Jani Nikula
2015-04-06 13:04 ` Tomi Ollila
0 siblings, 1 reply; 10+ messages in thread
From: Jani Nikula @ 2015-04-04 7:30 UTC (permalink / raw)
To: David Bremner, Jani Nikula, notmuch; +Cc: Tomi Ollila
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
---
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=``\ <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 79714305b3e2..90f585b699b8 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -34,12 +34,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
@@ -63,7 +63,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
@@ -81,9 +81,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}\")"
;;
@@ -103,7 +100,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.
@@ -122,6 +125,14 @@ for arg; do
ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"
done
+# If reusing a frame in emacsclient, don't kill the buffer.
+if [ -n "$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})"
@@ -132,7 +143,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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2] notmuch-emacs-mua: do not create a frame by default with --client
2015-04-04 7:30 ` [PATCH v2] " Jani Nikula
@ 2015-04-06 13:04 ` Tomi Ollila
2015-05-09 18:01 ` [PATCH] " Jani Nikula
0 siblings, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2015-04-06 13:04 UTC (permalink / raw)
To: Jani Nikula, notmuch
On Sat, Apr 04 2015, Jani Nikula <jani@nikula.org> wrote:
> 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
> ---
> 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
> @@ -122,6 +125,14 @@ for arg; do
> ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"
> done
>
> +# If reusing a frame in emacsclient, don't kill the buffer.
> +if [ -n "$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
> +
# If reusing a frame in emacsclient, don't kill the buffer.
if [ -n "$CREATE_FRAME" ]; then
if [ -z "$USE_EMACSCLIENT" ]; then
echo "$0: --create-frame is only applicable with --client." >&2
exit 1
fi
ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
fi
should work better...
Tomi
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] notmuch-emacs-mua: do not create a frame by default with --client
2015-04-06 13:04 ` Tomi Ollila
@ 2015-05-09 18:01 ` Jani Nikula
2015-05-10 5:52 ` David Bremner
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Jani Nikula @ 2015-05-09 18:01 UTC (permalink / raw)
To: Tomi Ollila, Jani Nikula, notmuch
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
---
doc/man1/notmuch-emacs-mua.rst | 14 +++++++++-----
notmuch-emacs-mua | 30 +++++++++++++++++++++---------
2 files changed, 30 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=``\ <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 79714305b3e2..102410a23f3e 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -34,12 +34,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
@@ -63,7 +63,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
@@ -81,9 +81,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}\")"
;;
@@ -103,7 +100,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.
@@ -122,6 +125,15 @@ for arg; do
ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"
done
+# If reusing a frame in emacsclient, don't kill the buffer.
+if [ -n "$CREATE_FRAME" ]; then
+ if [ -z "$USE_EMACSCLIENT" ]; then
+ echo "$0: --create-frame is only applicable with --client." >&2
+ exit 1
+ fi
+ ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
+fi
+
# End progn.
ELISP="${ELISP})"
@@ -132,7 +144,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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] notmuch-emacs-mua: do not create a frame by default with --client
2015-05-09 18:01 ` [PATCH] " Jani Nikula
@ 2015-05-10 5:52 ` David Bremner
2015-05-10 18:45 ` Tomi Ollila
2015-05-11 19:19 ` [PATCH] notmuch-emacs-mua: do not start emacs daemon w/o --create-frame Tomi Ollila
2 siblings, 0 replies; 10+ messages in thread
From: David Bremner @ 2015-05-10 5:52 UTC (permalink / raw)
To: Jani Nikula; +Cc: Tomi Ollila, notmuch
Jani Nikula <jani@nikula.org> writes:
> 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
The frame killing is OK for me now.
d
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] notmuch-emacs-mua: do not create a frame by default with --client
2015-05-09 18:01 ` [PATCH] " Jani Nikula
2015-05-10 5:52 ` David Bremner
@ 2015-05-10 18:45 ` Tomi Ollila
2015-05-11 19:19 ` [PATCH] notmuch-emacs-mua: do not start emacs daemon w/o --create-frame Tomi Ollila
2 siblings, 0 replies; 10+ messages in thread
From: Tomi Ollila @ 2015-05-10 18:45 UTC (permalink / raw)
To: Jani Nikula, Jani Nikula, notmuch
On Sat, May 09 2015, Jani Nikula <jani@nikula.org> wrote:
> 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.
I apologize for not testing the previous version beyond the initial failure
of running notmuch-emacs-mua w/o the --client...
... as now further testing shows IMO a expectation problem when plain
--client argument is given -- it behaves similar to
emacsclient -a '' --no-wait /dev/null
(currently I don't have access to X environment so I cannot check this
fully, anyway try this without emacs server running to see yourselves)
IMO the interface would be cleaner if these would pairs be somewhat analogous:
notmuch-emacs-mua --client
emacsclient -a '' /dev/null
and
notmuch-emacs-mua --client --no-wait
emacsclient -a '' --no-wait /dev/null
this also makes documentation so much easier
Tomi
>
> ---
>
> v2: fix killing frame with --create-frame
>
> v3: fix --create-frame w/o --client parameter check
> ---
> doc/man1/notmuch-emacs-mua.rst | 14 +++++++++-----
> notmuch-emacs-mua | 30 +++++++++++++++++++++---------
> 2 files changed, 30 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=``\ <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 79714305b3e2..102410a23f3e 100755
> --- a/notmuch-emacs-mua
> +++ b/notmuch-emacs-mua
> @@ -34,12 +34,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
> @@ -63,7 +63,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
> @@ -81,9 +81,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}\")"
> ;;
> @@ -103,7 +100,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.
> @@ -122,6 +125,15 @@ for arg; do
> ELISP="${ELISP} (message-goto-to) (insert \"${arg}, \")"
> done
>
> +# If reusing a frame in emacsclient, don't kill the buffer.
> +if [ -n "$CREATE_FRAME" ]; then
> + if [ -z "$USE_EMACSCLIENT" ]; then
> + echo "$0: --create-frame is only applicable with --client." >&2
> + exit 1
> + fi
> + ELISP="${ELISP} (setq message-exit-actions (list #'save-buffers-kill-terminal))"
> +fi
> +
> # End progn.
> ELISP="${ELISP})"
>
> @@ -132,7 +144,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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] notmuch-emacs-mua: do not start emacs daemon w/o --create-frame
2015-05-09 18:01 ` [PATCH] " Jani Nikula
2015-05-10 5:52 ` David Bremner
2015-05-10 18:45 ` Tomi Ollila
@ 2015-05-11 19:19 ` Tomi Ollila
2015-08-02 10:23 ` David Bremner
2 siblings, 1 reply; 10+ messages in thread
From: Tomi Ollila @ 2015-05-11 19:19 UTC (permalink / raw)
To: notmuch; +Cc: tomi.ollila
notmuch-emacs-mua --client used to start daemon process if it was
not running -- just that no emacs mail window of any kind from
that is visible to the user.
When not starting emacs server in this case notmuch-emacs-mua
user will get the same message as would emacsclient user
have, which should be enough for such user to understand how
to proceed starting emacs server in a way that it is useable
for this purpose.
---
After trying quite a few alternatives, perhaps this is
the way to close this case...
doc/man1/notmuch-emacs-mua.rst | 6 +++---
notmuch-emacs-mua | 8 ++++++--
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/doc/man1/notmuch-emacs-mua.rst b/doc/man1/notmuch-emacs-mua.rst
index e39d9e5fba1f..edaecc272e0f 100644
--- a/doc/man1/notmuch-emacs-mua.rst
+++ b/doc/man1/notmuch-emacs-mua.rst
@@ -37,12 +37,12 @@ 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**.
``--create-frame``
When --client is specified, create a new frame instead of trying
- to use the current Emacs frame.
+ to use the current Emacs frame. This will also start an emacs
+ daemon process if necessary.
``--print``
Output the resulting elisp to stdout instead of evaluating it.
diff --git a/notmuch-emacs-mua b/notmuch-emacs-mua
index 102410a23f3e..34ff4db3469b 100755
--- a/notmuch-emacs-mua
+++ b/notmuch-emacs-mua
@@ -142,9 +142,13 @@ if [ -n "$PRINT_ONLY" ]; then
exit 0
fi
+# Evaluate the progn.
if [ -n "$USE_EMACSCLIENT" ]; then
- # Evaluate the progn.
- exec ${EMACSCLIENT} ${CREATE_FRAME} ${NO_WINDOW} -a '' --eval "${ELISP}"
+ if [ -n "$CREATE_FRAME" ]; then
+ exec ${EMACSCLIENT} ${CREATE_FRAME} ${NO_WINDOW} -a '' --eval "${ELISP}"
+ else
+ exec ${EMACSCLIENT} ${CREATE_FRAME} ${NO_WINDOW} --eval "${ELISP}"
+ fi
else
exec ${EMACS} ${NO_WINDOW} --eval "${ELISP}"
fi
--
2.0.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] notmuch-emacs-mua: do not start emacs daemon w/o --create-frame
2015-05-11 19:19 ` [PATCH] notmuch-emacs-mua: do not start emacs daemon w/o --create-frame Tomi Ollila
@ 2015-08-02 10:23 ` David Bremner
0 siblings, 0 replies; 10+ messages in thread
From: David Bremner @ 2015-08-02 10:23 UTC (permalink / raw)
To: Tomi Ollila, notmuch; +Cc: tomi.ollila
Tomi Ollila <tomi.ollila@iki.fi> writes:
> notmuch-emacs-mua --client used to start daemon process if it was
> not running -- just that no emacs mail window of any kind from
> that is visible to the user.
>
> When not starting emacs server in this case notmuch-emacs-mua
> user will get the same message as would emacsclient user
> have, which should be enough for such user to understand how
> to proceed starting emacs server in a way that it is useable
> for this purpose.
I'm not a big fan of overloading arguments, i.e. if the daemon isn't
automatically started for all uses of --client, I'd rather there was
another argument like --auto-daemon so that there are at least 4 ways of
invoking
| n-e-m | start a new emacs instance, and kill it after |
| n-e-m --client | like emacsclient |
| n-e-m --client --create-frame | like emacsclient -c, destroy after send |
| n-e-m --client --create-frame --auto-daemon | like emacsclient -c -a, destroy after send |
Since there are probably only 3 users, this should be sufficient ;).
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-08-02 10:25 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-22 20:14 [PATCH] notmuch-emacs-mua: do not create a frame by default with --client Jani Nikula
2015-03-22 20:35 ` Tomi Ollila
2015-04-01 4:20 ` David Bremner
2015-04-04 7:30 ` [PATCH v2] " Jani Nikula
2015-04-06 13:04 ` Tomi Ollila
2015-05-09 18:01 ` [PATCH] " Jani Nikula
2015-05-10 5:52 ` David Bremner
2015-05-10 18:45 ` Tomi Ollila
2015-05-11 19:19 ` [PATCH] notmuch-emacs-mua: do not start emacs daemon w/o --create-frame Tomi Ollila
2015-08-02 10:23 ` David Bremner
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).