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: Tue, 19 Jul 2022 17:07:09 +0000 Message-ID: References: <83bktlnuog.fsf@gnu.org> <83sfmxm79z.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="24101"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 19 19:54:36 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 1oDrQZ-0006B5-Q7 for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Jul 2022 19:54:35 +0200 Original-Received: from localhost ([::1]:46060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDrQY-0001Y1-PH for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Jul 2022 13:54:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDqgk-000524-Uz for emacs-devel@gnu.org; Tue, 19 Jul 2022 13:07:15 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:41375 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1oDqgi-0003dN-Q6 for emacs-devel@gnu.org; Tue, 19 Jul 2022 13:07:14 -0400 Original-Received: (qmail 74742 invoked by uid 3782); 19 Jul 2022 17:07:10 -0000 Original-Received: from acm.muc.de (p4fe15b1b.dip0.t-ipconnect.de [79.225.91.27]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 19 Jul 2022 19:07:10 +0200 Original-Received: (qmail 26550 invoked by uid 1000); 19 Jul 2022 17:07:09 -0000 Content-Disposition: inline In-Reply-To: <83sfmxm79z.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:292285 Archived-At: Hello, Eli. On Tue, Jul 19, 2022 at 18:50:00 +0300, Eli Zaretskii wrote: > > Date: Tue, 19 Jul 2022 15:01:12 +0000 > > Cc: emacs-devel@gnu.org > > From: Alan Mackenzie > > > What do you like to find? whether it was loaded from cc-engine.elc or > > > cc-engine-XXXXXX.eln? > > Exactly that, yes. > > > If so, why does it matter? [ .... ] > > A further point is that Emacs should not deceive its users. > It doesn't. It most assuredly does. The doc string for load-history says that FILE-NAME is the name of a file that has been loaded into Emacs. This is untrue. What is true is that it is the "NOTIONAL" file that has been loaded into Emacs.... or that it is the name of the source file with a "c" appended. When the function of load-history was changed, why was its doc string not amended? (Yes, I am volunteering to take on this task.) > > There's the point that if you're doing benchmark timings, the > > results are meaningless if you don't know what you're timing. > You are timing compiled Lisp code. How exactly was it compiled > shouldn't matter _in_principle_, .... You might well want to compare the speed of byte compiled code with the same source native compiled, as many of us have already attempted to do. > .... exactly as you don't have any easy way of knowing what version of > byte-compiler and byte-optimizer was used to produce a .elc file -- > and the differences can be significant. Eli, that's ..... No, I won't write it. > If you do need to make this kind of distinctions, you have to use > "different means". Or do you mean "difficult means"? Let me propose that there should be an easy way of finding this out. > Like disassembly of the byte-code or looking if cc-engine-XXXXXX.eln > file is in your eln-cache, or using "C-h f" on some function from > cc-engine, where Emacs will tell you whether it's byte-compiled or > natively-compiled (you can also use subr-native-elisp-p directly if > you want). I don't want this. It is clear that load-history no longer supports all its use cases. Andrea has reported that trying to update it lead to too many problems. So, how about a new additional variable called something like load-file-history which would be like load-history, just it would store the name of the source file (if known) as well as the name of the loaded file? In time (?10 years), load-history could be deprecated and eventually superseded. Or, less dramatically, an alist with the notional name in entries' cars, and the actual loaded file name in the cdrs? With this, it would be trivial to find the loaded file name from the information in load-history. -- Alan Mackenzie (Nuremberg, Germany).