From ba0326fc9736727e2fd69bf49cf3ca94d48242a0 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 21 Feb 2023 03:24:58 -0500 Subject: [PATCH] perf(lib): dir!: unset file-name-handler-alist file-name-directory consults this variable for alternative strategies, which is unnecessary work. (file!) won't (and should never be used in any context where it could) return anything but a simple file path. --- lisp/doom-lib.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/doom-lib.el b/lisp/doom-lib.el index fb1bd6ef0304..9821e64f23d2 100644 --- a/lisp/doom-lib.el +++ b/lisp/doom-lib.el @@ -303,7 +303,8 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions." (defmacro dir! () "Return the directory of the file this macro was called." - (file-name-directory (macroexpand '(file!)))) + (let (file-name-handler-alist) + (file-name-directory (macroexpand '(file!))))) ;; REVIEW Should I deprecate this? The macro's name is so long... (defalias 'letenv! 'with-environment-variables)