fix(lib): void-function macroexp-file-name error

This function was introduced in Emacs 28.1, so 7e0c2ed was a breaking
change for 27.x users.

Fix: #6766
Amend: 7e0c2ed8a3
This commit is contained in:
Henrik Lissner 2022-09-10 13:02:41 +02:00
parent 7e931ec586
commit eb80d461df
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -245,10 +245,14 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions."
(defmacro file! () (defmacro file! ()
"Return the file of the file this macro was called." "Return the file of the file this macro was called."
(or (macroexp-file-name) (or
load-file-name ;; REVIEW: Use `macroexp-file-name' once 27 support is dropped.
buffer-file-name ; for `eval' (let ((file (car (last current-load-list))))
(error "file!: cannot deduce the current file path"))) (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")))
(defmacro dir! () (defmacro dir! ()
"Return the directory of the file this macro was called." "Return the directory of the file this macro was called."