Subject: Re: bug#64198: Feature request: compile.el's "Find this in" prompt should be hookable.

From: Eli Zaretskii <[email-masked]>
Date: Thu, 22 Jun 2023 20:23:45 +0300

> From: Dave Abrahams <[email-masked]>
> Date: Thu, 22 Jun 2023 10:11:29 -0700
> Cc: [email-masked]
> 
> > On Jun 22, 2023, at 10:02 AM, Eli Zaretskii <[email-masked]> wrote:
> > 
> >> From: Dave Abrahams <[email-masked]>
> >> Date: Wed, 21 Jun 2023 09:09:08 -0700
> >> Cc: [email-masked]
> >> 
> >> Before discussing patches, could you please describe your situation?
> >> Specifically, how does it happen that neither the compilation
> >> directory plus the file name shown by the diagnostics nor the search
> >> of compilation-search-path succeed to locate the file?  And what would
> >> the hook function you suggest adding do to resolve this, i.e. how
> >> would it know where to look for the file?
> >> 
> >> When Swift asserts, it doesn't write the path to the file into the output, because… reasons I grudgingly
> >> accept.  So one needs to guess at the file.  https://github.com/apple/swift/issues/66777 contains all the
> >> details, but if you want additional info, please ask.
> > 
> > I don't know what Swift is, and that issue talks about something
> > called #fileID, which I again have no idea about.  So yes, please do
> > elaborate, and TIA.
> 
> Swift is a programming language.  When its assertions (like C's assert() macro) fail, a diagnostic is output with a file ID and line. The file ID looks like a path, but it's really not. If it's a path in the filesystem, that's coincidental but it's likely to point to the right file.  I don't want to manually hunt down the file every time an assertion fails; I'd rather emacs made an educated guess based on the current project.  It's obviously not the right answer for everyone, but I'd like to have the hooks needed to implement that without too much hackery.

I'm okay with adding a hook function which will be called from
compilation-find-file if compilation-find-file-1 fails to find the
file.  But I must say that you are trying to use compilation-mode in a
situation for which it was never been designed to be used.