From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How does one find out what file a library has been loaded from? Date: Wed, 20 Jul 2022 11:31:06 -0400 Message-ID: References: <83bktlnuog.fsf@gnu.org> <83sfmxm79z.fsf@gnu.org> <83fsiwncem.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20101"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 20 17:38:02 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 1oEBlx-0004zm-KI for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Jul 2022 17:38:01 +0200 Original-Received: from localhost ([::1]:52184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEBlw-0001Gj-Iw for ged-emacs-devel@m.gmane-mx.org; Wed, 20 Jul 2022 11:38:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38298) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEBfZ-0000A9-17 for emacs-devel@gnu.org; Wed, 20 Jul 2022 11:31:25 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43664) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEBfW-0006DQ-60; Wed, 20 Jul 2022 11:31:24 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B50EF100154; Wed, 20 Jul 2022 11:31:19 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id BCD31100120; Wed, 20 Jul 2022 11:31:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1658331077; bh=xazN7NP3StOWS9J0qv0fHsL2rYJagVo0FbtJS0FGhCs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=T7FbwfvSUjmvy1hVsI5vqnEvQ8xqOUt30iZNeb07e7dIy0LGZbZlKUfhJW6xQIKkX /M4Yaa4WEAuyE6qv+HHoz13wd5RPfIiaXbNeZ4/C8PHzepIRSDoEmkAi0CEtkkwDB9 WfTnnU/fIBbcrZxVo5uDJRqJ39bbOh3QSIhhIDlSglqwUFrFqmr8ppUQeaqanUp8AQ Lt+3K6lNwpmcxfoDfukqPR+xdjtn6hGXvBTScPi+JiHtGe6sYnQskCLXBDr3/KbZHl kEcVt1CL2BeT1EuL3vtPakqMoy4tUyv1WjSsKvI3ErUh/up3nqwATAG4WgQ+6SuKlI XpLkPt0GAcjow== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A89C312023D; Wed, 20 Jul 2022 11:31:17 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Wed, 20 Jul 2022 11:47:11 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:292307 Archived-At: >> If you want to do that, just knowing what was actually loaded won't >> help you, because you will have to actually _prevent_ Emacs from >> loading the .eln files, and that's not easy and currently not really >> supported on the user level, at least not conveniently. So you will >> have to rename directories and stuff, and once you are there, >> load-history is the last thing you will worry about, because you will >> know in advance what Emacs loads, as you force it to do that yourself. > > Yes. I don't think this is good. AFAIK we all agree on that. Complaining about it won't help. >> Andrea gave you one way; I gave another. None of them is difficult, >> please don't exaggerate. > > There's nothing particularly difficult in any of Emacs if you're prepared > to put in the time and energy to find out about it. The method Andrea > gave is not easy to remember, and (having looked for it) is not to be > found in the Elisp manual. It involves the obscure undocumented > abstraction "native compilation unit". But it is certainly a lot better > than no method at all. Designing a better method will need to know what is the intended use. IIUC your main purpose is to check whether you're running source code, byte-code, or native code, and for that you shouldn't look for a file name and infer the result from the file name (which could be misleading: a .elc can contain non-byte code, and a .eln can contain byte-code (and source code as well)) but instead you're better off checking with `byte-code-function-p` and `subrp` (or `subr-native-elisp-p`). > These other ways jar horribly with what used to be the philosophy (I know > you don't like the word) of Emacs, of being open and honest with users. Hi Alan. I'm Stefan, and this is Eli. The same guys you've known for, what, 20 years? It's not like we changed philosophy along the way. As the email to which you replied explained it's just that maintaining backward compatibility prevented us from making the information available in "the obvious way". The info is still very much available out in the open, tho. And we're still interested in figuring out *how* to make it more easily available. Andrea did a great job integrating the native compiler while trying to preserve compatibility. But it's not like this is the end of the story: we can and should definitely improve it (maybe starting with `describe-function`). > I shouldn't have to use obscure workarounds to discover what should be > open and obvious. So, please help us. You're venting your frustration, but we suffer from those issues (rather than benefit from them) just like you do. > I will set about amending the doc string and manual entry for > load-history. Thanks, Stefan