summaryrefslogtreecommitdiff
path: root/plugins/emacs/emacsclient.sh
diff options
context:
space:
mode:
authorhjpotter92 <hjpotter92@users.noreply.github.com>2016-06-21 00:45:55 +0530
committerMarc Cornellà <marc.cornella@live.com>2016-06-20 21:15:55 +0200
commit909fcef0469a2706508c0197e14aa45654702044 (patch)
treea1710ac2a1990373ab76b0e0c72fe3d7bcce590e /plugins/emacs/emacsclient.sh
parentd012402dada1ec7d8796f2f4b04744d817137b4d (diff)
downloadzsh-909fcef0469a2706508c0197e14aa45654702044.tar.gz
zsh-909fcef0469a2706508c0197e14aa45654702044.tar.bz2
zsh-909fcef0469a2706508c0197e14aa45654702044.zip
Fix issue with `dash` as the default `/bin/sh` script executing program. (#5177)
* `function` keyword removed * Fixup the `if` statement and operators
Diffstat (limited to 'plugins/emacs/emacsclient.sh')
-rwxr-xr-xplugins/emacs/emacsclient.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/emacs/emacsclient.sh b/plugins/emacs/emacsclient.sh
index d61ebb15b..41682512d 100755
--- a/plugins/emacs/emacsclient.sh
+++ b/plugins/emacs/emacsclient.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-function _emacsfun
+_emacsfun()
{
# get list of available X windows.
x=`emacsclient --alternate-editor '' --eval '(x-display-list)' 2>/dev/null`
@@ -18,7 +18,8 @@ function _emacsfun
# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
# If the second argument is - then write stdin to a tempfile and open the
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
-if [[ $# -ge 2 ]] && [[ "$2" == - ]]; then
+if [ "$#" -ge "2" -a "$2" = "-" ]
+then
tempfile="$(mktemp emacs-stdin-$USER.XXXXXXX --tmpdir)"
cat - > "$tempfile"
_emacsfun --no-wait $tempfile