From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Xiyue Deng Newsgroups: gmane.emacs.devel Subject: Re: Question regarding load-path handling for ELPA packages Date: Fri, 17 May 2024 09:30:19 -0700 Message-ID: <87eda0765g.fsf@debian-hx90.lan> References: <878r0ifjmt.fsf@debian-hx90.lan> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2049"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 17 18:31:03 2024 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 1s80U2-0000Hk-2p for ged-emacs-devel@m.gmane-mx.org; Fri, 17 May 2024 18:31:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s80Tc-0001mN-2G; Fri, 17 May 2024 12:30:36 -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 1s80TT-0001l7-B4 for emacs-devel@gnu.org; Fri, 17 May 2024 12:30:33 -0400 Original-Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s80TQ-0005el-1Z for emacs-devel@gnu.org; Fri, 17 May 2024 12:30:26 -0400 Original-Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-1e83a2a4f2cso11812535ad.1 for ; Fri, 17 May 2024 09:30:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715963422; x=1716568222; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=ad3aEZm75Jfhd8eH9x7NUZwq802YR4SSHREkLSfsm3o=; b=eKS2fQjB6aVvHSB0QeSFKerWMOLQKC7i16hZEMnHvk9gEyVc8Xke+VP0NZA7rhXTM0 U4kdARFAJDTPyL0zUrekMaUbsQGdFS7SnskU8us8nrr40YuWwHsfXs9jbHsqd2IGI1Zb Y9gCPFn0DMM74qVFnIL9guwTKuwFS2CpG+zBZtxxYKWwoHodjCv+KgWFTyQ2Ihq6kfey Cn/JaXNjPTt6QsdBdlAUoZzbQmZXaPucGxO6xyDwVrUlcJXPUkK8pTjLcPn9gCI21jBB DSxOLqyOxuso642tx9dCy01G2AUxrB6LAWftFhM6OW3AFZA3YerrtQt+sqD6V53FYxgS nU/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715963422; x=1716568222; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ad3aEZm75Jfhd8eH9x7NUZwq802YR4SSHREkLSfsm3o=; b=u1yvnwNriKiYNZpfyZZhX48+PHBtX6GMWRQABj33YKLW49wGxgwpKywCeECjVWbjQD XIdlhcLgs585Wr5GJBFIWzXi5XJiIcc7K5nQmSSopyoK+vIRsRr0WzMoW1QviLT8YbAJ Ctfcsl+Tm7tkRmdzSbRqMHywrrrp9D0ixPyxNHruNd0piur5tSa8jhLJR9Lsh+ah1Dbl BV9GkzuznrN8eKQcoXP0q+8JC5Fpa7ao1wtA8tv1ODMSLqnbvkJKi35hNcqPOrHK6llO fDcAcTOPqKmQOaVVKp2F7al1hUfp6mBU9eyOC3lgame4QdK9X0OrLzAIO9xqEKFopwCw QGfQ== X-Gm-Message-State: AOJu0YwfndFGONV0qfTS3HmZcfYqbqa0oibMECmI2CHJFhyijgr/pndU sUG6NY8794Ki9POWWZZ5+fpV34sY68O9t177nFS/7spojdWUzSOMSJTHcg== X-Google-Smtp-Source: AGHT+IH89XS9HPlHnGUdIIO7/APgPgq3GzaZYjjb4aojLgFg/g8O/8H4y+n3Ef6PHervNdXg0noj1g== X-Received: by 2002:a17:902:f812:b0:1eb:1474:5ef5 with SMTP id d9443c01a7336-1ef43d2ea72mr168717665ad.33.1715963421633; Fri, 17 May 2024 09:30:21 -0700 (PDT) Original-Received: from debian-hx90 ([2603:8000:a400:cdc:9b10:a920:1cd4:c01]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0c0374ffsm158975755ad.220.2024.05.17.09.30.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 09:30:20 -0700 (PDT) In-Reply-To: <878r0ifjmt.fsf@debian-hx90.lan> (Xiyue Deng's message of "Thu, 09 May 2024 20:09:14 -0700") Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=manphiz@gmail.com; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:319327 Archived-At: Xiyue Deng writes: > (I'm not sure whether this is the right mailing list for this kind of > question. Please help redirect if possible.) > > Hi, > > I would like to understand how package.el handles `load-path' of > installed ELPA packages. As I observe from load-path after ELPA > packages are initialized, it looks like only the package installation > root path is added to `load-path', but not any of the nested directory. > > For example, if an addon `elpafoo` has a nested `elpabar' directory, as > in the following example: > > ,---- > | ~/.config/emacs/elpa/elpafoo/ > | ~/.config/emacs/elpa/elpafoo/elpafoo.el > | ~/.config/emacs/elpa/elpafoo/elpabar > | ~/.config/emacs/elpa/elpafoo/elpabar/elpabar.el > `---- > > For such a package, both `elpafoo.el' and `elpabar/elpabar.el' will be > byte-compiled, but only `~/.config/emacs/elpa/elpafoo' is added to > `load-path', not `~/.config/emacs/elpa/elpafoo/elpabar'. > > I was trying to find in package.el source where this is handled but > cannot seem to have a definite answer. So I wonder whether my current > understanding is correct? Is this going to be the case forward? And if > possible which code path is handling this logic? > > To give a little more background (probably long), I was studying dh-elpa > which is Debian's tool that handles Emacs addons in a similar fashion as > how ELPA packages are handled, which among other things handles the byte > compiling of the source files to generate *.elc files. Up to now, > dh-elpa doesn't support nested directories, so if an addon has *.el in a > nest directory they won't be byte-compiled. This has been working well > up-to-now, but I noticed that some ELPA packages (e.g. auctex) have > nested directories and handled like I mentioned above, which dh-elpa > ignores. I tried to add nested directory handling, which handles the > package installation under `/usr/share/emacs/site-lisp/elpa' and somehow > all nested directories are added to `load-path' as well (it's adding > this directory to package-directory-list but I'm not sure whether this > is the reason of the nested directories being added to `load-path'). > Normally this should not be a problem, but for the case of auctex, it > has some source files under `style/' named `url.el', `array.el', etc., > which collide with system packages and they don't have any `(provide > 'foo)' declared in the source files. So in my Emacs installation, in > which I use eglot-ensure in all prog-mode, eglot was broken as it tries > to load those alternative url.el, array.el and so on instead of the ones > shipped in Emacs, and as they don't have the corresponding `provide', it > causes error and Emacs will stop processing further. > > Sorry this is getting a lot longer that it was supposed to be. So in > the end I have the following questions: > > * For ELPA package installed through package.el, should only the > installation root path be added to `load-path'? > - Or recursively add nested directories will also be considered in the > future? > > * If it happens to be the latter case, is there any guidelines for > packages to avoid potential name collision? > > * Would someone kindly provide some pointer to how `load-path' is being > handled as my rusty Elisp is preventing me to fully understand this. > > Thanks for reading this unexpectedly (maybe unnecessarily) long post, > and looking forward to any insights. Friendly ping. If this mailing list is not a good place for this question, can someone point me to a better one? Thanks in advance! -- Xiyue Deng