From 609e42aef84838939c959c6d6d11a0244cea16b4 Mon Sep 17 00:00:00 2001 From: DylanRitchings <43646210+DylanRitchings@users.noreply.github.com> Date: Mon, 15 Aug 2022 01:02:44 +0100 Subject: [PATCH] Fixed bug that caused emacs terminal args --- plugins/emacs/emacs.plugin.zsh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/plugins/emacs/emacs.plugin.zsh b/plugins/emacs/emacs.plugin.zsh index fede5b0c4..529f711e3 100644 --- a/plugins/emacs/emacs.plugin.zsh +++ b/plugins/emacs/emacs.plugin.zsh @@ -24,7 +24,6 @@ export EMACS_PLUGIN_LAUNCHER="${0:A:h}/emacsclient.sh" # set EDITOR if not already defined. export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}" -alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait" alias e=emacs # open terminal emacsclient alias te="$EMACS_PLUGIN_LAUNCHER -nw" @@ -66,3 +65,13 @@ function ecd { file="$(efile)" || return $? echo "${file:h}" } + +# Opens emacs with --no-wait argument +function emacs { + # Checks for emacs terminal arguments which are incompatible with --no-wait + if [[ $* =~ "-nw" || $* =~ "-t" || $* =~ "-tty" ]]; then + $EMACS_PLUGIN_LAUNCHER $@ + else + $EMACS_PLUGIN_LAUNCHER --no-wait $@ + fi +}