Subject: bug#55038: 29.0.50; Does macroexp-file-name return nil unnecessarily?

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 21 Apr 2022 13:57:19 +0200

Philip Kaludercic <[email-masked]> writes:

> Consider a macro like
>
>         (defmacro foo ()
>           `(message "Defined in %s" ,(macroexp-file-name)))
>
> Why does this expand to
>
>         (message "Defined in %s" nil)
>
> when evaluated directly in a file (say using `eval-buffer' or
> `eval-last-sexp`).  Shouldn't it be fair to return the file name of the
> buffer, if nothing else can be used:

[...]

> Or is there something that would go wrong in that case?

Such a change sounds like a good one to me, but perhaps there's a good
reason it works the way it does today.  Perhaps Stefan has a comment;
added to the CCs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no