bin/doom: refactor shebang preamble

Indirectly fixes folks' ability to set EMACS to more complex
commands (like 'flatpak run org.gnu.emacs').
This commit is contained in:
Henrik Lissner 2020-08-25 03:36:35 -04:00
parent a986621a5f
commit 93ac32d082
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -1,11 +1,10 @@
#!/usr/bin/env sh #!/usr/bin/env sh
:; set -e # -*- mode: emacs-lisp; lexical-binding: t -*- :; set -e # -*- mode: emacs-lisp; lexical-binding: t -*-
:; ( echo "$EMACS" | grep -q "term" ) && EMACS=emacs || EMACS=${EMACS:-emacs} :; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac
:; command -v "$EMACS" >/dev/null || { >&2 echo "Can't find emacs in your PATH"; exit 1; }
:; export __DOOMPOST="${TMPDIR:-/tmp}/doom.sh" :; export __DOOMPOST="${TMPDIR:-/tmp}/doom.sh"
:; __DOOMCODE=0 :; $EMACS --version >/dev/null 2>&1 || { >&2 echo "Can't find emacs in your PATH"; exit 1; }
:; "$EMACS" --no-site-file --script "$0" -- "$@" || __DOOMCODE=$? :; $EMACS --no-site-file --script "$0" -- "$@"; __DOOMCODE=$?
:; [ $__DOOMCODE -eq 128 ] && { "$__DOOMPOST" "$0" "$@"; __DOOMCODE=$?; } :; [ "$__DOOMCODE" -eq 128 ] && { "$__DOOMPOST" "$0" "$@"; __DOOMCODE=$?; }
:; exit $__DOOMCODE :; exit $__DOOMCODE
;; The garbage collector isn't important during CLI ops. A higher threshold ;; The garbage collector isn't important during CLI ops. A higher threshold