summaryrefslogtreecommitdiff
path: root/emacs-helm.sh
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2017-05-05 18:28:31 +0200
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2017-05-05 18:28:31 +0200
commit9b20a8009a2832da388f8c1ee9b27be899f92db6 (patch)
treea49d48a8dce61dc51d286154bcf57eb4dfdc8579 /emacs-helm.sh
parent5f2c1b596167795fbfbb7fe9952e56922379563a (diff)
Improve emacs-helm.sh.
Diffstat (limited to 'emacs-helm.sh')
-rwxr-xr-xemacs-helm.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/emacs-helm.sh b/emacs-helm.sh
index 8fe40e5a..8ffe4b5d 100755
--- a/emacs-helm.sh
+++ b/emacs-helm.sh
@@ -23,7 +23,7 @@
# Run it from this directory or symlink it somewhere in your PATH.
# If TEMP env var exists use it otherwise declare it.
-[ -z $TEMP ] && declare TEMP="/tmp"
+test -z "$TEMP" && declare TEMP="/tmp"
CONF_FILE="$TEMP/helm-cfg.el"
EMACS=emacs
@@ -42,14 +42,14 @@ esac
LOAD_PATH=$($EMACS -q -batch --eval "(prin1 load-path)")
-cd $(dirname "$0")
+cd "$(dirname "$0")" || exit 2
# Check if autoload file exists.
# It is maybe in a different directory if
# emacs-helm.sh is a symlink.
-LS=$(ls -l $0 | awk '{print $11}')
-if [ ! -z $LS ]; then
- AUTO_FILE="$(dirname $LS)/helm-autoloads.el"
+TRUENAME=$(find . -samefile "$0" -printf "%l")
+if [ ! -z "$TRUENAME" ]; then
+ AUTO_FILE="$(dirname "$TRUENAME")/helm-autoloads.el"
else
AUTO_FILE="helm-autoloads.el"
fi
@@ -105,5 +105,5 @@ cat > $CONF_FILE <<EOF
(add-hook 'kill-emacs-hook #'(lambda () (and (file-exists-p "$CONF_FILE") (delete-file "$CONF_FILE"))))
EOF
-$EMACS -Q -l $CONF_FILE $@
+$EMACS -Q -l $CONF_FILE "$@"