fix(cli): improve end-of-file error in profiles file
Otherwise, the error message complains that the error originates from core-cli.el.
This commit is contained in:
parent
12b52909e3
commit
7eeec53c30
1 changed files with 12 additions and 9 deletions
|
@ -46,15 +46,18 @@
|
||||||
(let ((profile (getenv "DOOMPROFILE")))
|
(let ((profile (getenv "DOOMPROFILE")))
|
||||||
(when profile
|
(when profile
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(let ((coding-system-for-read 'utf-8-auto))
|
(let ((coding-system-for-read 'utf-8-auto)
|
||||||
(insert-file-contents (expand-file-name "profiles.el" user-emacs-directory)))
|
(profile-file (expand-file-name "profiles.el" user-emacs-directory)))
|
||||||
(condition-case e
|
(insert-file-contents profile-file)
|
||||||
(dolist (var (or (cdr (assq (intern profile) (read (current-buffer))))
|
(condition-case e
|
||||||
(user-error "No %S profile found" profile)))
|
(dolist (var (or (cdr (assq (intern profile) (read (current-buffer))))
|
||||||
(if (eq (car var) 'env)
|
(progn (message "No %S profile found" profile)
|
||||||
(dolist (env (cdr var)) (setenv (car env) (cdr env)))
|
(kill-emacs 3))))
|
||||||
(set (car var) (cdr var))))
|
(if (eq (car var) 'env)
|
||||||
(error (error "Failed to parse profiles.el: %s" (error-message-string e)))))))
|
(dolist (env (cdr var)) (setenv (car env) (cdr env)))
|
||||||
|
(set (car var) (cdr var))))
|
||||||
|
(end-of-file (signal 'end-of-file (list profile-file)))
|
||||||
|
(error (error "Parser error in profiles.el: %s" (error-message-string e))))))))
|
||||||
|
|
||||||
;; HACK Load `cl' and site files manually to prevent polluting logs and stdout
|
;; HACK Load `cl' and site files manually to prevent polluting logs and stdout
|
||||||
;; with deprecation and/or file load messages.
|
;; with deprecation and/or file load messages.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue