all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Thierry Volpiatto <thievol@posteo.net>
Cc: emacs-devel@gnu.org
Subject: Re: Proposal for 'package-isolate' command
Date: Sun, 20 Aug 2023 07:51:24 +0000	[thread overview]
Message-ID: <87r0nyup6r.fsf@posteo.net> (raw)
In-Reply-To: <877cpq9p7s.fsf@posteo.net> (Thierry Volpiatto's message of "Sun,  20 Aug 2023 06:40:16 +0000")

Thierry Volpiatto <thievol@posteo.net> writes:

> Hello Philip,
>
> Philip Kaludercic <philipk@posteo.net> writes:
>
>> How about this patch, that will use a temporary directory when
>> `package-isolate' is invoked with a prefix argument (not sure what the
>> default should be, I guess reusing `user-emacs-directory' is less
>> surprising):
>>
>> [2. text/x-diff;
>> 0001-Add-command-to-start-Emacs-with-specific-packages.patch]...
>
> I was reading the code of the new version of `package--dependencies` and
> had some questions:
>
>     (named-let more ((pkg-desc desc))
>       (let (deps)
>         (dolist (req (package-desc-reqs pkg-desc))
>           (setq deps (nconc
>                       (catch 'found
>                         (dolist (p (apply #'append (mapcar #'cdr (package--alist))))
>                           (when (and (string= (car req) (package-desc-name p))
>                                      (version-list-<= (cadr req) (package-desc-version p)))
>                             (throw 'found (more p)))))
>                       deps)))
>         (delete-dups (cons pkg-desc deps))))
>
>
> Why are you using `string=` to compare (car req) 
> with (package-desc-name p)?

As opposed to what alternative?  The advantage of `string=' compared to
something like equal is that 1. that I do not have to care if a package
name is a symbol or a string 2. that all other values would trigger an
error.

> Isn't (apply #'append (mapcar #'cdr (package--alist))) same as
> (mapcar #'cadr (package--alist))?

Iff every package in (package--alist) only had one package descriptor,
which is not the case

(seq-filter
 (lambda (e) (length> e 2))
 (package--alist))
;=> non-nil

Also, see

(seq-set-equal-p
 (apply #'append (mapcar #'cdr (package--alist)))
 (mapcar #'cadr (package--alist)))
;=> nil

> I am not a fan of named-let but isn't using deps as a second arg of
> 'more' more in the named-let spirit? (fully not tested)
>
>     (named-let more ((pkg-desc desc)
>                      (deps nil))
>       (dolist (req (package-desc-reqs pkg-desc))
>         (setq deps (nconc
>                     (catch 'found
>                       (dolist (p (apply #'append (mapcar #'cdr (package--alist))))
>                         (when (and (string= (car req) (package-desc-name p))
>                                    (version-list-<= (cadr req) (package-desc-version p)))
>                           (throw 'found (more p deps)))))
>                     deps)))
>       (delete-dups (cons pkg-desc deps)))

The only difference I believe would occur in this case, is that we would
always maintain "the same" list of dependencies, throughout traversing
all package dependencies.  In the end that shouldn't change much, and it
is only more work for `delete-dups'.

> Thanks.



  reply	other threads:[~2023-08-20  7:51 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07  7:57 Changes to make in elpa-packages file for nongnu elpa Thierry Volpiatto
2023-08-07 13:30 ` Philip Kaludercic
2023-08-07 18:19   ` Thierry Volpiatto
2023-08-07 20:33     ` Philip Kaludercic
2023-08-08  4:33       ` Thierry Volpiatto
2023-08-08  5:52         ` Philip Kaludercic
2023-08-08  6:17           ` Thierry Volpiatto
2023-08-15 16:55           ` Philip Kaludercic
2023-08-15 17:34             ` Eshel Yaron
2023-08-15 19:39               ` Proposal for 'package-isolate' command Philip Kaludercic
2023-08-17 10:53                 ` Adam Porter
2023-08-15 18:56             ` Changes to make in elpa-packages file for nongnu elpa Eli Zaretskii
2023-08-15 19:52               ` Proposal for 'package-isolate' command Philip Kaludercic
2023-08-16 11:25                 ` Eli Zaretskii
2023-08-16 18:48                   ` Philip Kaludercic
2023-08-16  6:51             ` Changes to make in elpa-packages file for nongnu elpa Thierry Volpiatto
2023-08-16 10:10               ` Philip Kaludercic
2023-08-16 10:14                 ` Thierry Volpiatto
2023-08-16 11:03                   ` Philip Kaludercic
2023-08-16 11:55                     ` Thierry Volpiatto
2023-08-16 18:34                       ` Proposal for 'package-isolate' command Philip Kaludercic
2023-08-16 18:49                         ` Stefan Kangas
2023-08-16 19:00                           ` Philip Kaludercic
2023-08-17  5:30                         ` Thierry Volpiatto
2023-08-17  8:34                           ` Philip Kaludercic
2023-08-17  9:07                             ` Eshel Yaron
2023-08-17 14:19                               ` Philip Kaludercic
2023-08-17 13:32                             ` Thierry Volpiatto
2023-08-17 14:04                               ` Philip Kaludercic
2023-08-17 14:15                                 ` Thierry Volpiatto
2023-08-17 13:56                             ` Thierry Volpiatto
2023-08-17 14:18                               ` Philip Kaludercic
2023-08-17 14:28                               ` Thierry Volpiatto
2023-08-17 18:17                                 ` Philip Kaludercic
2023-08-18  4:57                                   ` Thierry Volpiatto
2023-08-18  5:44                                     ` Eli Zaretskii
2023-08-18  7:49                                     ` Philip Kaludercic
2023-08-18 12:43                                       ` Thierry Volpiatto
2023-08-18 18:34                                       ` Adding package and package-vc to ELPA Philip Kaludercic
2023-08-19 10:26                                         ` Thierry Volpiatto
2023-08-20  6:40                             ` Proposal for 'package-isolate' command Thierry Volpiatto
2023-08-20  7:51                               ` Philip Kaludercic [this message]
2023-08-20 16:06                               ` Thierry Volpiatto
2023-08-20 18:41                                 ` Philip Kaludercic
2023-08-20 19:15                                   ` Thierry Volpiatto
2023-08-20 20:24                                     ` Thierry Volpiatto
2023-08-20 20:28                                     ` Philip Kaludercic
2023-08-16 14:10                 ` Changes to make in elpa-packages file for nongnu elpa Eli Zaretskii
2023-08-16 18:52                   ` Philip Kaludercic
2023-08-08  6:01       ` Thierry Volpiatto
2023-08-08  6:34       ` Michael Albinus
2023-08-08 16:37         ` Philip Kaludercic
2023-08-08 16:41           ` Michael Albinus
2023-08-09  7:06             ` Philip Kaludercic
2023-08-09 11:53               ` Eli Zaretskii
2023-08-09 14:53                 ` Philip Kaludercic
2023-08-09 14:55                   ` Eli Zaretskii
2023-08-09 15:24                     ` Philip Kaludercic
2023-08-09 16:23                       ` Eli Zaretskii
2023-08-09  3:47   ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0nyup6r.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=emacs-devel@gnu.org \
    --cc=thievol@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.