From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: How does one find out what file a library has been loaded from? Date: Mon, 1 Aug 2022 19:31:47 +0000 Message-ID: References: <83bktlnuog.fsf@gnu.org> <83ilnmfq9t.fsf@gnu.org> <83ilnd4f72.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4243"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Andrea Corallo , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 01 21:34:03 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIbAv-0000qL-GJ for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Aug 2022 21:34:01 +0200 Original-Received: from localhost ([::1]:38298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oIbAu-0004uS-JC for ged-emacs-devel@m.gmane-mx.org; Mon, 01 Aug 2022 15:34:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37228) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oIb8s-0003uK-0x for emacs-devel@gnu.org; Mon, 01 Aug 2022 15:31:54 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:36598 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1oIb8p-0006sU-O5 for emacs-devel@gnu.org; Mon, 01 Aug 2022 15:31:53 -0400 Original-Received: (qmail 93126 invoked by uid 3782); 1 Aug 2022 19:31:48 -0000 Original-Received: from acm.muc.de (p4fe15d10.dip0.t-ipconnect.de [79.225.93.16]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 01 Aug 2022 21:31:47 +0200 Original-Received: (qmail 7679 invoked by uid 1000); 1 Aug 2022 19:31:47 -0000 Content-Disposition: inline In-Reply-To: <83ilnd4f72.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:292964 Archived-At: Hello, Eli. On Sun, Jul 31, 2022 at 15:52:33 +0300, Eli Zaretskii wrote: > > From: Andrea Corallo > > Cc: acm@muc.de, emacs-devel@gnu.org > > Date: Sun, 24 Jul 2022 17:46:02 +0000 > > >> (native-comp-unit-file (subr-native-comp-unit (symbol-function #'find-file))) > > > Andrea, does anything similar to subr-native-comp-unit exists for > > > other types of symbols accepted by symbol-file: defvar and defface? > > No it does not exists. > > The reason why the compilation unit concept was introduced is to have > > the GC capable of unloading the eln when possible, this mechanism is > > only related to functions that are indeed memory mapped from the loaded > > shared libraries. Variables etc are just regular variables (tipically > > defined at eln load time) so they didn't required any new mechanism. > > > If not, then the only way to produce the same information for them > > > would be to generate the base name of the .eln file with > > > comp-el-to-eln-rel-filename, and then look for that file along > > > native-comp-eln-load-path, right? > > Yes I think so. > Andrea and Alan, please review and test the version of symbol-file > below that I intend to install soon. TIA. Sorry to have taken so long. I've deliberately avoided reading Andrea's response. This is brilliant! It seems to work for me flawlessly. There's just one slight mistake: [ .... ] > If NATIVE-P is nil, and SYMBOL was loaded from a .eln file, this > function will return the absolute file name of that .eln file, > if found. That should surely read "If NATIVE-P is non-nil, ....". ^^^^ [ .... ] -- Alan Mackenzie (Nuremberg, Germany).