diff --git a/README.md b/README.md index b79a6708..0ffbf74b 100644 --- a/README.md +++ b/README.md @@ -995,6 +995,19 @@ your `~/.emacs.d` are always first in each respective tapped list. Each tapped list is processed (each file from it is loaded) as a replacement for a respective [Local file](#local-files). +Note that Exordium doesn't add any directory to a load path. If your tap expects +that it's directory tree is in load path, you can use the following code to +update the load-path: + +```lisp +(eval-when-compile + (unless (featurep 'init-require) + (load (file-name-concat (locate-user-emacs-file "modules") "init-require")))) +(exordium-require 'init-lib) +(when (bound-and-true-p load-file-name) + (exordium-add-directory-tree-to-load-path (file-name-directory load-file-name))) +``` + Exordium-specific emacs functions are WIP. ### Preferences diff --git a/init.el b/init.el index eb9e43c2..0e16fc49 100644 --- a/init.el +++ b/init.el @@ -112,21 +112,10 @@ Set to stable melpa.org if you want stable.") (defvar exordium-tapped-after-init-files () "All tapped after init files, including master one.") -(defun exordium--add-directory-tree-to-load-path (dir &optional ignore-if-absent) - "Add DIR and all its subdirs to the load path. -Warn if DIR is not a directory and IGNORE-IF-ABSENT is nil." - (cond ((file-directory-p dir) - (add-to-list 'load-path dir) - (let ((default-directory dir)) - (normal-top-level-add-subdirs-to-load-path))) - ((not ignore-if-absent) - (warn "Missing directory: %s" dir)))) - (when (file-accessible-directory-p exordium-taps-root) (dolist (tap (nreverse (directory-files exordium-taps-root t "^[^\.].*"))) (when (file-accessible-directory-p tap) - (exordium--add-directory-tree-to-load-path tap) ;; @todo: remove? (when-let* ((tapped (file-name-concat tap exordium-before-init)) ((file-readable-p tapped))) (add-to-list 'exordium-tapped-before-init-files tapped)) @@ -149,8 +138,6 @@ Warn if DIR is not a directory and IGNORE-IF-ABSENT is nil." (when (file-readable-p exordium-custom-file) (add-to-list 'exordium-tapped-after-init-files exordium-custom-file)) -(exordium--add-directory-tree-to-load-path exordium-local-dir t) - ;; Bind this early, and only if it has not been bound already, ;; so customisation from other places (i.e., before-init files) ;; are not overwritten. diff --git a/modules/init-lib.el b/modules/init-lib.el index 1fc0850a..a37039ef 100644 --- a/modules/init-lib.el +++ b/modules/init-lib.el @@ -45,6 +45,16 @@ Input is a string and output is a list of strings." "Return the path of the DIR's parent directory." (file-name-directory (directory-file-name dir))) +(defun exordium-add-directory-tree-to-load-path (dir &optional ignore-if-absent) + "Add DIR and all its subdirs to the load path. +Warn if DIR is not a directory and IGNORE-IF-ABSENT is nil." + (cond ((file-directory-p dir) + (add-to-list 'load-path dir) + (let ((default-directory dir)) + (normal-top-level-add-subdirs-to-load-path))) + ((not ignore-if-absent) + (warn "Missing directory: %s" dir)))) + ;;; String manipulation functions