bin/doom: allow script to be symlinked #3746

This commit is contained in:
Henrik Lissner 2020-08-24 23:18:28 -04:00
parent 5c6189fb4e
commit 4fa0241134
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -2,7 +2,6 @@
:; set -e # -*- mode: emacs-lisp; lexical-binding: t -*-
:; ( echo "$EMACS" | grep -q "term" ) && EMACS=emacs || EMACS=${EMACS:-emacs}
:; command -v "$EMACS" >/dev/null || { >&2 echo "Can't find emacs in your PATH"; exit 1; }
:; export EMACSDIR="${EMACSDIR:-`dirname "$0"`/..}"
:; export __DOOMPOST="${TMPDIR:-/tmp}/doom.sh"
:; __DOOMCODE=0
:; "$EMACS" --no-site-file --script "$0" -- "$@" || __DOOMCODE=$?
@ -22,8 +21,10 @@
;; presumably installed. EMACSDIR is set in the shell script preamble earlier in
;; this file.
(setq user-emacs-directory
(file-name-as-directory ; ensure the trailing slash...
(expand-file-name (or (getenv "EMACSDIR") ""))))
(if (getenv "EMACSDIR")
(file-name-as-directory (expand-file-name (getenv "EMACSDIR")))
(expand-file-name
"../" (file-name-directory (file-truename load-file-name)))))
;; Handle some potential issues early
(when (version< emacs-version "26.1")