Here's the package definition:
(straight-use-package
'(tuareg
:type git :repo "rgrinberg/tuareg"
:local-repo "tuareg"
:upstream (:host github :repo "ocaml/tuareg"))
:init (ocaml/init-tuareg))
and here's the exception:
Debugger entered--Lisp error: (args-out-of-range "rgrinberg/tuareg" 8 18)
match-string(1 "rgrinberg/tuareg")
straight-vc-git--decode-url("rgrinberg/tuareg")
straight-vc-git--urls-compatible-p("https://github.com/ocaml/tuareg/" "rgrinberg/tuareg")
straight-vc-git--validate-remote("tuareg" "origin" "rgrinberg/tuareg")
straight-vc-git--validate-remotes((:type git :repo "rgrinberg/tuareg" :local-repo "tuareg" :upstream (:host github :repo "ocaml/tuareg") :package "tuareg"))
straight-vc-git--validate-local((:type git :repo "rgrinberg/tuareg" :local-repo "tuareg" :upstream (:host github :repo "ocaml/tuareg") :package "tuareg"))
straight-vc-git--pull-from-remote-raw((:type git :repo "rgrinberg/tuareg" :local-repo "tuareg" :upstream (:host github :repo "ocaml/tuareg") :package "tuareg") "origin" "master")
straight-vc-git-pull-from-remote((:type git :repo "rgrinberg/tuareg" :local-repo "tuareg" :upstream (:host github :repo "ocaml/tuareg") :package "tuareg"))
apply(straight-vc-git-pull-from-remote (:type git :repo "rgrinberg/tuareg" :local-repo "tuareg" :upstream (:host github :repo "ocaml/tuareg") :package "tuareg"))
straight-vc(pull-from-remote git (:type git :repo "rgrinberg/tuareg" :local-repo "tuareg" :upstream (:host github :repo "ocaml/tuareg") :package "tuareg"))
straight-vc-pull-from-remote((:type git :repo "rgrinberg/tuareg" :local-repo "tuareg" :upstream (:host github :repo "ocaml/tuareg") :package "tuareg"))
straight-pull-package("tuareg" nil)
funcall-interactively(straight-pull-package "tuareg" nil)
call-interactively(straight-pull-package record nil)
command-execute(straight-pull-package record)
helm-M-x(nil #("straight-pull-package" 0 21 (match-part "straight-pull-package")))
funcall-interactively(helm-M-x nil #("straight-pull-package" 0 21 (match-part "straight-pull-package")))
call-interactively(helm-M-x nil nil)
command-execute(helm-M-x)
There are two problems with your code.
straight-use-package (despite the name) has nothing to do with use-package and does not provide any of the latter's features, such as :init. (Better naming ideas for straight-use-package are welcomed.):host github at the top level of the recipe, since otherwise git clone rgrinberg/tuareg is what is executed.You probably want this:
(use-package tuareg
:recipe (:host github :repo "rgrinberg/tuareg"
:upstream (:host github :repo "ocaml/tuareg"))
:init (ocaml/init-tuareg))
Or since you mentioned in a previous thread that you want to keep the default use-package package manager as package.el, perhaps this instead:
(straight-use-package
'(tuareg
:host github :repo "rgrinberg/tuareg"
:upstream (:host github :repo "ocaml/tuareg")))
(use-package tuareg
:ensure nil
:init (ocaml/init-tuareg))
This said, that error is unexpected and is probably a bug in straight.el. At least there should be a better error message.
(I tried evaluating the above use-package form, by the way, and couldn't find any ocaml/init-tuareg function. But I imagine that's an entirely separate issue.)
Thanks, that fixed the issue for me. Indeed, having more validation on the spec of straight-use-package would be very useful. ocaml/init-tuareg comes from spacemacs btw.
I'm keeping this open for a bit because there is actually a bug in straight-vc-git--decode-url.
@raxod502 as for naming, why not simply straight (or straight-recipe, straight-package)? I don't feel extremely strongly about this, but I'll admit the name straight-use-package had me confused for a sec at first too.
Radon Rosborough notifications@github.com writes:
- Firstly,
straight-use-package(despite the name) has nothing to do withuse-packageand does not provide any of the latter's features, such as:init. (Better naming ideas forstraight-use-packageare welcomed.)
Huh. I tested this by removing the :init option expecting that to be a
no-op but then my init code stopped working.
In any case, I changed my code to follow your advice and to use both
straight-use-package and use-package.
@rgrinberg Well what's actually happening is straight-use-package is a regular function which happens to take three arguments, so you're passing the keyword :init as NO-CLONE and the result of the function call (ocaml/init-tuareg) as NO-BUILD. The side effect is (ocaml/init-tuareg) still gets called so it looks like it worked, but for a completely wrong reason…
@dieggsy Well, the problem with abbreviating it like that is that then it would be a little inconsistent with its sibling functions:
straight-register-package
straight-use-package-no-build
straight-use-package-lazy
straight-use-recipes
Maybe we could abbreviate these too.
straight-use-package -> straight-package
straight-register-package -> straight-register
straight-use-package-no-build -> straight-clone
straight-use-package-lazy -> straight-package-lazy
straight-use-recipes -> straight-recipes
If people think renaming things would be a good idea, it'd be a good idea to open a new issue so the discussion doesn't get lost down here.
Fixed.