From 4ca5819532a440575411462f986b3844d987f549 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 11 Sep 2024 14:12:04 -0400 Subject: [PATCH] fix(lib): file!: lower current-load-list priority Also changes it to consider base buffer's filename (for `eval` contexts). --- lisp/doom-lib.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lisp/doom-lib.el b/lisp/doom-lib.el index 6a354c28c..e8418b11f 100644 --- a/lisp/doom-lib.el +++ b/lisp/doom-lib.el @@ -312,14 +312,13 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions." (defmacro file! () "Return the file of the file this macro was called." - (or - ;; REVIEW: Use `macroexp-file-name' once 27 support is dropped. - (let ((file (car (last current-load-list)))) - (if (stringp file) file)) - (bound-and-true-p byte-compile-current-file) - load-file-name - buffer-file-name ; for `eval' - (error "file!: cannot deduce the current file path"))) + (or (bound-and-true-p byte-compile-current-file) + load-file-name + (buffer-file-name (buffer-base-buffer)) ; for `eval' + ;; REVIEW: Use `macroexp-file-name' once 27 support is dropped. + (let ((file (car (last current-load-list)))) + (if (stringp file) file)) + (error "file!: cannot deduce the current file path"))) (defmacro dir! () "Return the directory of the file in which this macro was called."