[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: package.el dependencies

From: Artur Malabarba
Subject: Re: package.el dependencies
Date: Sun, 25 Jan 2015 16:21:13 -0200

> +(defun package-used-elsewhere-p (pkg)
> +  "Check if PKG is used elsewhere as dependency.
> +Argument PKG is a symbol."
> +  (cl-loop with alist = (remove (assoc pkg package-alist) package-alist)
> +           for p in alist thereis
> +           (member pkg (mapcar 'car (package-desc-reqs (cadr p))))))

`package-used-elsewhere-p' might as well return a list of the
conflicts (and say that in the docstring). I'm not entirely familiar
with the `thereis' in `cl-loop' so maybe that's already being done
In any case, that would certainly be useful below.

>  (defun package-delete (pkg-desc)

Just a suggestion.
I think it would be useful to add an optional SOFT or NOERROR argument
now, which would silently not-delete packages instead of erroring. It
will probably be useful for automatic dependency removal.

> +          ((package-used-elsewhere-p (elt pkg-desc 1))

Why not use the package-desc getters?

> +           ;; Don't delete packages used as dependency elsewhere.
> +           (error "Package `%s' is used elsewhere as dependency, not 
> deleting"
> +                  (package-desc-full-name pkg-desc)))

As already said, please say where the conflicts occurred. If
`package-used-elsewhere-p' returned a list, you could use it here to
report the conflicts.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]