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

@ -9,24 +9,24 @@
;;;###autoload
(defun doom/open-private-config ()
"Browse your `doom-private-dir'."
"Browse your `doom-user-dir'."
(interactive)
(unless (file-directory-p doom-private-dir)
(make-directory doom-private-dir t))
(doom-project-browse doom-private-dir))
(unless (file-directory-p doom-user-dir)
(make-directory doom-user-dir t))
(doom-project-browse doom-user-dir))
;;;###autoload
(defun doom/find-file-in-private-config ()
"Search for a file in `doom-private-dir'."
"Search for a file in `doom-user-dir'."
(interactive)
(doom-project-find-file doom-private-dir))
(doom-project-find-file doom-user-dir))
;;;###autoload
(defun doom/goto-private-init-file ()
"Open your private init.el file.
And jumps to your `doom!' block."
(interactive)
(find-file (expand-file-name "init.el" doom-private-dir))
(find-file (expand-file-name "init.el" doom-user-dir))
(goto-char
(or (save-excursion
(goto-char (point-min))
@ -37,13 +37,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-private-dir)))
(find-file (expand-file-name "config.el" 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-private-dir)))
(find-file (expand-file-name "packages.el" doom-user-dir)))
;;

View file

@ -239,7 +239,7 @@ ready to be pasted in a bug report on github."
(symlink-path doom-emacs-dir))))
(doom . ,(list doom-version
(sh "git" "log" "-1" "--format=%D %h %ci")
(symlink-path doom-private-dir)))
(symlink-path doom-user-dir)))
(shell . ,(abbrev-path shell-file-name))
(features . ,system-configuration-features)
(traits
@ -261,13 +261,13 @@ ready to be pasted in a bug report on github."
'exec-path-from-shell)
(if (file-symlink-p doom-emacs-dir)
'symlinked-emacsdir)
(if (file-symlink-p doom-private-dir)
(if (file-symlink-p doom-user-dir)
'symlinked-doomdir)
(if (and (stringp custom-file) (file-exists-p custom-file))
'custom-file)
(if (doom-files-in `(,@doom-modules-dirs
,doom-core-dir
,doom-private-dir)
,doom-user-dir)
:type 'files :match "\\.elc$")
'byte-compiled-config)))))
(custom
@ -303,7 +303,7 @@ ready to be pasted in a bug report on github."
,@(condition-case e
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el")
(doom-path doom-user-dir "packages.el")
"package!"))
(error (format "<%S>" e))))
(unpin
@ -311,7 +311,7 @@ ready to be pasted in a bug report on github."
(mapcan #'identity
(mapcar
#'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el")
(doom-path doom-user-dir "packages.el")
"unpin!")))
(error (list (format "<%S>" e)))))
(elpa

View file

@ -366,7 +366,7 @@ without needing to check if they are available."
(format "%s %s" (nth 1 sexp) (nth 2 sexp)))))))
((when buffer-file-name
(when-let (mod (doom-module-from-path buffer-file-name))
(unless (memq (car mod) '(:core :private))
(unless (memq (car mod) '(:core :user))
(format "%s %s" (car mod) (cdr mod))))))
((when-let (mod (cdr (assq major-mode doom--help-major-mode-module-alist)))
(format "%s %s"
@ -609,7 +609,7 @@ If prefix arg is present, refresh the cache."
(dolist (m modules)
(let* ((module-path (pcase (car m)
(:core doom-core-dir)
(:private doom-private-dir)
(:user doom-user-dir)
(category
(doom-module-locate-path category
(cdr m)))))

View file

@ -154,7 +154,7 @@ each package."
(if (listp m)
(format "%s %s" (car m) (cdr m))
(format "%s" m)))
(append '(:private :core)
(append '(:user :core)
(delete-dups (mapcar #'car modules))
modules)))
nil t nil nil))
@ -165,8 +165,8 @@ each package."
(mapc (lambda! ((cat . mod))
(if-let (packages-file
(pcase cat
(:private (car (doom-glob doom-private-dir "packages.el")))
(:core (car (doom-glob doom-core-dir "packages.el")))
(:user (car (doom-glob doom-user-dir "packages.el")))
(:core (car (doom-glob doom-core-dir "packages.el")))
(_ (doom-module-locate-path cat mod "packages.el"))))
(with-current-buffer
(or (get-file-buffer packages-file)
@ -177,7 +177,7 @@ each package."
(if module
(list (cons category module))
(cl-remove-if-not (lambda (m) (eq (car m) category))
(append '((:core) (:private))
(append '((:core) (:user))
(doom-module-list 'all))))))
;;;###autoload