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

@ -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"))