;; This is used in `macroexp-file-name' to make sure that
;; loading file A which does (byte-compile-file B) won't
;; cause macro calls in B to think they come from A.
- (load-file-name nil)
+ (current-load-list (list nil))
)
,@body))
to find the file in which the macro's call was found, and it should be
reliable as well when used at the top-level of a file.
Other uses risk returning non-nil value that point to the wrong file."
- (or load-file-name (bound-and-true-p byte-compile-current-file)))
+ ;; `eval-buffer' binds `current-load-list' but not `load-file-name',
+ ;; so prefer using it over using `load-file-name'.
+ (let ((file (car (last current-load-list))))
+ (or (if (stringp file) file)
+ (bound-and-true-p byte-compile-current-file))))
(defvar macroexp--warned (make-hash-table :test #'equal :weakness 'key))