config/private: refactor symlink code

This commit is contained in:
Henrik Lissner 2018-02-15 03:39:12 -05:00
parent 0e6540fb8f
commit 8ca4fbd8fe
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 10 additions and 14 deletions

View file

@ -7,13 +7,9 @@
"The directory that serves as the root of your external private config for "The directory that serves as the root of your external private config for
Doom Emacs.") Doom Emacs.")
(defvar +private-modules-path (defvar +private-symlink-path
(expand-file-name "modules/" +private-config-path) (expand-file-name "private" doom-modules-dir)
"The path to your private, external modules. This will be symlinked to "Where the place the symbolic link to the private modules directory.")
external/ in `doom-modules-dir'.")
(defvar +private-module-prefix "private"
"TODO")
;; Ensure `doom//reload-autoloads', `doom//byte-compile' and ;; Ensure `doom//reload-autoloads', `doom//byte-compile' and
;; `doom-initialize-packages' all include this module in their operations. ;; `doom-initialize-packages' all include this module in their operations.

View file

@ -1,14 +1,14 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; config/private/packages.el ;;; config/private/packages.el
(when (file-directory-p +private-modules-path) (let ((modules-path (expand-file-name "modules/" +private-config-path)))
(when (file-directory-p modules-path)
;; automatically symlinks your private modules to `doom-modules-dir'. ;; automatically symlinks your private modules to `doom-modules-dir'.
(let ((symlink (expand-file-name +private-module-prefix doom-modules-dir))) (if (and (file-directory-p +private-symlink-path)
(if (and (file-directory-p symlink) (not (file-symlink-p +private-symlink-path)))
(not (file-symlink-p symlink)))
(lwarn "config/private" :warning (lwarn "config/private" :warning
"modules/%s already exists; can't create symlink" +private-module-prefix) "modules/%s already exists; can't create symlink" +private-symlink-path)
(make-symbolic-link +private-modules-path symlink t)))) (make-symbolic-link modules-path +private-symlink-path t))))
;; ;;
(load (expand-file-name "packages.el" +private-config-path) (load (expand-file-name "packages.el" +private-config-path)