Skip to content

Commit e0732f2

Browse files
committed
feat: Respect global/system-wide packages
1 parent 524c02d commit e0732f2

File tree

2 files changed

+32
-13
lines changed

2 files changed

+32
-13
lines changed

lisp/_prepare.el

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,20 @@ Arguments FNC and ARGS are used for advice `:around'."
8383
"Return non-nil if terminal supports colors.")
8484

8585
(defconst eask-homedir (getenv "EASK_HOMEDIR")
86-
"Eask's home directory path.")
86+
"Eask's home directory path.
87+
88+
It points to the global home directory `/path/to/home/.eask/'.")
89+
90+
(defconst eask-userdir (expand-file-name "../" eask-homedir)
91+
"Eask's user directory path.
92+
93+
It points to the global user directory `/path/to/home/'.")
94+
95+
(defconst eask-package-sys-dir (expand-file-name (concat emacs-version "/elpa/")
96+
eask-homedir)
97+
"Eask global elpa directory; it will be treated as the system-wide packages.
98+
99+
It points to the global elpa directory `/path/to/home/.eask/XX.X/elpa/'")
87100

88101
(defconst eask-invocation (getenv "EASK_INVOCATION")
89102
"Eask's invocation program path.")
@@ -679,6 +692,7 @@ Argument BODY are forms for execution."
679692
(declare (indent 1) (debug t))
680693
`(let ((package-archives package-archives)
681694
(archives (eask-listify ,archives))
695+
(package-user-dir eask-package-sys-dir) ; Point to the global directory.
682696
(added))
683697
(dolist (archive archives)
684698
(unless (assoc archive package-archives)
@@ -1246,12 +1260,15 @@ This uses function `locate-dominating-file' to look up directory tree."
12461260
(defmacro eask--setup-home (dir &rest body)
12471261
"Set up config directory in DIR, then execute BODY."
12481262
(declare (indent 1) (debug t))
1249-
`(let* ((user-emacs-directory (expand-file-name (concat ".eask/" emacs-version "/") ,dir))
1250-
(package-user-dir (expand-file-name "elpa" user-emacs-directory))
1251-
(early-init-file (locate-user-emacs-file "early-init.el"))
1252-
(eask-dot-emacs-file (locate-user-emacs-file ".emacs"))
1253-
(user-init-file (locate-user-emacs-file "init.el"))
1254-
(custom-file (locate-user-emacs-file "custom.el")))
1263+
`(let* ((user-emacs-directory (expand-file-name (concat ".eask/" emacs-version "/") ,dir))
1264+
(package-user-dir (expand-file-name "elpa/" user-emacs-directory))
1265+
;; Add global scope elpa directory.
1266+
(package-directory-list (append package-directory-list
1267+
(list eask-package-sys-dir)))
1268+
(early-init-file (locate-user-emacs-file "early-init.el"))
1269+
(eask-dot-emacs-file (locate-user-emacs-file ".emacs"))
1270+
(user-init-file (locate-user-emacs-file "init.el"))
1271+
(custom-file (locate-user-emacs-file "custom.el")))
12551272
,@body))
12561273

12571274
;; NOTE: If you modified this function, make sure you modified `core/emacs.el'
@@ -1295,7 +1312,7 @@ This uses function `locate-dominating-file' to look up directory tree."
12951312
(eask--load-config)
12961313
(eask--with-hooks ,@body)))
12971314
((eask-global-p)
1298-
(eask--setup-home (concat eask-homedir "../") ; `/home/user/', escape `.eask'
1315+
(eask--setup-home eask-userdir
12991316
(let ((eask--first-init-p (not (file-directory-p user-emacs-directory))))
13001317
;; We accept Eask-file in `global' scope, but it shouldn't be used
13011318
;; for the sandbox.
@@ -1314,7 +1331,7 @@ This uses function `locate-dominating-file' to look up directory tree."
13141331
(eask-file-try-load default-directory)
13151332
;; Then setup the user directory according to the Eask-file!
13161333
(eask--setup-home (or eask-file-root
1317-
(concat eask-homedir "../"))
1334+
eask-userdir)
13181335
(let ((eask--first-init-p (not (file-directory-p user-emacs-directory)))
13191336
(scope (if eask-file-root "" "global ")))
13201337
(eask-with-verbosity 'debug

lisp/core/status.el

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262

6363
(defun eask-status--print-infos (lst)
6464
"Print environment info LST."
65-
(let* ((len-0 (eask-2str (eask-status--list-max-length lst 0)))
65+
(let* ((len-0 (eask-2str (eask-status--list-max-length lst 0))) ; unused
6666
(len-1 (eask-2str (+ (eask-status--list-max-length lst 1) 2)))
67-
(fmt (concat " %-21s %-" len-1 "s %s")))
67+
(fmt (concat " %-24s %-" len-1 "s %s")))
6868
(dolist (pair lst)
6969
(when pair
7070
(eask-status--print-info fmt pair)
@@ -96,6 +96,8 @@
9696
,(eask-status--file-dir user-emacs-directory))
9797
("ELPA directory" ,(expand-file-name package-user-dir)
9898
,(eask-status--file-dir package-user-dir))
99+
("ELPA directory (system)" ,eask-package-sys-dir
100+
,(eask-status--file-dir eask-package-sys-dir))
99101
("early-init.el" ,(expand-file-name early-init-file)
100102
,(eask-status--file-dir early-init-file))
101103
(".emacs" ,(expand-file-name eask-dot-emacs-file)
@@ -106,10 +108,10 @@
106108
"nil")
107109
,(when custom-file (eask-status--file-dir custom-file)))))
108110

109-
(eask-status--print-title "Eask-file:")
111+
(eask-status--print-title "Eask:")
110112
(eask-status--print-infos
111113
`(("Eask file" ,(or eask-file "missing"))
112-
("Eask-file Count" ,(length (eask--find-files default-directory)))))
114+
("Eask file Count" ,(length (eask--find-files default-directory)))))
113115

114116
(eask-info "(Total of %s states listed)" eask-status--info-count))
115117

0 commit comments

Comments
 (0)