From d21ea569995c4a082c3abd2657e26cd6a20a7b3c Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 16 Aug 2022 17:21:05 +0100 Subject: [PATCH 1/2] Nix integration --- early-init.el | 54 +-------------------------------------------------- lisp/doom.el | 4 ++-- 2 files changed, 3 insertions(+), 55 deletions(-) diff --git a/early-init.el b/early-init.el index 4335f8db1..78d2817c1 100644 --- a/early-init.el +++ b/early-init.el @@ -74,59 +74,7 @@ ;;; Detect `user-emacs-directory' ;; Prevent recursive profile processing, in case you're loading a Doom profile. -(unless (boundp 'doom-version) - ;; Not using `command-switch-alist' to process --profile and --init-directory - ;; was intentional. `command-switch-alist' is processed too late at startup to - ;; change `user-emacs-directory' in time. - - ;; DEPRECATED Backported from 29. Remove this when 27/28 support is removed. - (let ((initdir (or (cadr (member "--init-directory" command-line-args)) - (getenv-internal "EMACSDIR")))) - (when initdir - ;; Discard the switch to prevent "invalid option" errors later. - (add-to-list 'command-switch-alist (cons "--init-directory" (lambda (_) (pop argv)))) - (setq user-emacs-directory initdir))) - - (let ((profile (or (cadr (member "--profile" command-line-args)) - (getenv-internal "DOOMPROFILE")))) - (when profile - ;; Discard the switch to prevent "invalid option" errors later. - (add-to-list 'command-switch-alist (cons "--profile" (lambda (_) (pop argv)))) - ;; While processing the requested profile, Doom loosely expects - ;; `user-emacs-directory' to be changed. If it doesn't, then you're using - ;; profiles.el as a glorified, runtime dir-locals.el (which is fine, if - ;; intended). - (catch 'found - (let ((profiles-file (expand-file-name "profiles.el" user-emacs-directory))) - (when (file-exists-p profiles-file) - (with-temp-buffer - (let ((coding-system-for-read 'utf-8-auto)) - (insert-file-contents profiles-file)) - (condition-case-unless-debug e - (let ((profile-data (cdr (assq (intern profile) (read (current-buffer)))))) - (dolist (var profile-data (if profile-data (throw 'found t))) - (if (eq (car var) 'env) - (dolist (env (cdr var)) (setenv (car env) (cdr env))) - (set (car var) (cdr var))))) - (error (error "Failed to parse profiles.el: %s" (error-message-string e)))))) - ;; If the requested profile isn't in profiles.el, then see if - ;; $EMACSDIR/profiles/$DOOMPROFILE exists. These are implicit - ;; profiles, where `emacs --profile foo` will be equivalent to `emacs - ;; --init-directory $EMACSDIR/profile/foo', if that directory exists. - (let ((profile-dir - (expand-file-name - profile (or (getenv-internal "DOOMPROFILESDIR") - (expand-file-name "profiles/" user-emacs-directory))))) - (when (file-directory-p profile-dir) - (setq user-emacs-directory profile-dir) - (throw 'found t))) - - (user-error "No %S profile found" profile))) - - (when init-file-debug - (message "Selected profile: %s" profile)) - ;; Ensure the selected profile persists through the session - (setenv "DOOMPROFILE" profile)))) +(setq user-emacs-directory (file-name-directory load-file-name)) ;; diff --git a/lisp/doom.el b/lisp/doom.el index 6dbbefb5e..0566e6743 100644 --- a/lisp/doom.el +++ b/lisp/doom.el @@ -232,7 +232,7 @@ These files should not be shared across systems. By default, it is used by (defconst doom-data-dir (if doom-profile doom-profile-data-dir - (concat doom-local-dir "etc/")) + "~/.local/share/doom/") "Directory for non-volatile local storage. Use this for files that don't change much, like server binaries, external @@ -241,7 +241,7 @@ dependencies or long-term shared data. Must end with a slash.") (defconst doom-cache-dir (if doom-profile doom-profile-cache-dir - (concat doom-local-dir "cache/")) + "~/.cache/doom/") "Directory for volatile local storage. Use this for files that change often, like cache files. Must end with a slash.") -- 2.37.1