Skip to content

Poor experience with (use-package :ensure t ... :straight ...)  #425

@ieure

Description

@ieure

I moved my Emacs config over to use-package earlier this year to improve startup times, and am trying out straight.el this week to better keep things in sync across machines.

I have a few packages I've written that I haven't gotten around to submitting to MELPA, and these are presenting problems for me. My assumption was that if I provided a recipe, straight.el would use it to install the package, and that would be that. However, there's a bad interaction with use-package.

Here's an example:

(use-package nssh
  :defer t
  :ensure t
  :straight (nssh :host github
                  :repo "ieure/nssh-el"
                  :tag "v0.9.10"))

When I eval this, my package archives are refreshed:

Importing package-keyring.gpg...done
Contacting host: stable.melpa.org:80 [2 times]
Contacting host: elpa.gnu.org:443
Package refresh done

And then I get this warning:

Error (use-package): Failed to install nssh: Package ‘nssh-’ is unavailable

Despite all that, my package is installed and works fine:

phaktory!ieure:~$ ls -ld ~/.emacs.d/straight/repos/nssh-el
drwxr-xr-x 1 ieure ieure 40 Oct 24 13:39 /home/ieure/.emacs.d/straight/repos/nssh-el/

However, this unacceptably delays Emacs initialization, as it refreshes packages multiple times (once per recipe which doesn't exist in package-archives) and spams the fresh Emacs with *Warnings*.

A similar experience can be had if you use-package anything which isn't available in package-archives, for example if you remove GNU ELPA and try to install exwm.

The issue appears to be that :ensure t causes use-package to install via package.el, even though :straight ... causes installation via the provided recipe.

It would be ideal if :ensure t was ignored when :straight was provided, but failing that, a warning or item in the documentation would be welcome.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions