Use-package: Using :ensure package with :pin pins the wrong package name

Created on 7 Oct 2017  Â·  15Comments  Â·  Source: jwiegley/use-package

The following:

(use-package ess-site  :ensure ess :pin melpa-stable)

Puts ess-site into package-pinned-packages instead of ess. I'd expect it to put ess into package-pinned-packages instead.

bug ensure

All 15 comments

The readme suggests the behavior you experience to be the correct one. Per the examples given, :ensure t ensures that ess-site will be installed, :ensure ess will do the same, as long as ess is a non-nil symbol -- or am I missing something?

It's not ensure that's doing the wrong thing --- it's :pin. I'd like it to add the package that was :ensure'ed to package-pinned-packages, but instead it adds whatever package was in the use-package call.

On Fri 20 Oct 2017 at 13:40, Tom Regner notifications@github.com wrote:

The readme suggests the behavior you experience to be the correct one. Per the examples given,
:ensure t ensures that ess-site will be installed, :ensure ess will do the same, as long as ess is a
non-nil symbol -- or am I missing something?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Ah - so :pin should pin both packages, not 'ess instead', but 'ess in addition to ess-site', that makes sense, indeed.

Can you show me what the macro-expanded code should look like for an example declaration? I don't use either :pin or :ensure, so I want to get this right. Thanks.

In between posting this bug and now, I've switched to borg instead of package.el, so this isn't directly applicable for me anymore (and thus I can't produce the expanded code).

However, I think that a declaration like:

(use-package ess-site 
    :ensure ess
    :pin melpa-stable)

should result in an element like (ess . "melpa-stable") getting appended to package-pinned-packages. The current behavior is that (ess-site . "melpa-stable") gets added to package-pinned-packages.

@jabranham What about this case:

   (use-package ess-site 
     :ensure ess1
     :ensure ess2
     :ensure ess3
     :pin melpa-stable)

What we could do is add a new keyword, :pinning, just for overriding the decision of what name is pinned.

I didn't realize you could :ensure different packages. Makes sense though.

I'm not sure that :pinning is needed. Couldn't we just pin ess-site, ess1, ess2, and ess3 to melpa-stable?

Or maybe make that the default behavior, and provide :pinning in case it needs to be overridden (e.g. if ess3 needs to be pinned to melpa instead of melpa-stable?)

Sounds reasonable to me, but I'd like to hear from others who are using the ensure functionality.

Pinging @kleinschmidt @tpapp @Silex @waymondo @raxod502 @purcell for thoughts/opinions.

I actually got rid of my use of multiple-:ensure in favor of explicitly :require (when I thought I was using it incorrectly) so I have no opinion here. I also wasn't pinning anything.

I am not using :pin, but if I wanted to :ensure a different package and make sure it is from a particular repo, I could imagine the syntax

(use-package ess-site 
  :ensure (ess :pin melpa-stable))

I don't use :pin (since straight.el doesn't have such a concept), and also wasn't aware that multiple :ensure was possible.

To me, the most elegant solution would be

(use-package ess-site 
  :ensure (ess :pin melpa-stable))

as @tpapp suggested. Why? Because :pin doesn't make sense for all package managers, and other package managers might have their own metadata that makes sense to support in use-package. This way, all the package-manager-related metadata can be relegated to the argument of :ensure, which can be processed by a package-manager-specific backend (using a plugin system, like for the keywords). I tried to move in this direction by introducing use-package-ensure-function, but further work is probably necessary.

I like that idea for syntax, @tpapp.

Two forms are now allowed: :ensure PKG, which overrides the current package name, and is allowed multiple times; and :ensure (PKG :pin ARCHIVE), which pins a particular ensured package to a specific archive. :ensure no longer accepts a list (which was new behavior today anyway).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davep picture davep  Â·  6Comments

DamienCassou picture DamienCassou  Â·  8Comments

jtecca picture jtecca  Â·  9Comments

Yevgnen picture Yevgnen  Â·  5Comments

sondr3 picture sondr3  Â·  14Comments