GNU bug report logs -
#79597
31.0.50; [PATCH] * package.el (package-delete): Remove deleted package from load-path
Previous Next
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.
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):
[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: 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):
[Message part 1 (text/plain, inline)]
<div class="elementToProof">From: Eli Zaretskii<br>Sent: Tuesday, October 7, 2025 11:56 PM
</div><div class="elementToProof">> You could use file-in-directory-p instead, but it requires the test to </div><div class="elementToProof">> be made before the directory is deleted. OTOH, why shouldn't </div><div class="elementToProof">> package--delete-directory do this as part of its job? it already </div><div class="elementToProof">> cleans up the *.eln files of the deleted package. </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):
Lin Sun <sunlin7 <at> hotmail.com> writes:
> <div class="elementToProof">From: Eli Zaretskii<br>Sent: Tuesday, October 7, 2025 11:56 PM
> </div><div class="elementToProof">> You could use
> file-in-directory-p instead, but it requires the test
> to </div><div class="elementToProof">> be made before the
> directory is deleted. OTOH, why shouldn't </div><div
> class="elementToProof">> package--delete-directory do this as
> part of its job? it already </div><div
> class="elementToProof">> cleans up the *.eln files of the deleted
> package. </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):
[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: 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: 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.