Skip to content

Commit 044ce93

Browse files
committed
code: Accept Eask file from global scope
1 parent 840954b commit 044ce93

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

lisp/_prepare.el

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ Eask file in the workspace."
196196

197197
(defvar eask-file nil "The Eask file path.")
198198

199+
(defun eask-file-load (location &optional noerror)
200+
"Load Eask file in the LOCATION."
201+
(setq eask-file (expand-file-name location user-emacs-directory))
202+
(eask--alias-env (load eask-file noerror)))
203+
199204
(defmacro eask-start (&rest body)
200205
"Execute BODY with workspace setup."
201206
(declare (indent 0) (debug t))
@@ -204,22 +209,25 @@ Eask file in the workspace."
204209
(cond
205210
(eask--initialized-p ,@body)
206211
((eask-global-p)
207-
(eask-pkg-init)
208-
(load (locate-user-emacs-file "early-init.el") t)
209-
(load (locate-user-emacs-file "../.emacs") t)
210-
(load (locate-user-emacs-file "init.el") t)
211-
,@body)
212+
(let ((eask--initialized-p t))
213+
(eask-pkg-init)
214+
(load (locate-user-emacs-file "early-init.el") t)
215+
(load (locate-user-emacs-file "../.emacs") t)
216+
(load (locate-user-emacs-file "init.el") t)
217+
;; We accept Eask file in global scope, but it shouldn't be used
218+
;; as a sandbox.
219+
(eask-file-load "./Eask" t)
220+
,@body))
212221
(t
213222
(let* ((eask--initialized-p t)
214223
(user-emacs-directory (expand-file-name (concat ".eask/" emacs-version "/")))
215224
(package-user-dir (expand-file-name "elpa" user-emacs-directory))
216225
(eask--first-init-p (not (file-directory-p user-emacs-directory)))
217226
(user-init-file (locate-user-emacs-file "init.el"))
218227
(custom-file (locate-user-emacs-file "custom.el")))
219-
(setq eask-file (expand-file-name "../../Eask" user-emacs-directory))
220228
(eask--handle-global-options)
229+
(eask-file-load "../../Eask")
221230
(ignore-errors (make-directory package-user-dir t))
222-
(eask--alias-env (load-file eask-file))
223231
(run-hooks 'eask-before-command-hook)
224232
(run-hooks (intern (concat "eask-before-command-" (eask-command) "-hook")))
225233
,@body

0 commit comments

Comments
 (0)