fix(profiles): unexpanded paths in implicit profiles

Fixes two issues with implicit profiles:

1. Where user-emacs-directory (and sometimes doom-user-dir) would be
   unexpanded in the profile init file (generated by 'doom profiles
   sync'), which would be ineffective at runtime.
2. Where an implicit profile with a .doomprofile that lacks a
   user-emacs-directory setting would not have any user-emacs-directory
   set for it at all. Instead, it should fall back to that profile's
   location.
This commit is contained in:
Henrik Lissner 2022-09-17 13:01:28 +02:00
parent fd61150f60
commit 329d65d0d4
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -80,16 +80,20 @@ run.")
(dolist (path (flatten-list paths))
(cond
((file-directory-p path)
(dolist (subdir (doom-files-in (file-truename path) :depth 0 :match "/[^.][^/]+$" :type 'dirs :map #'file-name-base))
(setq path (file-truename path))
(dolist (subdir (doom-files-in path :depth 0 :match "/[^.][^/]+$" :type 'dirs :map #'file-name-base))
(unless (string-prefix-p "_" subdir)
(cl-pushnew
(cons (intern subdir)
(if-let (profile-file (file-exists-p! doom-profiles-config-file-name path))
(car (doom-file-read profile-file :by 'read*))
(let ((subdir (file-name-as-directory (abbreviate-file-name subdir))))
`((user-emacs-directory . ,subdir)
,@(when (file-exists-p! "lisp/doom.el" subdir)
'(doom-user-dir . ,subdir))))))
(let* ((val (abbreviate-file-name (file-name-as-directory subdir)))
(val (if (file-name-absolute-p val)
`(,val)
`(,(abbreviate-file-name path) ,val))))
(cons `(user-emacs-directory :path ,@val)
(if-let (profile-file (file-exists-p! doom-profiles-config-file-name path))
(car (doom-file-read profile-file :by 'read*))
(when (file-exists-p (doom-path path subdir "lisp/doom.el"))
'((doom-user-dir :path ,@val)))))))
profiles
:test #'eq
:key #'car))))