From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jonas Bernoulli via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73792: 30; Confusion in loaddefs-generate--*-prefixes Date: Sat, 26 Oct 2024 17:53:38 +0200 Message-ID: <87ldyaamil.fsf@bernoul.li> References: <87ttdgavfs.fsf@bernoul.li> Reply-To: Jonas Bernoulli Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29239"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73792@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 26 17:54:48 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1t4j7o-0007S7-Ap for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 26 Oct 2024 17:54:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4j7X-0002YR-4T; Sat, 26 Oct 2024 11:54:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4j7V-0002YI-Ay for bug-gnu-emacs@gnu.org; Sat, 26 Oct 2024 11:54:30 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t4j7V-0001bK-1A for bug-gnu-emacs@gnu.org; Sat, 26 Oct 2024 11:54:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=qfbOz/6hqCbno95vhi6Hum9V5rOa7ehMer/Ic5JKO44=; b=XfAJVo5lEug/w0S+DScdTwAlmso9zA0UKHs3fVKUFeJgw47UDFWKs2j0ZAVv0Zwz3ePzgMtcw/TQAeKCzEOG4veHUdTg1moc2uh0Ov1IlJNxc9ehAh8QonyIbd6H6M3uAruZ3TNnfQ7MySE9t5axIVfNl7dG9MCvxBKJE1KDYD+UtDUhlO3Px+Mw1Spg35SJBpv9DctGocdPwJaKD/R623ic0Cr02Hacrd77QDVh17ZKWVh5H4sz0EhbfaSi1ubVVMy6tpEJsHDWpCpscXZ/TbBidAlKfrSHwtp6KUlqoMleZ0dsUchMEH7EfJptQ0CF8uzCcJH20goeadg7Qlc/nQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t4j82-0004QM-GE for bug-gnu-emacs@gnu.org; Sat, 26 Oct 2024 11:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jonas Bernoulli Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Oct 2024 15:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73792 X-GNU-PR-Package: emacs Original-Received: via spool by 73792-submit@debbugs.gnu.org id=B73792.172995806016955 (code B ref 73792); Sat, 26 Oct 2024 15:55:02 +0000 Original-Received: (at 73792) by debbugs.gnu.org; 26 Oct 2024 15:54:20 +0000 Original-Received: from localhost ([127.0.0.1]:42329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4j7L-0004PP-G7 for submit@debbugs.gnu.org; Sat, 26 Oct 2024 11:54:19 -0400 Original-Received: from mail.hostpark.net ([212.243.197.30]:36796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t4j7I-0004PF-UG for 73792@debbugs.gnu.org; Sat, 26 Oct 2024 11:54:18 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.hostpark.net (Postfix) with ESMTP id 2D10716275; Sat, 26 Oct 2024 17:53:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h= content-type:content-type:mime-version:message-id:date:date :references:in-reply-to:subject:subject:from:from; s=sel2011a; t=1729958019; bh=WeOEp8ootxmq/frANCEnBzJa+dMqACBMPO5agfAvLmU=; b= HkgERjZ1lSGzfULWclMJQRUbnIF8dJ04btb/24Z+Ow3eHP2bnKTagC7gShXc0Z30 5QEXh9G/u/GLNcjBpl96OMYJAiArxhY8eGKoWGEGX2t+AQGevnF5c5Cjm4s4cb+S oN/2y8s76pRI280O0UDH6UgOtXlRoNDAeqqb7ULjlls= X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net Original-Received: from mail.hostpark.net ([127.0.0.1]) by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224) with ESMTP id 9Qpyklbb6wKR; Sat, 26 Oct 2024 17:53:39 +0200 (CEST) Original-Received: from customer (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.hostpark.net (Postfix) with ESMTPSA id 41805161E1; Sat, 26 Oct 2024 17:53:38 +0200 (CEST) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294285 Archived-At: Stefan Monnier writes: >> loaddefs-generate--compute-prefixes ignores definitions with an >> autoload cookie: >> >> ,---- >> | (when (save-excursion >> | (goto-char (match-beginning 0)) >> | (or (bobp) >> | (progn >> | (forward-line -1) >> | (not (looking-at ";;;###autoload"))))) >> | (push name prefs)))))) >> `---- >> >> Why?! > > The "symbol prefix" machinery is designed so as to try and give easier > access to those things that Emacs wouldn't know about with it > (i.e. symbols that exist "out there" in some installed packaged but > aren't yet represented in `obarray`). > > Autoloaded functions are presumably already represented in `obarray` > even if the file hasn't yet been loaded. Admittedly, this is not 100% > sure, but that's the reason why the code thinks it can ignore them. > > As for "why bother", well it turns out that it's not completely uncommon > for a package's autoloaded functions to fall outside of the prefix > shared by all other definitions, so skipping them can help improve the > prefix. Examples would be `run-foo` commands where all other functions > use the `foo-` prefix, or even just the common `foo` entry point where > all other definitions use the `foo-` prefix. Makes sense. (I was looking at this code to see if it could be used for this other use-case: collect all prefixes used by "all known" packages. Such a prefix-to-package mapping could be published and checked when new packages are added to some *ELPA, to decrease the odds of conflicts on the symbol level. I had little hope that this code would be suitable for that use-case, but it could have been, so I had a look. And then I figured I might as well report the comment issue and ask about this. I won't be working on this any time soon, since I have too much on my plate already. So if anyone with time on their hands reads this and thinks it is a good idea, please go ahead.) Jonas