From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71817: 29.3; Sub-directory handling of ELPA package Date: Fri, 28 Jun 2024 09:26:55 -0400 Message-ID: References: <875xtt8jdm.fsf@debian-hx90.lan> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14897"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 71817@debbugs.gnu.org To: Xiyue Deng Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 28 15:28:20 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 1sNBeD-0003VJ-Kr for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 28 Jun 2024 15:28:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNBdz-0006u7-Tu; Fri, 28 Jun 2024 09:28:03 -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 1sNBdy-0006tG-6V for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 09:28:02 -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 1sNBdx-00041H-SS for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 09:28:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sNBdx-00039y-Lv for bug-gnu-emacs@gnu.org; Fri, 28 Jun 2024 09:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 28 Jun 2024 13:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71817 X-GNU-PR-Package: emacs Original-Received: via spool by 71817-submit@debbugs.gnu.org id=B71817.171958122712068 (code B ref 71817); Fri, 28 Jun 2024 13:28:01 +0000 Original-Received: (at 71817) by debbugs.gnu.org; 28 Jun 2024 13:27:07 +0000 Original-Received: from localhost ([127.0.0.1]:44887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNBd5-00038Z-4L for submit@debbugs.gnu.org; Fri, 28 Jun 2024 09:27:07 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36853) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNBd2-000388-13 for 71817@debbugs.gnu.org; Fri, 28 Jun 2024 09:27:05 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 32E8480AD4; Fri, 28 Jun 2024 09:26:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1719581216; bh=PvdsKOaAWEKg4ABGxugXhab6RWy4Kwod21fLEyJ5rj8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ilGZgvee2SKGsd1SI+dMtsL1gB7a2R1PmAo0JDp7MgHE/t1a+go1QsFD/5IKg33jg g2x9zu5nVpmOajbEpb2jFJ497wBxNXl7T4U5xs9RF5L1Ql5B6p+wlhPx6I7hI9zp4b 6HNaqzipvdVmG4ObkXaLI37+OfPb0yhVJD7LenIBXhZEzvo1LFmANJpadZGgl57kKY Jf8z/MUOVWuGcl4abN7E6iI8UFYJev8sLf/8qvFkpRcCpOOPkyTnHkDdsHvbnR3feP ZAEFSOfYbsI+GLWftmQ/c+1bGgs5JULiju77kf9oMv94g1F1cHQp1d7ewIl5fao4sn AEX1CbAIAypzA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id AB17480292; Fri, 28 Jun 2024 09:26:56 -0400 (EDT) Original-Received: from pastel (unknown [45.72.245.253]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 86697120262; Fri, 28 Jun 2024 09:26:56 -0400 (EDT) In-Reply-To: <875xtt8jdm.fsf@debian-hx90.lan> (Xiyue Deng's message of "Fri, 28 Jun 2024 03:13:57 -0700") 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:288070 Archived-At: > Currently as observed, ELPA packages only get their root path added to > `load-path', but source code in sub-directories will still get > byte-compiled. That is, for an ELPA package elpafoo with a nested > sub-directory of the following structure (installed through package.el): The recursive compilation is somewhat of an "accident": it was the easiest to implement (and seemed like a good idea anyway). The `load-path` behavior is conscious: it's easy for a package to add more subdirectories to the `load-path` but it would be much harder to remove undesired ones. [ And of course, the current behavior is also the easiest one to implement. ] > If this is not yet a policy, I wonder whether this will be the path > forward for `load-path' handling. In `elpafoo.el`, include something like: ;;;###autoload (add-to-list 'load-path (expand-file-name "elpabar" (file-name-directory load-file-name))) This assumes that you want `elpabar` to be in your `load-path` right from the start (i.e. that an entry point to your package is in the `elpabar` subdirectory). If `elpabar` can only ever be used from code that's in the `elpafoo` directory, there are other options (such as `(require 'elpabar/elpabar)` or using an auxiliary `elpafoo-loaddefs.el` which you load when `elpafoo.el` is loaded, ... > I see some pros of adding sub-directories recursively, I don't. Most of the packages which use subdirectories have a complex enough layout that some of those directories should not be in `load-path`: it's better to let them add entries "manually" at the appropriate time than to try and do it automatically. The more real problem is that the way `elpafoo-autoloads.el` is created does *not* scan ELisp files in subdirectories. The way this is handled typically in that the ELPA tarball comes with its own `elpabar/elpabar-autoloads.el` file and `elpafoo.el` then needs to contain something like ;;;###autoload (require 'elpabar/elpabar-autoloads) The main downside here is that the current elpa.gnu.org scripts don't know how to build such a `elpabar/elpabar-autoloads.el`, so you either need to store it in the Git (which is ugly since it's a generated file), or use an ad-hoc `:make` rule. IMO we should change the ELPA protocol so that the `elpafoo-autoloads.el` is not created during installation but is instead included in the tarball, so it can be generated any way we like. Stefan