New add-load-path! convenience macro

This commit is contained in:
Henrik Lissner 2019-10-23 04:24:06 -04:00
parent e1622142ed
commit f4acb3cefd
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -199,6 +199,14 @@ If FETCHER is a function, ELT is used as the key in LIST (an alist)."
elt)
,list)))
(defmacro add-load-path! (&rest dirs)
"Add DIRS to `load-path', relative to the current file.
The current file is the file from which `add-to-load-path!' is used."
`(let ((default-directory ,(dir!))
file-name-handler-alist)
(dolist (dir (list ,@dirs))
(cl-pushnew (expand-file-name dir) load-path))))
(defmacro add-transient-hook! (hook-or-function &rest forms)
"Attaches a self-removing function to HOOK-OR-FUNCTION.