aboutsummaryrefslogtreecommitdiff
path: root/modules/games-config.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-21 01:57:44 -0400
committerCraig Jennings <c@cjennings.net>2026-06-21 01:57:44 -0400
commitcfcb7cf0658a7d6b368e26e07d5ad5861af4ebf0 (patch)
tree5f9d27eacd1cbf0c9dff8e3e6511f2bf4a0abeb8 /modules/games-config.el
parent12f0dab39876351a0251e128b42ff683c2f50d9b (diff)
downloaddotemacs-cfcb7cf0658a7d6b368e26e07d5ad5861af4ebf0.tar.gz
dotemacs-cfcb7cf0658a7d6b368e26e07d5ad5861af4ebf0.zip
refactor: defer games-config behind autoloads (load-graph Phase 4)
init.el eagerly required games-config at startup just to configure two on-demand game packages. package.el already autoloads malyon and 2048-game, so the eager require bought nothing but the one setting the module adds (malyon-stories-directory). init.el now autoloads malyon and 2048-game to games-config instead of requiring it. The first game command loads the module, which configures then loads the package. Startup no longer touches games-config, and both the commands and the stories-directory setting still work. This is the first module of the Phase 4 low-risk batch.
Diffstat (limited to 'modules/games-config.el')
-rw-r--r--modules/games-config.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/modules/games-config.el b/modules/games-config.el
index 9aa598168..1e5ba5b87 100644
--- a/modules/games-config.el
+++ b/modules/games-config.el
@@ -5,9 +5,9 @@
;;
;; Layer: 4 (Optional).
;; Category: O.
-;; Load shape: eager.
-;; Eager reason: none; optional games, a command-loaded deferral candidate.
-;; Top-level side effects: package configuration via use-package.
+;; Load shape: command (deferred).
+;; Eager reason: none; loaded on first use of `malyon' or `2048-game'.
+;; Top-level side effects: package configuration via use-package (deferred).
;; Runtime requires: none.
;; Direct test load: yes.
;;
@@ -17,20 +17,26 @@
;; (stories directory: ~/sync/org/text.games/)
;; - 2048 number-tile puzzle game
;;
+;; init.el autoloads `malyon' and `2048-game' to this module instead of
+;; requiring it eagerly, so the first invocation of either command loads
+;; games-config, which configures and then loads the package.
+;;
;;; Code:
;; ----------------------------------- Malyon ----------------------------------
;; text based adventure player
(use-package malyon
- :defer 1
+ :defer t
+ :commands (malyon)
:config
(setq malyon-stories-directory (concat org-dir "text.games/")))
;; ------------------------------------ 2048 -----------------------------------
;; combine numbered tiles to create the elusive number 2048.
(use-package 2048-game
- :defer 1)
+ :defer t
+ :commands (2048-game))
(provide 'games-config)
;;; games-config.el ends here.