Add config/private; for ~/.doom.d & ~/.config/doom support #406
A modules/ submodule will be symlinked to ~/.emacs.d/modules/private.
This commit is contained in:
parent
6d7db48dc1
commit
b3dcba54eb
7 changed files with 133 additions and 36 deletions
23
modules/config/private/README.org
Normal file
23
modules/config/private/README.org
Normal file
|
@ -0,0 +1,23 @@
|
|||
#+TITLE: :config private
|
||||
|
||||
This module enables support for an external private module and nested
|
||||
submodules, either at =~/.doom.d= (or =$XDG_CONFIG_HOME/doom= with the ~+xdg~
|
||||
flag).
|
||||
|
||||
* Table of Contents :TOC:
|
||||
- [[Module Flags][Module Flags]]
|
||||
- [[Features][Features]]
|
||||
- [[Private sub-modules][Private sub-modules]]
|
||||
|
||||
* Module Flags
|
||||
+ ~+xdg~ Tells this module to respect XDG conventions and look for your private
|
||||
config in ~$XDG_CONFIG_HOME/doom~ (falls back to =~/.config/doom=).
|
||||
|
||||
* Features
|
||||
** Private sub-modules
|
||||
Modules placed in the =modules/= subdirectory of your external config are
|
||||
symlinked to =~/.emacs.d/modules/private=, and can be activated from ~doom!~:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(doom! :private private-module1 private-module2 ...)
|
||||
#+END_SRC
|
6
modules/config/private/autoload.el
Normal file
6
modules/config/private/autoload.el
Normal file
|
@ -0,0 +1,6 @@
|
|||
;;; config/private/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload (autoload '+private/find-in-config "config/private/autoload" nil t)
|
||||
(+default--def-find-in! config +private-config-path)
|
||||
;;;###autoload (autoload '+private/browse-config "config/private/autoload" nil t)
|
||||
(+default--def-browse-in! config +private-config-path)
|
4
modules/config/private/config.el
Normal file
4
modules/config/private/config.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
;;; config/private/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(load (expand-file-name "config.el" +private-config-path)
|
||||
'noerror 'nomessage)
|
25
modules/config/private/init.el
Normal file
25
modules/config/private/init.el
Normal file
|
@ -0,0 +1,25 @@
|
|||
;;; config/private/init.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +private-config-path
|
||||
(if (featurep! +xdg)
|
||||
(expand-file-name "doom/" (or (getenv "XDG_CONFIG_HOME") "~/.config"))
|
||||
"~/.doom.d")
|
||||
"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")
|
||||
|
||||
;; Ensure `doom//reload-autoloads', `doom//byte-compile' and
|
||||
;; `doom-initialize-packages' all include this module in their operations.
|
||||
(add-to-list 'doom-extra-module-paths +private-config-path)
|
||||
|
||||
;;
|
||||
(load (expand-file-name "init.el" +private-config-path)
|
||||
'noerror 'nomessage)
|
||||
|
15
modules/config/private/packages.el
Normal file
15
modules/config/private/packages.el
Normal file
|
@ -0,0 +1,15 @@
|
|||
;; -*- 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)))
|
||||
(lwarn "config/private" :warning
|
||||
"modules/%s already exists; can't create symlink" +private-module-prefix)
|
||||
(make-symbolic-link +private-modules-path symlink t))))
|
||||
|
||||
;;
|
||||
(load (expand-file-name "packages.el" +private-config-path)
|
||||
'noerror 'nomessage)
|
Loading…
Add table
Add a link
Reference in a new issue