refactor(cli): better error for missing profiles.el
Only appears if a profile was requested and no profile file was found.
This commit is contained in:
parent
068966a4cd
commit
491f49cfe5
1 changed files with 15 additions and 9 deletions
|
@ -47,16 +47,22 @@
|
||||||
(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)
|
||||||
(profile-file (expand-file-name "profiles.el" user-emacs-directory)))
|
(profiles-file (expand-file-name "profiles.el" user-emacs-directory)))
|
||||||
(insert-file-contents profile-file)
|
|
||||||
(condition-case e
|
(condition-case e
|
||||||
(dolist (var (or (cdr (assq (intern profile) (read (current-buffer))))
|
(progn
|
||||||
(progn (message "No %S profile found" profile)
|
(insert-file-contents profiles-file)
|
||||||
(kill-emacs 3))))
|
(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)
|
||||||
(end-of-file (signal 'end-of-file (list profile-file)))
|
(dolist (env (cdr var)) (setenv (car env) (cdr env)))
|
||||||
|
(set (car var) (cdr var)))))
|
||||||
|
(file-missing
|
||||||
|
(message "No $EMACSDIR/%s file to look up %S in."
|
||||||
|
(file-name-nondirectory profiles-file)
|
||||||
|
profile)
|
||||||
|
(kill-emacs 3))
|
||||||
|
(end-of-file (signal 'end-of-file (list profiles-file)))
|
||||||
(error (error "Parser error in profiles.el: %s" (error-message-string e))))))))
|
(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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue