[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28910: 27.0.50; Equivalent to __FILE__
From: |
Stefan Monnier |
Subject: |
bug#28910: 27.0.50; Equivalent to __FILE__ |
Date: |
Mon, 10 May 2021 12:59:40 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Phillip Lord [2017-11-02 17:53:56] wrote:
> Philipp Stephani <p.stephani2@gmail.com> writes:
>> Stefan Monnier <monnier@iro.umontreal.ca> schrieb am Fr., 20. Okt. 2017 um
>> 14:42 Uhr:
>>> We should provide some `current-source-file-name` function which macros
>>> can use to find get the name of the source file in which they were invoked.
>> `f-this-file' from the `f' package is some prior art, but I guess it also
>> doesn't work correctly with macros.
> emacs-load-relative uses the name "__FILE__" for the same thing.
Emacs's `master` now has the `macroexp-file-name` function which
provides this functionality. So I guess `emacs-load-relative` could now
redefine __FILE__ as
(defmacro __FILE__ () (macroexp-file-name))
tho oddly it seems that it defines `__FILE__` as a function rather than
a macro, so maybe it should be
(defalias '__FILE__ #'macroexp-file-name)
but that doesn't match the semantics I expect from something called
`__FILE__`.
In any case, my original request is now satisfied, so I'm closing this.
Stefan
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#28910: 27.0.50; Equivalent to __FILE__,
Stefan Monnier <=