On Sun, Jan 12, 2025 at 9:43 AM Ihor Radchenko <yantar92@posteo.net> wrote:
 
What if BUFFER is provided, but that buffer is already a base buffer?
Your function will then return file name for _current buffer_, not BUFFER.

Hmmm, I thought I tested that but I can take a look and fix it. 
 

Also, what about other places in the code that use `buffer-file-name'?
We may want to use the new function there as well.

Definitely. There are hundreds of places in the code where the same pattern applies. Per our previous discussion in the thread, though, I thought it would be better to start small and incrementally work through them. If you want me to include more changes,I'm going to need to help sorting all of these out:

❯ rg -q --stats buffer-file-name
185 matches
182 matched lines
 
Thanks for helping to improve the documentation here, but may you (1)
sepearate it into a new patch (this change is not relevant to
`buffer-file-name' bug); (2) maybe give an example of how to set
TEST_NO_AUTOCLEAN.

Sure, I'll do both.
 
This will leave the tangled file lying around.
Please explicitly remove it via
(unwind-protect ...
 (delete-file <tangled-file-name>)

See how `org-test-with-temp-text-in-file' macro does it.

Yes, my apologies, I had originally done this and stashed that part of the change while debugging the test. I'll fix that, too.

Cheers,

Derek

--
+---------------------------------------------------------------+
| Derek Chen-Becker                                             |
| GPG Key available at https://keybase.io/dchenbecker and       |
| Fngrprnt: EB8A 6480 F0A3 C8EB C1E7  7F42 AFC5 AFEE 96E4 6ACC  |
+---------------------------------------------------------------+