Subject: Re: bug#71522: 29.2.50; Allow associating module symbols with defining files

From: Eli Zaretskii <[email-masked]>
Date: Wed, 12 Jun 2024 19:54:05 +0300

> From: Spencer Baugh <[email-masked]>
> Date: Wed, 12 Jun 2024 11:12:30 -0400
> 
> 
> It's currently impossible to associate a symbol defined by a module with
> the source file which actually defined that symbol.
> 
> 1. Make any native module whatsoever, defining any Lisp symbols at all
> 2. emacs -Q -l ./your-native-module.so
> 3. (symbol-file your-native-module-symbol) yields "your-native-module.so"
> 4. If it's a function:
>    C-h f your-native-module-symbol RET
> 5. Observe that it says "your-native-module.so" defines this function,
>    and that jumping to the source via the link or "s" drops you in
>    your-native-module.so.

I'm guessing that what Emacs knows is the directory and the file name
from which it loaded the module.  If we want to be able to find the
source file, that information needs to be recorded somewhere inside
the module, otherwise there's no way Emacs could reliably find the
sources, since the module could be stripped of all the symbolic debug
info.  Suggestions for how to implement that are welcome.