Skip to content

Commit

Permalink
Fix issue with dash as the default /bin/sh script executing progr…
Browse files Browse the repository at this point in the history
…am. (ohmyzsh#5177)

* `function` keyword removed
 * Fixup the `if` statement and operators
  • Loading branch information
hjpotter92 authored and mcornella committed Jun 20, 2016
1 parent d012402 commit 909fcef
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions plugins/emacs/emacsclient.sh
Original file line number Diff line number Diff line change
@@ -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`
Expand All @@ -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
Expand Down

0 comments on commit 909fcef

Please sign in to comment.