refactor: use doom-module-*-file variables; add two

- Adds doom-module-packages-file and doom-module-metadata-file.
- Uses them and the other doom-module-*-file variables where they were
  previously hardcoded.
- Add .el extension to doom-module-{init,config}-file; it is now the
  consumer's responsibility to strip/change/keep the extension as they
  see fit.
This commit is contained in:
Henrik Lissner 2022-09-24 10:45:50 +02:00
parent d33478dc79
commit 6c76b98dbb
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
12 changed files with 57 additions and 34 deletions

View file

@ -34,7 +34,7 @@
"Open your private init.el file.
And jumps to your `doom!' block."
(interactive)
(find-file (expand-file-name "init.el" doom-user-dir))
(find-file (expand-file-name doom-module-init-file doom-user-dir))
(goto-char
(or (save-excursion
(goto-char (point-min))
@ -45,13 +45,13 @@ And jumps to your `doom!' block."
(defun doom/goto-private-config-file ()
"Open your private config.el file."
(interactive)
(find-file (expand-file-name "config.el" doom-user-dir)))
(find-file (expand-file-name doom-module-config-file doom-user-dir)))
;;;###autoload
(defun doom/goto-private-packages-file ()
"Open your private packages.el file."
(interactive)
(find-file (expand-file-name "packages.el" doom-user-dir)))
(find-file (expand-file-name doom-module-packages-file doom-user-dir)))
;;

View file

@ -331,7 +331,7 @@ ready to be pasted in a bug report on github."
,@(condition-case e
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-user-dir "packages.el")
(doom-path doom-user-dir doom-module-packages-file)
"package!"))
(error (format "<%S>" e))))
(unpin
@ -339,7 +339,7 @@ ready to be pasted in a bug report on github."
(mapcan #'identity
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-user-dir "packages.el")
(doom-path doom-user-dir doom-module-packages-file)
"unpin!")))
(error (list (format "<%S>" e)))))
(elpa

View file

@ -162,7 +162,7 @@ each package."
(ignore-errors (intern (cadr module)))
current-prefix-arg)))
(mapc (lambda! ((cat . mod))
(if-let (packages-file (doom-module-locate-path cat mod "packages.el"))
(if-let (packages-file (doom-module-locate-path cat mod doom-module-packages-file))
(with-current-buffer
(or (get-file-buffer packages-file)
(find-file-noselect packages-file))
@ -185,7 +185,7 @@ each package."
(unless modules
(user-error "This package isn't installed by any Doom module"))
(dolist (module modules)
(when-let (packages-file (doom-module-locate-path (car module) (cdr module)))
(when (doom-module-locate-path (car module) (cdr module) doom-module-packages-file)
(doom/bump-module (car module) (cdr module))))))