[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: |
Mon, 2 Feb 2015 19:37:19 -0200 |
2015-02-02 18:35 GMT-02:00 Thierry Volpiatto <address@hidden>:
>
> Stefan Monnier <address@hidden> writes:
>
>> We have a problem: since package-reinstall does a `package-delete'
>> and since this `package-delete' always marks the package as unselected,
>> it follows that package-reinstall will always mark the package as
>> unselected :-(
>
> This patch fix this issue:
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 9a29d63..296ee46 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -1239,7 +1239,8 @@ to `package-selected-packages'."
> "Reinstall package: "
> (mapcar #'symbol-name
> (mapcar #'car package-alist))))))
> - (package-delete (cadr (assq pkg package-alist)) t)
> + (package-delete (cadr (assq pkg package-alist)) 'force
> + (memq pkg package-selected-packages))
> (package-install pkg))
>
> (defun package-strip-rcs-id (str)
> @@ -1470,7 +1471,7 @@ with PKG-DESC entry removed."
> (and (memq pkg (mapcar #'car (package-desc-reqs (cadr p))))
> (car p))))))
>
> -(defun package-delete (pkg-desc &optional force)
> +(defun package-delete (pkg-desc &optional force nosave)
> "Delete package PKG-DESC.
>
> Argument PKG-DESC is a full description of package as vector.
> @@ -1506,7 +1507,8 @@ elsewhere."
> (unless (cdr pkgs)
> (setq package-alist (delq pkgs package-alist))))
> ;; Update package-selected-packages.
> - (when (memq name package-selected-packages)
> + (when (and (memq name package-selected-packages)
> + (null nosave))
> (customize-save-variable
> 'package-selected-packages (remove name
> package-selected-packages)))
> (message "Package `%s' deleted." (package-desc-full-name
> pkg-desc))))))
I was about to suggest the following.
@@ -1238,9 +1238,10 @@ to `package-selected-packages'."
(interactive (list (intern (completing-read
"Reinstall package: "
(mapcar #'symbol-name
- (mapcar #'car package-alist))))))
- (package-delete (cadr (assq pkg package-alist)) t)
- (package-install pkg))
+ (mapcar #'car package-alist))))))
+ (let ((selected (memq pkg package-selected-packages)))
+ (package-delete (cadr (assq pkg package-alist)) 'force)
+ (package-install pkg selected)))
(defun package-strip-rcs-id (str)
"Strip RCS version ID from the version string STR.
>> One more thing: now that we have package-selected-packages,
>> package-delete should be fixed to be a real "inverse" of
>> package-install, i.e. it should delete its unused dependencies.
>
> Hmm, not sure it is a good idea.
I'm on the fence on this. Personally, I would automate this (as Stefan
suggests).
But, of all linux package managers I've used, I don't remember any of
them removing dependencies without explicit request.
Other options, for the sake of completeness:
1. Just like we say "N packages can be upgraded, hit U...", we could
have a message saying "N packages are dependencies which are no longer
needed, hit R to remove them".
2. After `package-execute' is done, we could check if there are any
unneeded deps and ask the user a 3rd question "The following
dependencies are no longer necessary, remove them? ...". If the user
answers `n' here, we can also ask "mark these as explicitily selected
to prevent future autoremoval?".
>> One more thing: it'd be great to extend the list-package display so as
>> to indicate which packages are selected and which ones aren't.
>
> I already did this in helm, with "I" in first column, but in helm the
> first 2 columns are not needed like in list-package ("I" and "D").
> Will see what I can do even if I don't use this UI.
My suggestion would be to change the "installed" string (displayed on
the status column) to "dependency" for packages that are not in
`package-selected-packages'.
- Re: package.el dependencies, (continued)
- Re: package.el dependencies, Artur Malabarba, 2015/02/02
- Re: package.el dependencies, Thierry Volpiatto, 2015/02/02
- Re: package.el dependencies, Thierry Volpiatto, 2015/02/02
- Re: package.el dependencies, Artur Malabarba, 2015/02/02
- Re: package.el dependencies, Thierry Volpiatto, 2015/02/02
- Re: package.el dependencies, Thierry Volpiatto, 2015/02/02
- Re: package.el dependencies, Artur Malabarba, 2015/02/02
- Re: package.el dependencies, Thierry Volpiatto, 2015/02/02
- Re: package.el dependencies, Thierry Volpiatto, 2015/02/02
Re: package.el dependencies, Thierry Volpiatto, 2015/02/02
Re: package.el dependencies, Artur Malabarba, 2015/02/03
Re: package.el dependencies, Thierry Volpiatto, 2015/02/02