fix(cli): avoid misinterpreted switches in argv
If early-init.el is loaded by another doomscript that uses --init-directory or --profile for its own purposes, then they could unintentionally alter user-emacs-directory. Lets only respect the envvars in noninteractive sessions.
This commit is contained in:
parent
87f85ab459
commit
55c27a0ae9
1 changed files with 8 additions and 6 deletions
|
@ -51,11 +51,13 @@
|
||||||
;; notable saving in startup time. This let-binding is just a stopgap though,
|
;; notable saving in startup time. This let-binding is just a stopgap though,
|
||||||
;; a more complete version of this optimization can be found in lisp/doom.el.
|
;; a more complete version of this optimization can be found in lisp/doom.el.
|
||||||
(let (file-name-handler-alist)
|
(let (file-name-handler-alist)
|
||||||
;; First, we process --init-directory and --profile to detect what
|
(let* (;; FIX: Unset `command-line-args' in noninteractive sessions, to
|
||||||
;; `user-emacs-directory' to load from. I avoid using `command-switch-alist'
|
;; ensure upstream switches aren't misinterpreted.
|
||||||
;; to process --profile and --init-directory because it is processed too late
|
(command-line-args (unless noninteractive command-line-args))
|
||||||
;; to change `user-emacs-directory' in time.
|
;; I avoid using `command-switch-alist' to process --profile (and
|
||||||
(let ((profile (or (cadr (member "--profile" command-line-args))
|
;; --init-directory) because it is processed too late to change
|
||||||
|
;; `user-emacs-directory' in time.
|
||||||
|
(profile (or (cadr (member "--profile" command-line-args))
|
||||||
(getenv-internal "DOOMPROFILE"))))
|
(getenv-internal "DOOMPROFILE"))))
|
||||||
(if (null profile)
|
(if (null profile)
|
||||||
;; REVIEW: Backported from Emacs 29. Remove when 28 support is dropped.
|
;; REVIEW: Backported from Emacs 29. Remove when 28 support is dropped.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue