Skip to content

Commit

Permalink
feat(use-package): add an option to always demand packages
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Oct 30, 2023
1 parent ca2bad4 commit 49cdf0d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ You can customize MinEmacs' behavior via some environment variables.
- `MINEMACS_ALPHA`: Set frame `background-alpha` to percentage (value from 0 to
100).
- `MINEMACS_NOT_LAZY`: Load lazy packages immediately after loading Emacs.
- `MINEMACS_ALWAYS_DEMAND`: Load all packages immediately (this works by setting
`use-package-always-demand` to `t` and `use-package-always-defer` to `nil`.
- `MINEMACS_IGNORE_VERSION_CHECK`: Do not perform version check in `init.el`,
this can be useful if you use `~/.minemacs.d/init-tweaks.el` to implement the
functionalities used by MinEmacs and missing from your Emacs version.
Expand Down
3 changes: 2 additions & 1 deletion core/me-bootstrap.el
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
;; Set `use-package' to verbose when MinEmacs is started in verbose mode
use-package-verbose (cond (minemacs-debug 'debug) (minemacs-verbose t))
;; Defer loading packages by default, use `:demand' to force loading a package
use-package-always-defer t
use-package-always-defer (not minemacs-always-demand)
use-package-always-demand minemacs-always-demand
;; Make the expanded code as minimal as possible, do not try to catch errors
use-package-expand-minimally (not minemacs-debug))

Expand Down
6 changes: 5 additions & 1 deletion core/me-vars.el
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ This list is automatically constructed from the environment variables
(and (or (getenv "MINEMACS_VERBOSE") minemacs-debug) t)
"MinEmacs is started in verbose mode.")

(defconst minemacs-always-demand
(and (getenv "MINEMACS_ALWAYS_DEMAND") t)
"Load all packages immediately, do not defer any package.")

(defconst minemacs-not-lazy
(or (daemonp) (and (getenv "MINEMACS_NOT_LAZY") t))
(or minemacs-always-demand (daemonp) (and (getenv "MINEMACS_NOT_LAZY") t))
"Load lazy packages (minemacs-lazy-hook) immediately.")

(defcustom minemacs-msg-level
Expand Down

0 comments on commit 49cdf0d

Please sign in to comment.