From f4acb3cefd0bcf3f8f1544423149ba19dc90dd7b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 23 Oct 2019 04:24:06 -0400 Subject: [PATCH] New add-load-path! convenience macro --- core/core-lib.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/core-lib.el b/core/core-lib.el index 90e1fe56c..c6ff2ab27 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -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.