refactor: deprecate doom-private-dir for doom-user-dir

- Deprecates the doom-private-dir variable in favor of doom-user-dir.
- Renames the pseudo category for the user's module: :private -> :user.
- Renames the doom-private-error error type to doom-user-error.

Emacs uses the term "user" to refer to the "things" in user space (e.g.
user-init-file, user-emacs-directory, user-mail-address, xdg-user-dirs,
package-user-dir, etc), and I'd like to be consistent with that. It also
has the nice side-effect of being slightly shorter. I also hope
'doom-user-error' will be less obtuse to beginners than
'doom-private-error'.
This commit is contained in:
Henrik Lissner 2022-08-13 21:27:11 +02:00
parent ad6a3d0f33
commit a5c80fcb4b
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
28 changed files with 101 additions and 96 deletions

View file

@ -63,7 +63,7 @@ hoist buggy forms into autoloads.")
(append (doom-glob doom-core-dir "lib/*.el")
(cl-loop for dir
in (append (cdr (doom-module-load-path 'all-p))
(list doom-private-dir))
(list doom-user-dir))
if (doom-glob dir "autoload.el") collect (car it)
if (doom-glob dir "autoload/*.el") append it)
(mapcan #'doom-glob doom-autoloads-files))
@ -204,7 +204,7 @@ hoist buggy forms into autoloads.")
(generated-autoload-load-name (file-name-sans-extension file))
(target-buffer (current-buffer))
(module (doom-module-from-path file))
(module-enabled-p (and (or (memq (car module) '(:core :private))
(module-enabled-p (and (or (memq (car module) '(:core :user))
(doom-module-p (car module) (cdr module)))
(doom-file-cookie-p file "if" t))))
(save-excursion
@ -241,7 +241,7 @@ non-nil, treat FILES as pre-generated autoload files instead."
(replace-match (prin1-to-string file) t t)))))
(let ((load-file-name file)
(load-path
(append (list doom-private-dir)
(append (list doom-user-dir)
doom-modules-dirs
load-path)))
(condition-case _

View file

@ -17,17 +17,17 @@
"Byte-compiles your config or selected modules.
compile [TARGETS...]
compile :core :private lang/python
compile :core :user lang/python
compile feature lang
Accepts :core and :private as special arguments, which target Doom's core files
Accepts :core and :user as special arguments, which target Doom's core files
and your private config files, respectively. To recompile your packages, use
'doom build' instead."
(doom-cli-compile
(if (or core-p private-p)
(append (if core-p (doom-glob doom-emacs-dir "init.el"))
(if core-p (list doom-core-dir))
(if private-p (list doom-private-dir)))
(if private-p (list doom-user-dir)))
(or (y-or-n-p
(concat "WARNING: Changes made to your config after compiling it won't take effect until\n"
"this command is rerun or you run 'doom clean'! It will also make error backtraces\n"
@ -40,7 +40,7 @@ and your private config files, respectively. To recompile your packages, use
(seq-filter
;; Only compile Doom's modules
(doom-rpartial #'file-in-directory-p doom-emacs-dir)
;; Omit `doom-private-dir', which is always first
;; Omit `doom-user-dir', which is always first
(cdr (doom-module-load-path)))))
recompile-p
verbose-p))
@ -200,7 +200,7 @@ module. This does not include your byte-compiled, third party packages.'"
with esc = (if init-file-debug "" "\033[1A")
for path
in (append (doom-glob doom-emacs-dir "*.elc")
(doom-files-in doom-private-dir :match "\\.elc$" :depth 1)
(doom-files-in doom-user-dir :match "\\.elc$" :depth 1)
(doom-files-in doom-core-dir :match "\\.elc$")
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4))
if (file-exists-p path)

View file

@ -199,10 +199,10 @@ in."
" (remove \".git\" projectile-project-root-files-bottom-up)))"))
;; There should only be one
(when (and (file-equal-p doom-private-dir "~/.config/doom")
(when (and (file-equal-p doom-user-dir "~/.config/doom")
(file-directory-p "~/.doom.d"))
(print! (warn "Both %S and '~/.doom.d' exist on your system")
(path doom-private-dir))
(path doom-user-dir))
(explain! "Doom will only load one of these (~/.config/doom takes precedence). Possessing\n"
"both is rarely intentional; you should one or the other."))
@ -234,9 +234,9 @@ in."
"case feel free to ignore this warning.")))))))))
(print! (start "Checking for stale elc files in your DOOMDIR..."))
(when (file-directory-p doom-private-dir)
(when (file-directory-p doom-user-dir)
(print-group!
(elc-check-dir doom-private-dir)))
(elc-check-dir doom-user-dir)))
(when doom-modules
(print! (start "Checking your enabled modules..."))

View file

@ -44,30 +44,30 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g.
(print! (green "Installing Doom Emacs!\n"))
(let ((default-directory doom-emacs-dir)
(yes? (doom-cli-context-suppress-prompts-p context)))
;; Create `doom-private-dir'
;; Create `doom-user-dir'
(if (eq config? :no)
(print! (warn "Not copying private config template, as requested"))
;; Create DOOMDIR in ~/.config/doom if ~/.config/emacs exists.
(when (and (not (file-directory-p doom-private-dir))
(when (and (not (file-directory-p doom-user-dir))
(not (getenv "DOOMDIR")))
(let ((xdg-config-dir (or (getenv "XDG_CONFIG_HOME") "~/.config")))
(when (file-in-directory-p doom-emacs-dir xdg-config-dir)
(setq doom-private-dir (expand-file-name "doom/" xdg-config-dir)))))
(setq doom-user-dir (expand-file-name "doom/" xdg-config-dir)))))
(if (file-directory-p doom-private-dir)
(print! (item "Skipping %s (already exists)") (relpath doom-private-dir))
(make-directory doom-private-dir 'parents)
(print! (success "Created %s") (relpath doom-private-dir)))
(if (file-directory-p doom-user-dir)
(print! (item "Skipping %s (already exists)") (relpath doom-user-dir))
(make-directory doom-user-dir 'parents)
(print! (success "Created %s") (relpath doom-user-dir)))
;; Create init.el, config.el & packages.el
(print-group!
(mapc (lambda (file)
(cl-destructuring-bind (filename . template) file
(if (file-exists-p! filename doom-private-dir)
(if (file-exists-p! filename doom-user-dir)
(print! (item "Skipping %s (already exists)")
(path filename))
(print! (item "Creating %s%s") (relpath doom-private-dir) filename)
(with-temp-file (doom-path doom-private-dir filename)
(print! (item "Creating %s%s") (relpath doom-user-dir) filename)
(with-temp-file (doom-path doom-user-dir filename)
(insert-file-contents template))
(print! (success "Done!")))))
`(("init.el" . ,(doom-path doom-emacs-dir "templates/init.example.el"))