emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How does one find out what file a library has been loaded from?


From: Eli Zaretskii
Subject: Re: How does one find out what file a library has been loaded from?
Date: Sun, 24 Jul 2022 18:37:10 +0300

> Date: Sun, 24 Jul 2022 15:16:46 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> In general, you can use load-history or symbol-file to know which file
> was loaded.  If load-history says it was a .elc file, and the build
> supports native compilation, you need to see if the function was
> natively-compiled, using
> 
>     (subr-native-elisp-p (symbol-function FUNC))
> 
> where FUNC is a function's symbol.  If the above returns non-nil, then
> comp-el-to-eln-rel-filename will produce the base name of the .eln
> file corresponding to a .el file.
> 
> The above are the building blocks; what's left is to use them in a
> particular case.

Btw, we could extend symbol-file to support a new kind of TYPE arg,
to ask about a natively-compiled symbol, and then we could return the
.eln file instead of the .elc file, when appropriate.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]