fix(cli): site file loader
I had missed the fact that -Q implies not only --no-site-file (intended), but --no-site-lisp (unintended). Without the latter, no site-lisp directory is left in load-path, and any attempt to load it after-the-fact (which I do in core-cli.el) will fail. Thanks to @yamanq for noticing this! Fix: #6473 Fix: #4198 Co-authored-by: Yaman Qalieh <yamanq@users.noreply.github.com>
This commit is contained in:
parent
681d40ab58
commit
3b3c008b1b
2 changed files with 9 additions and 7 deletions
5
bin/doom
5
bin/doom
|
@ -1,14 +1,15 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
:; set -e # -*- mode: emacs-lisp; lexical-binding: t -*-
|
:; set -e # -*- mode: emacs-lisp; lexical-binding: t -*-
|
||||||
:; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac
|
:; case "$EMACS" in *term*) EMACS=emacs ;; *) EMACS="${EMACS:-emacs}" ;; esac
|
||||||
:; tmpdir=`$EMACS -Q --batch --eval '(princ (temporary-file-directory))' 2>/dev/null`
|
:; emacs="$EMACS -q --no-site-file --no-x-resources --no-splash --batch"
|
||||||
|
:; tmpdir=`$emacs --eval '(princ (temporary-file-directory))' 2>/dev/null`
|
||||||
:; [ -z "$tmpdir" ] && { >&2 echo "Error: failed to run Emacs with command '$EMACS'"; >&2 echo; >&2 echo "Are you sure Emacs is installed and in your \$PATH?"; exit 1; }
|
:; [ -z "$tmpdir" ] && { >&2 echo "Error: failed to run Emacs with command '$EMACS'"; >&2 echo; >&2 echo "Are you sure Emacs is installed and in your \$PATH?"; exit 1; }
|
||||||
:; export __DOOMPID="${__DOOMPID:-$$}"
|
:; export __DOOMPID="${__DOOMPID:-$$}"
|
||||||
:; export __DOOMSTEP="$((__DOOMSTEP+1))"
|
:; export __DOOMSTEP="$((__DOOMSTEP+1))"
|
||||||
:; export __DOOMGEOM="${__DOOMGEOM:-`tput cols 2>/dev/null`x`tput lines 2>/dev/null`}"
|
:; export __DOOMGEOM="${__DOOMGEOM:-`tput cols 2>/dev/null`x`tput lines 2>/dev/null`}"
|
||||||
:; export __DOOMGPIPE=${__DOOMGPIPE:-$__DOOMPIPE}
|
:; export __DOOMGPIPE=${__DOOMGPIPE:-$__DOOMPIPE}
|
||||||
:; export __DOOMPIPE=; [ -t 0 ] || __DOOMPIPE+=0; [ -t 1 ] || __DOOMPIPE+=1
|
:; export __DOOMPIPE=; [ -t 0 ] || __DOOMPIPE+=0; [ -t 1 ] || __DOOMPIPE+=1
|
||||||
:; $EMACS -Q --batch --load "$0" -- "$@" || exit=$?
|
:; $emacs --load "$0" -- "$@" || exit=$?
|
||||||
:; [ "${exit:-0}" -eq 254 ] && { sh "${tmpdir}/doom.${__DOOMPID}.${__DOOMSTEP}.sh" "$0" "$@" && true; exit="$?"; }
|
:; [ "${exit:-0}" -eq 254 ] && { sh "${tmpdir}/doom.${__DOOMPID}.${__DOOMSTEP}.sh" "$0" "$@" && true; exit="$?"; }
|
||||||
:; exit $exit
|
:; exit $exit
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,9 @@ case "$EMACS" in
|
||||||
*) EMACS="${EMACS:-emacs}" ;;
|
*) EMACS="${EMACS:-emacs}" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
TMPDIR="${TMPDIR:-$($EMACS -Q --batch --eval '(princ (temporary-file-directory))' 2>/dev/null)}"
|
emacs="$EMACS -q --no-site-file --no-x-resources --no-splash --batch"
|
||||||
|
|
||||||
|
TMPDIR="${TMPDIR:-$($emacs --eval '(princ (temporary-file-directory))' 2>/dev/null)}"
|
||||||
if [ -z "$TMPDIR" ]; then
|
if [ -z "$TMPDIR" ]; then
|
||||||
>&2 echo "Error: failed to run Emacs with command '$EMACS'"
|
>&2 echo "Error: failed to run Emacs with command '$EMACS'"
|
||||||
>&2 echo
|
>&2 echo
|
||||||
|
@ -41,10 +43,9 @@ tmpfile="$TMPDIR/doomscript.${__DOOMPID}"
|
||||||
|
|
||||||
target="$1"
|
target="$1"
|
||||||
shift
|
shift
|
||||||
$EMACS -Q --batch \
|
$emacs --load "$EMACSDIR/core/core-cli" \
|
||||||
--load "$EMACSDIR/core/core-cli" \
|
--load "$target" \
|
||||||
--load "$target" \
|
-- "$@" || exit=$?
|
||||||
-- "$@" || exit=$?
|
|
||||||
# Execute exit-script, if requested (to simulate execve)
|
# Execute exit-script, if requested (to simulate execve)
|
||||||
if [ "${exit:-0}" -eq 254 ]; then
|
if [ "${exit:-0}" -eq 254 ]; then
|
||||||
sh "${tmpdir}/doom.${__DOOMPID}.${__DOOMSTEP}.sh" "$0" "$@" && true
|
sh "${tmpdir}/doom.${__DOOMPID}.${__DOOMSTEP}.sh" "$0" "$@" && true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue