GNU bug report logs - #72141
29.4; package-upgrade vs package-load-list

Previous Next

Package: emacs;

Reported by: Thierry Volpiatto <thievol <at> posteo.net>

Date: Tue, 16 Jul 2024 14:44:02 UTC

Severity: normal

Found in version 29.4

Full log


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

From: Thierry Volpiatto <thievol <at> posteo.net>
To: Thierry Volpiatto <thievol <at> posteo.net>
Cc: Philip Kaludercic <philipk <at> posteo.net>, Eli Zaretskii <eliz <at> gnu.org>,
 72141 <at> debbugs.gnu.org
Subject: Re: bug#72141: 29.4; package-upgrade vs package-load-list
Date: Sat, 10 Aug 2024 17:16:54 +0000
[Message part 1 (text/plain, inline)]
Thierry Volpiatto <thievol <at> posteo.net> writes:

> Hello Philip,
>
> Philip Kaludercic <philipk <at> posteo.net> writes:
>
>> Gladly, then I'd like to try it out it and perhaps write a ERT test.
>
> Patch attached, please review and test it before merging ;-)
>
> Thanks.

Also, I recently had to read package.el code and I found many loops are
too complex and/or too difficult to read, here are some:

--8<---------------cut here---------------start------------->8---
(equal
 ;; old
 (mapcar #'symbol-name (mapcar #'car package-alist))
 ;; new
 (mapcar (lambda (pkg) (symbol-name (car pkg))) package-alist))

(equal
 ;; old
 (mapcar
  (lambda (p) (cons (package-desc-full-name p) p))
  (delq nil
        (mapcar (lambda (p) (unless (package-built-in-p p) p))
                (apply #'append (mapcar #'cdr (package--alist))))))
 ;; new
 (cl-loop for (p desc) in package-alist
          unless (package-built-in-p p)
          collect (cons (package-desc-full-name desc) desc)))

;; Change w3m to an installed package in your Emacs.
(let ((alist (package-desc-extras (cadr (assq 'w3m package-alist)))))
  (equal
   ;; old
   (mapcar #'macroexp-quote
           (apply #'nconc
                  (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist)))
   ;; new
   (cl-loop for lst in alist
            nconc `(,(car lst) ,(macroexp-quote (cdr lst))))))

(equal
 ;; old
 (mapcar #'file-truename
         (cl-remove-if-not #'stringp
                           (mapcar #'car load-history)))
 ;; new
 (cl-loop for (name _rest) in load-history
          when (stringp name)
          collect (file-truename name)))
--8<---------------cut here---------------end--------------->8---

I have a patch for this, let me know if interested, or perhaps I should
open a new bug report ?

-- 
Thierry
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 310 days ago.

Previous Next


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