Refactor :load-path resolve-from-here advice

This commit is contained in:
Henrik Lissner 2020-06-01 21:06:03 -04:00
parent 6a85417e8e
commit 02542a63d4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -357,16 +357,13 @@ This value is cached. If REFRESH-P, then don't use the cached value."
;; HACK Fix `:load-path' so it resolves relative paths to the containing file, ;; 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 ;; rather than `user-emacs-directory'. This is a done as a convenience
;; for users, wanting to specify a local directory. ;; for users, wanting to specify a local directory.
(defadvice! doom--resolve-load-path-from-containg-file-a (orig-fn &rest args) (defadvice! doom--resolve-load-path-from-containg-file-a (orig-fn label arg &optional recursed)
"Resolve :load-path from the current directory." "Resolve :load-path from the current directory."
:around #'use-package-normalize-paths :around #'use-package-normalize-paths
(let ((arg (cadr args))) ;; `use-package-normalize-paths' resolves paths relative to
(if (and (stringp arg) (not (file-name-absolute-p arg))) ;; `user-emacs-directory', so we change that.
;; `use-package-normalize-paths' resolves relative paths from (let ((user-emacs-directory (if (stringp arg) (dir!))))
;; `user-emacs-directory', so just change that. (funcall orig-fn label arg recursed)))
(let ((user-emacs-directory (dir!)))
(apply orig-fn args))
(apply orig-fn args))))
;; Adds two keywords to `use-package' to expand its lazy-loading capabilities: ;; Adds two keywords to `use-package' to expand its lazy-loading capabilities:
;; ;;