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
Doom Emacs.")
(defvar +private-modules-path
(expand-file-name "modules/" +private-config-path)
"The path to your private, external modules. This will be symlinked to
external/ in `doom-modules-dir'.")
(defvar +private-module-prefix "private"
"TODO")
(defvar +private-symlink-path
(expand-file-name "private" doom-modules-dir)
"Where the place the symbolic link to the private modules directory.")
;; Ensure `doom//reload-autoloads', `doom//byte-compile' and
;; `doom-initialize-packages' all include this module in their operations.

View file

@ -1,14 +1,14 @@
;; -*- no-byte-compile: t; -*-
;;; config/private/packages.el
(when (file-directory-p +private-modules-path)
;; 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 symlink)
(not (file-symlink-p symlink)))
(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'.
(if (and (file-directory-p +private-symlink-path)
(not (file-symlink-p +private-symlink-path)))
(lwarn "config/private" :warning
"modules/%s already exists; can't create symlink" +private-module-prefix)
(make-symbolic-link +private-modules-path symlink t))))
"modules/%s already exists; can't create symlink" +private-symlink-path)
(make-symbolic-link modules-path +private-symlink-path t))))
;;
(load (expand-file-name "packages.el" +private-config-path)