GNU bug report logs - #79597
31.0.50; [PATCH] * package.el (package-delete): Remove deleted package from load-path

Previous Next

Package: emacs;

Reported by: Lin Sun <sunlin7 <at> hotmail.com>

Date: Wed, 8 Oct 2025 00:05:02 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 79597 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79597; Package emacs. (Wed, 08 Oct 2025 00:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Lin Sun <sunlin7 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 08 Oct 2025 00:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7 <at> hotmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 31.0.50; [PATCH] * package.el (package-delete): Remove deleted
 package from  load-path
Date: Wed, 8 Oct 2025 00:03:40 +0000
[Message part 1 (text/plain, inline)]
Hi,

The deleted-packages paths had left in load-path after user deleting packages, these non-exists (deleted) paths will lead emacs slow until user restarting the emacs get fresh load-path.

The attached patch will remove the delete-package path from load-path to avoid affection on emacs performance.

Please help review it. Thank you.

[Message part 2 (text/html, inline)]
[0001-package.el-package-delete-Remove-deleted-package-fro.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79597; Package emacs. (Wed, 08 Oct 2025 06:57:02 GMT) Full text and rfc822 format available.

Message #8 received at 79597 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lin Sun <sunlin7 <at> hotmail.com>, Philip Kaludercic <philipk <at> posteo.net>
Cc: 79597 <at> debbugs.gnu.org
Subject: Re: bug#79597: 31.0.50;
 [PATCH] * package.el (package-delete): Remove deleted package from
 load-path
Date: Wed, 08 Oct 2025 09:56:01 +0300
> From: Lin Sun <sunlin7 <at> hotmail.com>
> Date: Wed, 8 Oct 2025 00:03:40 +0000
> 
> The deleted-packages paths had left in load-path after user deleting packages, these non-exists (deleted)
> paths will lead emacs slow until user restarting the emacs get fresh load-path.
> 
> The attached patch will remove the delete-package path from load-path to avoid affection on emacs
> performance.

Is it wise to use string-prefix-p when dealing with directory names?
File names are not simple strings; e.g., on MS-Windows, the two names

     d:/foo/bar
and
     D:\Foo\Bar

specify the same directory, although they are not 'equal' as strings.

You could use file-in-directory-p instead, but it requires the test to
be made before the directory is deleted.  OTOH, why shouldn't
package--delete-directory do this as part of its job? it already
cleans up the *.eln files of the deleted package.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79597; Package emacs. (Wed, 08 Oct 2025 13:34:03 GMT) Full text and rfc822 format available.

Message #11 received at 79597 <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7 <at> hotmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Philip Kaludercic <philipk <at> posteo.net>
Cc: "79597 <at> debbugs.gnu.org" <79597 <at> debbugs.gnu.org>
Subject: Re: bug#79597: 31.0.50; [PATCH] * package.el (package-delete): Remove
 deleted package from load-path
Date: Wed, 8 Oct 2025 13:33:39 +0000
[Message part 1 (text/plain, inline)]
<div class="elementToProof">From:&nbsp;Eli Zaretskii<br>Sent:&nbsp;Tuesday, October 7, 2025 11:56 PM
</div><div class="elementToProof">&gt; You could use file-in-directory-p&nbsp;instead, but it requires the test to&nbsp;</div><div class="elementToProof">&gt; be made before the directory is deleted.&nbsp; OTOH, why shouldn't&nbsp;</div><div class="elementToProof">&gt; package--delete-directory&nbsp;do this as part of its job? it already&nbsp;</div><div class="elementToProof">&gt; cleans up the *.eln files of the deleted package.&nbsp;</div><div class="elementToProof"><br></div><div class="elementToProof">You're right, the file-in-directory-p is better one.</div><div class="elementToProof">And I had moved the changes to package--delete-directory.</div><div class="elementToProof">Please review the attached patch. Thank you!

</div>
[0001-Remove-directory-of-deleted-package-from-the-load-pa.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79597; Package emacs. (Fri, 10 Oct 2025 21:22:01 GMT) Full text and rfc822 format available.

Message #14 received at 79597 <at> debbugs.gnu.org (full text, mbox):

From: Philip Kaludercic <philipk <at> posteo.net>
To: Lin Sun <sunlin7 <at> hotmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 "79597 <at> debbugs.gnu.org" <79597 <at> debbugs.gnu.org>
Subject: Re: bug#79597: 31.0.50; [PATCH] * package.el (package-delete):
 Remove deleted package from load-path
Date: Fri, 10 Oct 2025 21:21:28 +0000
Lin Sun <sunlin7 <at> hotmail.com> writes:

> <div class="elementToProof">From:&nbsp;Eli Zaretskii<br>Sent:&nbsp;Tuesday, October 7, 2025 11:56 PM
> </div><div class="elementToProof">&gt; You could use
> file-in-directory-p&nbsp;instead, but it requires the test
> to&nbsp;</div><div class="elementToProof">&gt; be made before the
> directory is deleted.&nbsp; OTOH, why shouldn't&nbsp;</div><div
> class="elementToProof">&gt; package--delete-directory&nbsp;do this as
> part of its job? it already&nbsp;</div><div
> class="elementToProof">&gt; cleans up the *.eln files of the deleted
> package.&nbsp;</div><div class="elementToProof"><br></div><div
> class="elementToProof">You're right, the file-in-directory-p is better
> one.</div><div class="elementToProof">And I had moved the changes to
> package--delete-directory.</div><div class="elementToProof">Please
> review the attached patch. Thank you!
>
> </div>
>
> From 948b92f08f8ee58139602d257506b9d11b009bbd Mon Sep 17 00:00:00 2001
> From: Lin Sun <sunlin7 <at> hotmail.com>
> Date: Tue, 7 Oct 2025 06:30:20 +0000
> Subject: [PATCH] Remove directory of deleted package from the `load-path'
>
> * lisp/emacs-lisp/package.el (package--delete-directory): Remove to be
> deleted package path from the load-path and update function document.
> ---
>  lisp/emacs-lisp/package.el | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 82fcf439a11..0af49d04484 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -2486,9 +2486,10 @@ package--newest-p
>  (declare-function comp-el-to-eln-filename "comp.c")
>  (defvar package-vc-repository-store)
>  (defun package--delete-directory (dir)
> -  "Delete PKG-DESC directory DIR recursively.
> -Clean-up the corresponding .eln files if Emacs is native
> -compiled."
> +  "Remove PKG-DESC directory DIR from load-path and delete DIR recursively.
> +Clean-up the corresponding .eln files if Emacs is native compiled."

The code looks fine, I would just not modify the docstring and instead
append the message part about removing directories from the load path to
the end of the string.

> +  (setq load-path (cl-remove-if (lambda (s) (file-in-directory-p s dir))
> +                                load-path))
>    (when (featurep 'native-compile)
>      (cl-loop
>       for file in (directory-files-recursively dir




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79597; Package emacs. (Fri, 10 Oct 2025 21:41:02 GMT) Full text and rfc822 format available.

Message #17 received at 79597 <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7 <at> hotmail.com>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>,
 "79597 <at> debbugs.gnu.org" <79597 <at> debbugs.gnu.org>
Subject: Re: bug#79597: 31.0.50; [PATCH] * package.el (package-delete): Remove
 deleted package from load-path
Date: Fri, 10 Oct 2025 21:40:35 +0000
[Message part 1 (text/plain, inline)]
From: Philip Kaludercic 
Sent: Friday, October 10, 2025 02:21 PM

> The code looks fine, I would just not modify the docstring and instead
> append the message part about removing directories from the load path to
> the end of the string.

Thanks for the commit, and attach the patch changed the function doc. Thank you.
[0001-Remove-directory-of-deleted-package-from-the-load-pa.patch (text/x-patch, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 18 Oct 2025 09:16:02 GMT) Full text and rfc822 format available.

Notification sent to Lin Sun <sunlin7 <at> hotmail.com>:
bug acknowledged by developer. (Sat, 18 Oct 2025 09:16:02 GMT) Full text and rfc822 format available.

Message #22 received at 79597-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lin Sun <sunlin7 <at> hotmail.com>
Cc: philipk <at> posteo.net, 79597-done <at> debbugs.gnu.org
Subject: Re: bug#79597: 31.0.50; [PATCH] * package.el (package-delete): Remove
 deleted package from load-path
Date: Sat, 18 Oct 2025 12:15:04 +0300
> From: Lin Sun <sunlin7 <at> hotmail.com>
> CC: Eli Zaretskii <eliz <at> gnu.org>, "79597 <at> debbugs.gnu.org"
> 	<79597 <at> debbugs.gnu.org>
> Date: Fri, 10 Oct 2025 21:40:35 +0000
> 
> From: Philip Kaludercic 
> Sent: Friday, October 10, 2025 02:21 PM
> 
> > The code looks fine, I would just not modify the docstring and instead
> > append the message part about removing directories from the load path to
> > the end of the string.
> 
> Thanks for the commit, and attach the patch changed the function doc. Thank you.

Thanks, now installed on master, and closing the bug.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79597; Package emacs. (Sun, 19 Oct 2025 06:52:02 GMT) Full text and rfc822 format available.

Message #25 received at 79597-done <at> debbugs.gnu.org (full text, mbox):

From: Lin Sun <sunlin7 <at> hotmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "philipk <at> posteo.net" <philipk <at> posteo.net>,
 "79597-done <at> debbugs.gnu.org" <79597-done <at> debbugs.gnu.org>
Subject: Re: bug#79597: 31.0.50; [PATCH] * package.el (package-delete): Remove
 deleted package from load-path
Date: Sun, 19 Oct 2025 06:51:07 +0000
From: Eli Zaretskii <eliz <at> gnu.org>
Sent: Saturday, October 18, 2025 02:15 AM
> Thanks, now installed on master, and closing the bug.

Thank you, appreciate!



This bug report was last modified 18 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.