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

@ -42,7 +42,7 @@
(format "%s" (substring scope 1)) (format "%s" (substring scope 1))
(format "*/%s" scope))) (format "*/%s" scope)))
(list (doom-dir (dir!) "../modules/") (list (doom-dir (dir!) "../modules/")
(doom-dir doom-private-dir "modules/")))) (doom-dir doom-user-dir "modules/"))))
(defun ci-check-docs-scope (scope _) (defun ci-check-docs-scope (scope _)
"Allow any filename in docs/* as a scope for docs commits." "Allow any filename in docs/* as a scope for docs commits."

View file

@ -111,7 +111,7 @@
;; Load $DOOMDIR/init.el, to read the user's `doom!' block, and so users can ;; Load $DOOMDIR/init.el, to read the user's `doom!' block, and so users can
;; customize things early, if they like. ;; customize things early, if they like.
(load! doom-module-init-file doom-private-dir t) (load! doom-module-init-file doom-user-dir t)
;; ;;
@ -299,7 +299,7 @@ SEE ALSO:
(load! cli-file path t))))) (load! cli-file path t)))))
(doom-log "Loading $DOOMDIR/cli.el") (doom-log "Loading $DOOMDIR/cli.el")
(load! cli-file doom-private-dir t)) (load! cli-file doom-user-dir t))
;; Allow per-project Doom settings in .doom files. ;; Allow per-project Doom settings in .doom files.
(let (doomrc) (let (doomrc)

View file

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

View file

@ -17,17 +17,17 @@
"Byte-compiles your config or selected modules. "Byte-compiles your config or selected modules.
compile [TARGETS...] compile [TARGETS...]
compile :core :private lang/python compile :core :user lang/python
compile feature lang 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 and your private config files, respectively. To recompile your packages, use
'doom build' instead." 'doom build' instead."
(doom-cli-compile (doom-cli-compile
(if (or core-p private-p) (if (or core-p private-p)
(append (if core-p (doom-glob doom-emacs-dir "init.el")) (append (if core-p (doom-glob doom-emacs-dir "init.el"))
(if core-p (list doom-core-dir)) (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 (or (y-or-n-p
(concat "WARNING: Changes made to your config after compiling it won't take effect until\n" (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" "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 (seq-filter
;; Only compile Doom's modules ;; Only compile Doom's modules
(doom-rpartial #'file-in-directory-p doom-emacs-dir) (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))))) (cdr (doom-module-load-path)))))
recompile-p recompile-p
verbose-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") with esc = (if init-file-debug "" "\033[1A")
for path for path
in (append (doom-glob doom-emacs-dir "*.elc") 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-core-dir :match "\\.elc$")
(doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4)) (doom-files-in doom-modules-dirs :match "\\.elc$" :depth 4))
if (file-exists-p path) if (file-exists-p path)

View file

@ -199,10 +199,10 @@ in."
" (remove \".git\" projectile-project-root-files-bottom-up)))")) " (remove \".git\" projectile-project-root-files-bottom-up)))"))
;; There should only be one ;; 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")) (file-directory-p "~/.doom.d"))
(print! (warn "Both %S and '~/.doom.d' exist on your system") (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" (explain! "Doom will only load one of these (~/.config/doom takes precedence). Possessing\n"
"both is rarely intentional; you should one or the other.")) "both is rarely intentional; you should one or the other."))
@ -234,9 +234,9 @@ in."
"case feel free to ignore this warning."))))))))) "case feel free to ignore this warning.")))))))))
(print! (start "Checking for stale elc files in your DOOMDIR...")) (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! (print-group!
(elc-check-dir doom-private-dir))) (elc-check-dir doom-user-dir)))
(when doom-modules (when doom-modules
(print! (start "Checking your enabled 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")) (print! (green "Installing Doom Emacs!\n"))
(let ((default-directory doom-emacs-dir) (let ((default-directory doom-emacs-dir)
(yes? (doom-cli-context-suppress-prompts-p context))) (yes? (doom-cli-context-suppress-prompts-p context)))
;; Create `doom-private-dir' ;; Create `doom-user-dir'
(if (eq config? :no) (if (eq config? :no)
(print! (warn "Not copying private config template, as requested")) (print! (warn "Not copying private config template, as requested"))
;; Create DOOMDIR in ~/.config/doom if ~/.config/emacs exists. ;; 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"))) (not (getenv "DOOMDIR")))
(let ((xdg-config-dir (or (getenv "XDG_CONFIG_HOME") "~/.config"))) (let ((xdg-config-dir (or (getenv "XDG_CONFIG_HOME") "~/.config")))
(when (file-in-directory-p doom-emacs-dir xdg-config-dir) (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) (if (file-directory-p doom-user-dir)
(print! (item "Skipping %s (already exists)") (relpath doom-private-dir)) (print! (item "Skipping %s (already exists)") (relpath doom-user-dir))
(make-directory doom-private-dir 'parents) (make-directory doom-user-dir 'parents)
(print! (success "Created %s") (relpath doom-private-dir))) (print! (success "Created %s") (relpath doom-user-dir)))
;; Create init.el, config.el & packages.el ;; Create init.el, config.el & packages.el
(print-group! (print-group!
(mapc (lambda (file) (mapc (lambda (file)
(cl-destructuring-bind (filename . template) 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)") (print! (item "Skipping %s (already exists)")
(path filename)) (path filename))
(print! (item "Creating %s%s") (relpath doom-private-dir) filename) (print! (item "Creating %s%s") (relpath doom-user-dir) filename)
(with-temp-file (doom-path doom-private-dir filename) (with-temp-file (doom-path doom-user-dir filename)
(insert-file-contents template)) (insert-file-contents template))
(print! (success "Done!"))))) (print! (success "Done!")))))
`(("init.el" . ,(doom-path doom-emacs-dir "templates/init.example.el")) `(("init.el" . ,(doom-path doom-emacs-dir "templates/init.example.el"))

View file

@ -544,8 +544,8 @@ This is a wrapper around `eval-after-load' that:
(cons 'error (file-name-directory path))) (cons 'error (file-name-directory path)))
((file-in-directory-p source doom-core-dir) ((file-in-directory-p source doom-core-dir)
(cons 'doom-error doom-core-dir)) (cons 'doom-error doom-core-dir))
((file-in-directory-p source doom-private-dir) ((file-in-directory-p source doom-user-dir)
(cons 'doom-private-error doom-private-dir)) (cons 'doom-user-error doom-user-dir))
((file-in-directory-p source (expand-file-name "cli" doom-core-dir)) ((file-in-directory-p source (expand-file-name "cli" doom-core-dir))
(cons 'doom-cli-error (expand-file-name "cli" doom-core-dir))) (cons 'doom-cli-error (expand-file-name "cli" doom-core-dir)))
((cons 'doom-module-error doom-emacs-dir))))) ((cons 'doom-module-error doom-emacs-dir)))))

View file

@ -7,7 +7,7 @@
"A hash table of enabled modules. Set by `doom-initialize-modules'.") "A hash table of enabled modules. Set by `doom-initialize-modules'.")
(defvar doom-modules-dirs (defvar doom-modules-dirs
(list (expand-file-name "modules/" doom-private-dir) (list (expand-file-name "modules/" doom-user-dir)
doom-modules-dir) doom-modules-dir)
"A list of module root directories. Order determines priority.") "A list of module root directories. Order determines priority.")
@ -107,22 +107,21 @@ symbols, and that module's plist."
(load! file (plist-get plist :path) t)))) (load! file (plist-get plist :path) t))))
(defun doom-initialize-modules (&optional force-p no-config-p) (defun doom-initialize-modules (&optional force-p no-config-p)
"Loads the init.el in `doom-private-dir' and sets up hooks for a healthy "Loads the init.el in `doom-user-dir' and sets up hooks for a healthy session
session of Dooming. Will noop if used more than once, unless FORCE-P is of Dooming. Will noop if used more than once, unless FORCE-P is non-nil."
non-nil."
(when (or force-p (not doom-init-modules-p)) (when (or force-p (not doom-init-modules-p))
(setq doom-init-modules-p t) (setq doom-init-modules-p t)
(unless no-config-p (unless no-config-p
(doom-log "Initializing core modules") (doom-log "Initializing core modules")
(doom-initialize-core-modules)) (doom-initialize-core-modules))
(when-let (init-p (load! doom-module-init-file doom-private-dir t)) (when-let (init-p (load! doom-module-init-file doom-user-dir t))
(doom-log "Initializing user config") (doom-log "Initializing user config")
(maphash (doom-module-loader doom-module-init-file) doom-modules) (maphash (doom-module-loader doom-module-init-file) doom-modules)
(doom-run-hooks 'doom-before-init-modules-hook) (doom-run-hooks 'doom-before-init-modules-hook)
(unless no-config-p (unless no-config-p
(maphash (doom-module-loader doom-module-config-file) doom-modules) (maphash (doom-module-loader doom-module-config-file) doom-modules)
(doom-run-hooks 'doom-init-modules-hook) (doom-run-hooks 'doom-init-modules-hook)
(load! "config" doom-private-dir t) (load! "config" doom-user-dir t)
(when custom-file (when custom-file
(load custom-file 'noerror (not doom-debug-mode))))))) (load custom-file 'noerror (not doom-debug-mode)))))))
@ -231,18 +230,18 @@ If ENABLED-ONLY, return nil if the containing module isn't enabled."
((or (string-match-p (concat "^" (regexp-quote doom-core-dir)) path) ((or (string-match-p (concat "^" (regexp-quote doom-core-dir)) path)
(file-in-directory-p path doom-core-dir)) (file-in-directory-p path doom-core-dir))
(cons :core (intern (file-name-base path)))) (cons :core (intern (file-name-base path))))
((or (string-match-p (concat "^" (regexp-quote doom-private-dir)) path) ((or (string-match-p (concat "^" (regexp-quote doom-user-dir)) path)
(file-in-directory-p path doom-private-dir)) (file-in-directory-p path doom-user-dir))
(cons :private (intern (file-name-base path))))))))) (cons :user (intern (file-name-base path)))))))))
(defun doom-module-load-path (&optional module-dirs) (defun doom-module-load-path (&optional module-dirs)
"Return a list of file paths to activated modules. "Return a list of file paths to activated modules.
The list is in no particular order and its file paths are absolute. If The list is in no particular order and its file paths are absolute. If
MODULE-DIRS is non-nil, include all modules (even disabled ones) available in MODULE-DIRS is non-nil, include all modules (even disabled ones) available in
those directories. The first returned path is always `doom-private-dir'." those directories. The first returned path is always `doom-user-dir'."
(declare (pure t) (side-effect-free t)) (declare (pure t) (side-effect-free t))
(append (list doom-private-dir) (append (list doom-user-dir)
(if module-dirs (if module-dirs
(mapcar (lambda (m) (doom-module-locate-path (car m) (cdr m))) (mapcar (lambda (m) (doom-module-locate-path (car m) (cdr m)))
(delete-dups (delete-dups

View file

@ -26,7 +26,7 @@
;; versions. There's also 'bin/doom sync -u' for updating only your packages. ;; versions. There's also 'bin/doom sync -u' for updating only your packages.
;; ;;
;; How this works is: the system reads packages.el files located in each ;; How this works is: the system reads packages.el files located in each
;; activated module, your private directory (`doom-private-dir'), and one in ;; activated module, your private directory (`doom-user-dir'), and one in
;; `doom-core-dir'. These contain `package!' declarations that tell DOOM what ;; `doom-core-dir'. These contain `package!' declarations that tell DOOM what
;; plugins to install and where from. ;; plugins to install and where from.
;; ;;
@ -114,10 +114,10 @@ uses a straight or package.el command directly).")
(after! comp (after! comp
;; HACK Disable native-compilation for some troublesome packages ;; HACK Disable native-compilation for some troublesome packages
(mapc (doom-partial #'add-to-list 'native-comp-deferred-compilation-deny-list) (mapc (doom-partial #'add-to-list 'native-comp-deferred-compilation-deny-list)
(let ((local-dir-re (concat "\\`" (regexp-quote doom-local-dir)))) (list "/emacs-jupyter.*\\.el\\'"
(list (concat local-dir-re ".*/emacs-jupyter.*\\.el\\'") "/evil-collection-vterm\\.el\\'"
(concat local-dir-re ".*/evil-collection-vterm\\.el\\'") "/vterm\\.el\\'"
(concat local-dir-re ".*/with-editor\\.el\\'"))))) "/with-editor\\.el\\'")))
;; Remove unwanted $EMACSDIR/eln-cache/ directory. ;; Remove unwanted $EMACSDIR/eln-cache/ directory.
(cl-callf2 delete (file-name-concat doom-emacs-dir "eln-cache/") (cl-callf2 delete (file-name-concat doom-emacs-dir "eln-cache/")
@ -363,7 +363,7 @@ non-nil."
(defun doom-package-in-module-p (package category &optional module) (defun doom-package-in-module-p (package category &optional module)
"Return non-nil if PACKAGE was installed by the user's private config." "Return non-nil if PACKAGE was installed by the user's private config."
(when-let (modules (doom-package-get package :modules)) (when-let (modules (doom-package-get package :modules))
(or (and (not module) (assq :private modules)) (or (and (not module) (assq :user modules))
(member (cons category module) modules)))) (member (cons category module) modules))))
(defun doom-package-backend (package) (defun doom-package-backend (package)
@ -422,7 +422,7 @@ ones."
(doom--read-packages (doom--read-packages
(doom-path doom-core-dir packages-file) all-p 'noerror) (doom-path doom-core-dir packages-file) all-p 'noerror)
(unless core-only-p (unless core-only-p
(let ((private-packages (doom-path doom-private-dir packages-file)) (let ((private-packages (doom-path doom-user-dir packages-file))
(doom-modules (doom-module-list))) (doom-modules (doom-module-list)))
(if all-p (if all-p
(mapc #'doom--read-packages (mapc #'doom--read-packages
@ -534,8 +534,8 @@ elsewhere."
(cl-callf plist-put plist :modules (cl-callf plist-put plist :modules
(append module-list (append module-list
(list module) (list module)
(when (file-in-directory-p ,(dir!) doom-private-dir) (when (file-in-directory-p ,(dir!) doom-user-dir)
'((:private . modules))) '((:user . modules)))
nil)))) nil))))
;; Merge given plist with pre-existing one ;; Merge given plist with pre-existing one
(cl-loop for (key value) on (list ,@plist) by 'cddr (cl-loop for (key value) on (list ,@plist) by 'cddr

View file

@ -521,7 +521,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;;; Theme & font ;;; Theme & font
;; User themes should live in $DOOMDIR/themes, not ~/.emacs.d ;; User themes should live in $DOOMDIR/themes, not ~/.emacs.d
(setq custom-theme-directory (concat doom-private-dir "themes/")) (setq custom-theme-directory (concat doom-user-dir "themes/"))
;; Third party themes add themselves to `custom-theme-load-path', but the themes ;; Third party themes add themselves to `custom-theme-load-path', but the themes
;; living in $DOOMDIR/themes should always have priority. ;; living in $DOOMDIR/themes should always have priority.

View file

@ -102,12 +102,7 @@
(defconst EMACS29+ (> emacs-major-version 28)) (defconst EMACS29+ (> emacs-major-version 28))
;; DEPRECATED remove in v3 ;; DEPRECATED remove in v3
(defconst MODULES (featurep 'dynamic-modules)) (defconst MODULES (featurep 'dynamic-modules))
(defconst NATIVECOMP (featurep 'native-compile)) (defconst NATIVECOMP (featurep 'native-compile)))
(make-obsolete-variable 'EMACS28+ "Use (>= emacs-major-version 28) instead" "3.0.0")
(make-obsolete-variable 'EMACS29+ "Use (>= emacs-major-version 29) instead" "3.0.0")
(make-obsolete-variable 'MODULES "Use (featurep 'dynamic-modules) instead" "3.0.0")
(make-obsolete-variable 'NATIVECOMP "Use (featurep 'native-compile) instead" "3.0.0"))
;; ;;
@ -152,7 +147,7 @@
(defconst doom-docs-dir (concat doom-emacs-dir "docs/") (defconst doom-docs-dir (concat doom-emacs-dir "docs/")
"Where Doom's documentation files are stored. Must end with a slash.") "Where Doom's documentation files are stored. Must end with a slash.")
(defconst doom-private-dir (defconst doom-user-dir
(if-let (doomdir (getenv-internal "DOOMDIR")) (if-let (doomdir (getenv-internal "DOOMDIR"))
(expand-file-name (file-name-as-directory doomdir)) (expand-file-name (file-name-as-directory doomdir))
(or (let ((xdgdir (or (let ((xdgdir
@ -275,6 +270,17 @@ which is loaded at startup (if it exists). This is helpful if Emacs can't
users).") users).")
;;
;;; Legacy support
(define-obsolete-variable-alias 'doom-private-dir 'doom-user-dir "3.0.0")
(make-obsolete-variable 'EMACS28+ "Use (>= emacs-major-version 28) instead" "3.0.0")
(make-obsolete-variable 'EMACS29+ "Use (>= emacs-major-version 29) instead" "3.0.0")
(make-obsolete-variable 'MODULES "Use (featurep 'dynamic-modules) instead" "3.0.0")
(make-obsolete-variable 'NATIVECOMP "Use (featurep 'native-compile) instead" "3.0.0")
;; ;;
;;; Custom error types ;;; Custom error types
@ -282,7 +288,7 @@ users).")
(define-error 'doom-hook-error "Error in a Doom startup hook" 'doom-error) (define-error 'doom-hook-error "Error in a Doom startup hook" 'doom-error)
(define-error 'doom-autoload-error "Error in Doom's autoloads file" 'doom-error) (define-error 'doom-autoload-error "Error in Doom's autoloads file" 'doom-error)
(define-error 'doom-module-error "Error in a Doom module" 'doom-error) (define-error 'doom-module-error "Error in a Doom module" 'doom-error)
(define-error 'doom-private-error "Error in private config" 'doom-error) (define-error 'doom-user-error "Error in user's config" 'doom-error)
(define-error 'doom-package-error "Error with packages" 'doom-error) (define-error 'doom-package-error "Error with packages" 'doom-error)
@ -340,7 +346,7 @@ users).")
;; Allow the user to store custom.el-saved settings and themes in their Doom ;; Allow the user to store custom.el-saved settings and themes in their Doom
;; config (e.g. ~/.doom.d/). ;; config (e.g. ~/.doom.d/).
(setq custom-file (expand-file-name "custom.el" doom-private-dir)) (setq custom-file (expand-file-name "custom.el" doom-user-dir))
;; By default, Emacs stores `authinfo' in $HOME and in plain-text. Let's not do ;; By default, Emacs stores `authinfo' in $HOME and in plain-text. Let's not do
;; that, mkay? This file stores usernames, passwords, and other treasures for ;; that, mkay? This file stores usernames, passwords, and other treasures for

View file

@ -9,24 +9,24 @@
;;;###autoload ;;;###autoload
(defun doom/open-private-config () (defun doom/open-private-config ()
"Browse your `doom-private-dir'." "Browse your `doom-user-dir'."
(interactive) (interactive)
(unless (file-directory-p doom-private-dir) (unless (file-directory-p doom-user-dir)
(make-directory doom-private-dir t)) (make-directory doom-user-dir t))
(doom-project-browse doom-private-dir)) (doom-project-browse doom-user-dir))
;;;###autoload ;;;###autoload
(defun doom/find-file-in-private-config () (defun doom/find-file-in-private-config ()
"Search for a file in `doom-private-dir'." "Search for a file in `doom-user-dir'."
(interactive) (interactive)
(doom-project-find-file doom-private-dir)) (doom-project-find-file doom-user-dir))
;;;###autoload ;;;###autoload
(defun doom/goto-private-init-file () (defun doom/goto-private-init-file ()
"Open your private init.el file. "Open your private init.el file.
And jumps to your `doom!' block." And jumps to your `doom!' block."
(interactive) (interactive)
(find-file (expand-file-name "init.el" doom-private-dir)) (find-file (expand-file-name "init.el" doom-user-dir))
(goto-char (goto-char
(or (save-excursion (or (save-excursion
(goto-char (point-min)) (goto-char (point-min))
@ -37,13 +37,13 @@ And jumps to your `doom!' block."
(defun doom/goto-private-config-file () (defun doom/goto-private-config-file ()
"Open your private config.el file." "Open your private config.el file."
(interactive) (interactive)
(find-file (expand-file-name "config.el" doom-private-dir))) (find-file (expand-file-name "config.el" doom-user-dir)))
;;;###autoload ;;;###autoload
(defun doom/goto-private-packages-file () (defun doom/goto-private-packages-file ()
"Open your private packages.el file." "Open your private packages.el file."
(interactive) (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)))) (symlink-path doom-emacs-dir))))
(doom . ,(list doom-version (doom . ,(list doom-version
(sh "git" "log" "-1" "--format=%D %h %ci") (sh "git" "log" "-1" "--format=%D %h %ci")
(symlink-path doom-private-dir))) (symlink-path doom-user-dir)))
(shell . ,(abbrev-path shell-file-name)) (shell . ,(abbrev-path shell-file-name))
(features . ,system-configuration-features) (features . ,system-configuration-features)
(traits (traits
@ -261,13 +261,13 @@ ready to be pasted in a bug report on github."
'exec-path-from-shell) 'exec-path-from-shell)
(if (file-symlink-p doom-emacs-dir) (if (file-symlink-p doom-emacs-dir)
'symlinked-emacsdir) 'symlinked-emacsdir)
(if (file-symlink-p doom-private-dir) (if (file-symlink-p doom-user-dir)
'symlinked-doomdir) 'symlinked-doomdir)
(if (and (stringp custom-file) (file-exists-p custom-file)) (if (and (stringp custom-file) (file-exists-p custom-file))
'custom-file) 'custom-file)
(if (doom-files-in `(,@doom-modules-dirs (if (doom-files-in `(,@doom-modules-dirs
,doom-core-dir ,doom-core-dir
,doom-private-dir) ,doom-user-dir)
:type 'files :match "\\.elc$") :type 'files :match "\\.elc$")
'byte-compiled-config))))) 'byte-compiled-config)))))
(custom (custom
@ -303,7 +303,7 @@ ready to be pasted in a bug report on github."
,@(condition-case e ,@(condition-case e
(mapcar (mapcar
#'cdr (doom--collect-forms-in #'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el") (doom-path doom-user-dir "packages.el")
"package!")) "package!"))
(error (format "<%S>" e)))) (error (format "<%S>" e))))
(unpin (unpin
@ -311,7 +311,7 @@ ready to be pasted in a bug report on github."
(mapcan #'identity (mapcan #'identity
(mapcar (mapcar
#'cdr (doom--collect-forms-in #'cdr (doom--collect-forms-in
(doom-path doom-private-dir "packages.el") (doom-path doom-user-dir "packages.el")
"unpin!"))) "unpin!")))
(error (list (format "<%S>" e))))) (error (list (format "<%S>" e)))))
(elpa (elpa

View file

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

View file

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

View file

@ -180,7 +180,7 @@
(use-package! company-dict (use-package! company-dict
:defer t :defer t
:config :config
(setq company-dict-dir (expand-file-name "dicts" doom-private-dir)) (setq company-dict-dir (expand-file-name "dicts" doom-user-dir))
(add-hook! 'doom-project-hook (add-hook! 'doom-project-hook
(defun +company-enable-project-dicts-h (mode &rest _) (defun +company-enable-project-dicts-h (mode &rest _)
"Enable per-project dictionaries." "Enable per-project dictionaries."

View file

@ -3,7 +3,7 @@
;;;###autoload (add-hook 'org-mode-hook #'+literate-enable-recompile-h) ;;;###autoload (add-hook 'org-mode-hook #'+literate-enable-recompile-h)
(defvar +literate-config-file (defvar +literate-config-file
(concat doom-private-dir "config.org") (concat doom-user-dir "config.org")
"The file path of your literate config file.") "The file path of your literate config file.")
(defvar +literate-tangle--async-proc nil) (defvar +literate-tangle--async-proc nil)
@ -52,7 +52,7 @@
(or (getenv "__NOTANGLE") (or (getenv "__NOTANGLE")
(and (+literate-tangle +literate-config-file (and (+literate-tangle +literate-config-file
(concat doom-module-config-file ".el") (concat doom-module-config-file ".el")
doom-private-dir) doom-user-dir)
(or (not noninteractive) (or (not noninteractive)
(exit! "__NOTANGLE=1 $@"))))) (exit! "__NOTANGLE=1 $@")))))
@ -77,7 +77,7 @@
`(funcall #',(symbol-function #'+literate-tangle) `(funcall #',(symbol-function #'+literate-tangle)
,+literate-config-file ,+literate-config-file
,(concat doom-module-config-file ".el") ,(concat doom-module-config-file ".el")
,doom-private-dir)))) ,doom-user-dir))))
(add-hook 'kill-emacs-hook #'+literate-tangle-check-finished-h) (add-hook 'kill-emacs-hook #'+literate-tangle-check-finished-h)
(set-process-sentinel +literate-tangle--async-proc #'+literate-tangle--async-sentinel) (set-process-sentinel +literate-tangle--async-proc #'+literate-tangle--async-sentinel)
(run-at-time nil nil (lambda () (message "Tangling config.org"))) ; ensure shown after a save message (run-at-time nil nil (lambda () (message "Tangling config.org"))) ; ensure shown after a save message
@ -132,9 +132,9 @@ This is performed with an asyncronous Emacs process, except when
;;;###autoload ;;;###autoload
(defun +literate-recompile-maybe-h () (defun +literate-recompile-maybe-h ()
"Recompile literate config to `doom-private-dir'. "Recompile literate config to `doom-user-dir'.
We assume any org file in `doom-private-dir' is connected to your literate We assume any org file in `doom-user-dir' is connected to your literate
config, and should trigger a recompile if changed." config, and should trigger a recompile if changed."
(and (file-in-directory-p (and (file-in-directory-p
(buffer-file-name (buffer-base-buffer)) (buffer-file-name (buffer-base-buffer))

View file

@ -92,8 +92,8 @@ evil is loaded and enabled)."
(match-string 1 path)) (match-string 1 path))
((file-in-directory-p path doom-emacs-dir) ((file-in-directory-p path doom-emacs-dir)
(file-relative-name path doom-emacs-dir)) (file-relative-name path doom-emacs-dir))
((file-in-directory-p path doom-private-dir) ((file-in-directory-p path doom-user-dir)
(file-relative-name path doom-private-dir)) (file-relative-name path doom-user-dir))
((abbreviate-file-name path)))))) ((abbreviate-file-name path))))))
;;;###autoload ;;;###autoload

View file

@ -116,7 +116,7 @@ information.")
(defun +file-templates-in-emacs-dirs-p (file) (defun +file-templates-in-emacs-dirs-p (file)
"Returns t if FILE is in Doom or your private directory." "Returns t if FILE is in Doom or your private directory."
(or (file-in-directory-p file doom-private-dir) (or (file-in-directory-p file doom-user-dir)
(file-in-directory-p file doom-emacs-dir))) (file-in-directory-p file doom-emacs-dir)))
(defun +file-template-p (rule) (defun +file-template-p (rule)

View file

@ -1,6 +1,6 @@
;;; editor/snippets/config.el -*- lexical-binding: t; -*- ;;; editor/snippets/config.el -*- lexical-binding: t; -*-
(defvar +snippets-dir (expand-file-name "snippets/" doom-private-dir) (defvar +snippets-dir (expand-file-name "snippets/" doom-user-dir)
"Directory where `yasnippet' will search for your private snippets.") "Directory where `yasnippet' will search for your private snippets.")

View file

@ -17,8 +17,8 @@
(setq wl-demo nil (setq wl-demo nil
wl-stay-folder-window t wl-stay-folder-window t
wl-init-file (expand-file-name "wl.el" doom-private-dir) wl-init-file (expand-file-name "wl.el" doom-user-dir)
wl-folders-file (expand-file-name "folders.wl" doom-private-dir)) wl-folders-file (expand-file-name "folders.wl" doom-user-dir))
(setq wl-message-truncate-lines t (setq wl-message-truncate-lines t
wl-summary-width 120 wl-summary-width 120

View file

@ -247,7 +247,7 @@ https://emacs.stackexchange.com/questions/10230/how-to-indent-keywords-aligned"
;;;###autoload ;;;###autoload
(defun +emacs-lisp-reduce-flycheck-errors-in-emacs-config-h () (defun +emacs-lisp-reduce-flycheck-errors-in-emacs-config-h ()
"Remove `emacs-lisp-checkdoc' checker and reduce `emacs-lisp' checker "Remove `emacs-lisp-checkdoc' checker and reduce `emacs-lisp' checker
verbosity when editing a file in `doom-private-dir' or `doom-emacs-dir'." verbosity when editing a file in `doom-user-dir' or `doom-emacs-dir'."
(when (and (bound-and-true-p flycheck-mode) (when (and (bound-and-true-p flycheck-mode)
(eq major-mode 'emacs-lisp-mode) (eq major-mode 'emacs-lisp-mode)
(or (not default-directory) (or (not default-directory)

View file

@ -8,7 +8,7 @@
This marks a foldable marker for `outline-minor-mode' in elisp buffers.") This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
(defvar +emacs-lisp-disable-flycheck-in-dirs (defvar +emacs-lisp-disable-flycheck-in-dirs
(list doom-emacs-dir doom-private-dir) (list doom-emacs-dir doom-user-dir)
"List of directories to disable `emacs-lisp-checkdoc' in. "List of directories to disable `emacs-lisp-checkdoc' in.
This checker tends to produce a lot of false positives in your .emacs.d and This checker tends to produce a lot of false positives in your .emacs.d and

View file

@ -386,7 +386,7 @@ Or to create aliases for functions that behave differently:
;;; Lets say we're in ~/.doom.d/config.el ;;; Lets say we're in ~/.doom.d/config.el
(load! "lisp/module") ; loads ~/.doom.d/lisp/module.el (load! "lisp/module") ; loads ~/.doom.d/lisp/module.el
(load! "somefile" doom-emacs-dir) ; loads ~/.emacs.d/somefile.el (load! "somefile" doom-emacs-dir) ; loads ~/.emacs.d/somefile.el
(load! "anotherfile" doom-private-dir) ; loads ~/.doom.d/anotherfile.el (load! "anotherfile" doom-user-dir) ; loads ~/.doom.d/anotherfile.el
;; If you don't want a `load!' call to throw an error if the file doesn't exist: ;; If you don't want a `load!' call to throw an error if the file doesn't exist:
(load! "~/.maynotexist" nil t) (load! "~/.maynotexist" nil t)

View file

@ -532,7 +532,7 @@ relative to `org-directory', unless it is an absolute path."
'("wolfram" . "https://wolframalpha.com/input/?i=%s") '("wolfram" . "https://wolframalpha.com/input/?i=%s")
'("doom" . "https://github.com/hlissner/doom-emacs/%s") '("doom" . "https://github.com/hlissner/doom-emacs/%s")
`("emacsdir" . ,(doom-path doom-emacs-dir "%s")) `("emacsdir" . ,(doom-path doom-emacs-dir "%s"))
`("doomdir" . ,(doom-path doom-private-dir "%s"))) `("doomdir" . ,(doom-path doom-user-dir "%s")))
(+org-define-basic-link "org" 'org-directory) (+org-define-basic-link "org" 'org-directory)
(+org-define-basic-link "doom" 'doom-emacs-dir) (+org-define-basic-link "doom" 'doom-emacs-dir)

View file

@ -8,7 +8,7 @@
;; is restored. ;; is restored.
(defvar +eshell-config-dir (defvar +eshell-config-dir
(expand-file-name "eshell/" doom-private-dir) (expand-file-name "eshell/" doom-user-dir)
"Where to store eshell configuration files, as opposed to "Where to store eshell configuration files, as opposed to
`eshell-directory-name', which is where Doom will store temporary/data files.") `eshell-directory-name', which is where Doom will store temporary/data files.")

View file

@ -45,7 +45,7 @@ Can be a list of backends; accepts any value `company-backends' accepts.")
lsp-vetur-global-snippets-dir lsp-vetur-global-snippets-dir
(expand-file-name (expand-file-name
"vetur" (or (bound-and-true-p +snippets-dir) "vetur" (or (bound-and-true-p +snippets-dir)
(concat doom-private-dir "snippets/"))) (concat doom-user-dir "snippets/")))
lsp-xml-jar-file (expand-file-name "org.eclipse.lsp4xml-0.3.0-uber.jar" lsp-server-install-dir) lsp-xml-jar-file (expand-file-name "org.eclipse.lsp4xml-0.3.0-uber.jar" lsp-server-install-dir)
lsp-groovy-server-file (expand-file-name "groovy-language-server-all.jar" lsp-server-install-dir)) lsp-groovy-server-file (expand-file-name "groovy-language-server-all.jar" lsp-server-install-dir))

View file

@ -69,7 +69,7 @@ Possible values:
:action bookmark-jump) :action bookmark-jump)
("Open private configuration" ("Open private configuration"
:icon (all-the-icons-octicon "tools" :face 'doom-dashboard-menu-title) :icon (all-the-icons-octicon "tools" :face 'doom-dashboard-menu-title)
:when (file-directory-p doom-private-dir) :when (file-directory-p doom-user-dir)
:action doom/open-private-config) :action doom/open-private-config)
("Open documentation" ("Open documentation"
:icon (all-the-icons-octicon "book" :face 'doom-dashboard-menu-title) :icon (all-the-icons-octicon "book" :face 'doom-dashboard-menu-title)