Skip to content

Commit

Permalink
tweak(core): add new env vars to disable user config
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Jun 3, 2023
1 parent 3cd0eac commit 4e229dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
7 changes: 4 additions & 3 deletions early-init.el
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@

;; Load the user early configuration file from "$MINEMACSDIR/early-config.el"
;; if it exists.
(let ((early-config-path (concat minemacs-config-dir "early-config.el")))
(when (file-exists-p early-config-path)
(load early-config-path nil (not minemacs-verbose))))
(unless (or (getenv "MINEMACS_IGNORE_USER_CONFIG") (getenv "MINEMACS_EARLY_CONFIG_EL"))
(let ((early-config-path (concat minemacs-config-dir "early-config.el")))
(when (file-exists-p early-config-path)
(load early-config-path nil (not minemacs-verbose)))))

;;; early-init.el ends here
23 changes: 13 additions & 10 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,10 @@
(+load minemacs-loaddefs-file)

;; Load user init tweaks from "$MINEMACSDIR/init-tweaks.el" when available
(let ((user-init-tweaks (concat minemacs-config-dir "init-tweaks.el")))
(when (file-exists-p user-init-tweaks)
(+load user-init-tweaks)))
(unless (or (getenv "MINEMACS_IGNORE_USER_CONFIG") (getenv "MINEMACS_IGNORE_INIT_TWEAKS_EL"))
(let ((user-init-tweaks (concat minemacs-config-dir "init-tweaks.el")))
(when (file-exists-p user-init-tweaks)
(+load user-init-tweaks))))

;; HACK: When Emacs is launched from the terminal (in GNU/Linux), it inherits
;; the terminal's environment variables, which can be useful specially for
Expand Down Expand Up @@ -198,10 +199,11 @@
;; Load the default list of enabled modules (`minemacs-modules' and `minemacs-core-modules')
(+load minemacs-core-dir "me-modules.el")

;; The modules.el file can override minemacs-modules and minemacs-core-modules
(let ((user-conf-modules (concat minemacs-config-dir "modules.el")))
(when (file-exists-p user-conf-modules)
(+load user-conf-modules))))
(unless (or (getenv "MINEMACS_IGNORE_USER_CONFIG") (getenv "MINEMACS_IGNORE_MODULES_EL"))
;; The modules.el file can override minemacs-modules and minemacs-core-modules
(let ((user-conf-modules (concat minemacs-config-dir "modules.el")))
(when (file-exists-p user-conf-modules)
(+load user-conf-modules)))))

;; Load fonts early (they are read from the default `minemacs-default-fonts').
(+set-fonts)
Expand Down Expand Up @@ -245,9 +247,10 @@
(+load custom-file))

;; Load user configuration from "$MINEMACSDIR/config.el" when available
(let ((user-config (concat minemacs-config-dir "config.el")))
(when (file-exists-p user-config)
(+load user-config)))
(unless (or (getenv "MINEMACS_IGNORE_USER_CONFIG") (getenv "MINEMACS_IGNORE_CONFIG_EL"))
(let ((user-config (concat minemacs-config-dir "config.el")))
(when (file-exists-p user-config)
(+load user-config))))

(+lazy-when! (featurep 'native-compile)
(+info! "Trying to clean outdated native compile cache")
Expand Down

0 comments on commit 4e229dd

Please sign in to comment.