radian-software / straight.el

🍀 Next-generation, purely functional package manager for the Emacs hacker.
MIT License
2.75k stars 151 forks source link

M-x straight-use-package does not respect existing recipes? #122

Open raxod502 opened 7 years ago

raxod502 commented 7 years ago

When using M-x straight-use-package on a deferred-install package that has a custom recipe, I get a warning about incompatible recipes. straight.el should just be using the previously registered recipe.

blak3mill3r commented 6 years ago

I do not understand the details very well, but from reading the straight.el documentation I decided that this was the correct way to use my own fork in a recipe (perhaps I'm doing it wrong)

(use-package lispy
  :straight
  (lispy :type git :files (:defaults "lispy-clojure.clj") :host github :repo "blak3mill3r/lispy" :branch "fix/cider-may-not-be-loaded-yet"
         :upstream (:host github
                    :repo "abo-abo/lispy")))

And I get a warning:

Warning (straight): Package "lispy" has two incompatible recipes (:repo cannot be both "abo-abo/lispy" and "blak3mill3r/lispy")

Oh, and I do

(straight-use-package 'use-package)
(setq straight-use-package-by-default t)

right after the straight.el bootstrap code, at the very top of my init.el

blak3mill3r commented 6 years ago

Ah, I figured it out. I also have

(use-package lispyville
  )

above the (use-package lispy ...) block. The lispyville recipe must name lispy as a dependency causing straight.el to fetch it using the default recipe.

I commented out the (use-package lispyville) and rebuilt and now everything is fine.

blak3mill3r commented 6 years ago

and now I can use lispyville again, provided that I put the (use-package lispyville) after my own custom-recipe (use-package) for lispy itself. I apologize if I missed that in the thorough documentation, which I have not read cover to cover. I'm documenting it on this issue in case it saves someone else some trouble.

xuchunyang commented 6 years ago

Is it a pitfall of straight.el? I also feel confused. For example, I have already a package installed via its default recipe, then I want to modify the recipe such as changing :repo, how can I make the new recipe take effect?

raxod502 commented 6 years ago

I apologize if I missed that in the thorough documentation, which I have not read cover to cover.

No problem. For future reference, this case is documented here.

Is it a pitfall of straight.el?

Not really. It's unfortunate that the behavior can be confusing, but I don't think there is any way to make it more intuitive other than by reporting a better error message.

Although for people who aren't interested in dealing with all the complexity of a more powerful package management model, I am thinking about creating a wrapper for straight.el that makes it behave similarly to package.el (i.e. with a list of installed packages stored persistently outside the init-file, etc.) except that at any point you could drop down to the straight.el interface.

I have already a package installed via its default recipe, then I want to modify the recipe such as changing :repo, how can I make the new recipe take effect?

That depends what you mean.

  1. If you mean earlier in your init-file, you request a package with the default recipe (or that package is requested implicitly as a dependency), and then later in your init-file, you want to request it again with a different recipe, this is clearly impossible. The package will already be installed. (What would you want? Install the package, then delete it and install a different version? Do this on every Emacs init?)
  2. If you mean that you only request the package once in your init-file, but you'd like to change the recipe that is used to do so, then just do that and then run M-x straight-normalize-package. straight.el doesn't modify anything on disk during init; you have to ask for that. Normalization causes the correct branch to be checked out. (You may also want M-x straight-fetch-package.)