From 0787eae27488104c8f6c5f437129fd3be05c0a9b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 1 Jun 2020 18:22:29 -0400 Subject: [PATCH] Expand use-package :load-path relative to containing file --- core/core-modules.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/core-modules.el b/core/core-modules.el index e1ec8ac32..5448ccc87 100644 --- a/core/core-modules.el +++ b/core/core-modules.el @@ -354,6 +354,19 @@ This value is cached. If REFRESH-P, then don't use the cached value." (defun use-package-handler/:magic-minor (name _ arg rest state) (use-package-handle-mode name 'auto-minor-mode-magic-alist arg rest state)) + ;; HACK Fix `:load-path' so it resolves relative paths to the containing file, + ;; rather than `user-emacs-directory'. This is a done as a convenience + ;; for users, wanting to specify a local directory. + (defadvice! doom--resolve-load-path-from-containg-file-a (orig-fn _label arg &optional _recursed) + "Resolve :load-path from the current directory." + :around #'use-package-normalize-paths + (if (and (stringp arg) (not (file-name-absolute-p arg))) + ;; `use-package-normalize-paths' resolves relative paths from + ;; `user-emacs-directory', so just change that. + (let ((user-emacs-directory (dir!))) + (funcall orig-fn args)) + (funcall orig-fn args))) + ;; Adds two keywords to `use-package' to expand its lazy-loading capabilities: ;; ;; :after-call SYMBOL|LIST