Straight.el: Doesn't work with use-package anymore

Created on 2 Dec 2017  Â·  8Comments  Â·  Source: raxod502/straight.el

Here's the stack trace I get when evaluating (which used to work before):

  (use-package flyspell-lazy
    :ensure t
    :config
    (flyspell-lazy-mode 1))
Debugger entered--Lisp error: (wrong-number-of-arguments (4 . 5) 3)
  straight-use-package-ensure-function(flyspell-lazy t nil)
  (progn (straight-use-package-ensure-function 'flyspell-lazy 't 'nil) (if (not (require 'flyspell-lazy nil t)) (ignore (message (format "Cannot load %s" 'flyspell-lazy))) (if (condition-case err (run-hook-with-args-until-failure 'use-package--flyspell-lazy--pre-config-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "pre-:config hook" (error-message-string err)) :error)))) (progn (condition-case err (flyspell-lazy-mode 1) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" ":config" (error-message-string err)) :error)))) (condition-case err (run-hooks 'use-package--flyspell-lazy--post-config-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "post-:config hook" (error-message-string err)) :error)))))) (if (condition-case err (run-hook-with-args-until-failure 'use-package--flyspell-lazy--pre-init-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "pre-:init hook" (error-message-string err)) :error)))) (progn nil (condition-case err (run-hooks 'use-package--flyspell-lazy--post-init-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "post-:init hook" (error-message-string err)) :error)))))) t))
  (progn (progn (straight-use-package-ensure-function 'flyspell-lazy 't 'nil) (if (not (require 'flyspell-lazy nil t)) (ignore (message (format "Cannot load %s" 'flyspell-lazy))) (if (condition-case err (run-hook-with-args-until-failure 'use-package--flyspell-lazy--pre-config-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "pre-:config hook" (error-message-string err)) :error)))) (progn (condition-case err (flyspell-lazy-mode 1) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" ":config" (error-message-string err)) :error)))) (condition-case err (run-hooks 'use-package--flyspell-lazy--post-config-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "post-:config hook" (error-message-string err)) :error)))))) (if (condition-case err (run-hook-with-args-until-failure 'use-package--flyspell-lazy--pre-init-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "pre-:init hook" (error-message-string err)) :error)))) (progn nil (condition-case err (run-hooks 'use-package--flyspell-lazy--post-init-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "post-:init hook" (error-message-string err)) :error)))))) t)))
  eval((progn (progn (straight-use-package-ensure-function 'flyspell-lazy 't 'nil) (if (not (require 'flyspell-lazy nil t)) (ignore (message (format "Cannot load %s" 'flyspell-lazy))) (if (condition-case err (run-hook-with-args-until-failure 'use-package--flyspell-lazy--pre-config-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "pre-:config hook" (error-message-string err)) :error)))) (progn (condition-case err (flyspell-lazy-mode 1) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" ":config" (error-message-string err)) :error)))) (condition-case err (run-hooks 'use-package--flyspell-lazy--post-config-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "post-:config hook" (error-message-string err)) :error)))))) (if (condition-case err (run-hook-with-args-until-failure 'use-package--flyspell-lazy--pre-init-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "pre-:init hook" (error-message-string err)) :error)))) (progn nil (condition-case err (run-hooks 'use-package--flyspell-lazy--post-init-hook) ((debug error) (ignore (display-warning 'use-package (format "%s %s: %s" "flyspell-lazy" "post-:init hook" (error-message-string err)) :error)))))) t))) t)
  elisp--eval-last-sexp(nil)
  #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400e4e11>)(nil)
  ad-Advice-eval-last-sexp(#f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400e4e11>) nil)
  apply(ad-Advice-eval-last-sexp #f(compiled-function (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area.\nInteractively, with a non `-' prefix argument, print output into\ncurrent buffer.\n\nNormally, this function truncates long output according to the\nvalue of the variables `eval-expression-print-length' and\n`eval-expression-print-level'.  With a prefix argument of zero,\nhowever, there is no such truncation.  Such a prefix argument\nalso causes integers to be printed in several additional formats\n(octal, hexadecimal, and character when the prefix argument is\n-1 or the integer is `eval-expression-print-maximum-character' or\nless).\n\nIf `eval-expression-debug-on-error' is non-nil, which is the default,\nthis command arranges for all errors to enter the debugger." (interactive "P") #<bytecode 0x400e4e11>) nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)
bug critical use-package

Most helpful comment

straight depends on the whims of a 3rd party packages

eh, not entirely. Nothing in straight.el proper is broken, only its integration with use-package.

Why not make the context argument to straight-use-package-ensure-function optional

I pushed a commit with this basic idea. If someone has improvements I'm happy to merge them; this part of the code is probably never going to be pretty.

straight relying on a fork, or even straight using vendoring its own use-package implementation

In my opinion, use-package isn't really a dependency of straight.el in any way. straight.el provides _support_ for use-package, but doesn't _rely_ on use-package at all. And once I finish with-feature, straight.el will have support for _both_ use-package and with-feature :)

All 8 comments

Is there a way to downgrade use-package perhaps? This is a really annoying issue :/

Reproduced.

See jwiegley/use-package@93bf693 where defer-install is removed and the
ensure-function is called with one less argument.

Gaëtan Gilbert

On 02/12/2017 15:05, diego wrote:

Reproduced

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/raxod502/straight.el/issues/190#issuecomment-348694255,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWQ7KdBzkBOwomR_O8DdBZbDMrhYGj4ks5s8VkmgaJpZM4QzUCW.

@rgrinberg

Is there a way to downgrade use-package perhaps?

$ cd ~/.emacs.d/straight/repos/use-package
$ git checkout 150090d4ce07bd32d0e3319e729b56b506c83599

Or you can switch to my fork, which will continue to have support for deferred installation indefinitely.

In any case… while I am fine with removing support for deferred installation from use-package, the result is a little disappointing since I'll have to have straight.el detect whether the current version of use-package supports deferred installation. Or I might be able to just patch use-package to be backwards compatible. We'll see.

Why not make the context argument to straight-use-package-ensure-function optional (with nil meaning :ensure)? That should be backwards compatible and allow support for deferred install.

I'm not opposed to straight supporting both versions of use-package, straight relying on a fork, or even straight using vendoring its own use-package implementation. Though I think the current situation where straight depends on the whims of a 3rd party packages isn't ideal. As a package manager, straight is pretty fundamental so it can put users in a really tough spot when things don't work, even if it's due to no fault of straight itself (like in this case).

The simple suggestion by @SkySkimmer fixes everything for me.

diff --git a/straight.el b/straight.el
index 69300d7..782ced5 100644
--- a/straight.el
+++ b/straight.el
@@ -4225,7 +4225,7 @@ This is an `:override' advice for
     ;; `package-install'.
     (eval-and-compile
       (defun straight-use-package-ensure-function
-          (name ensure state context &optional only-if-installed)
+          (name ensure state &optional context only-if-installed)
         "Value for `use-package-ensure-function' that uses straight.el.
 The meanings of args NAME, ENSURE, STATE, CONTEXT are the same as
 in `use-package-ensure-function' (which see). ONLY-IF-INSTALLED

straight depends on the whims of a 3rd party packages

eh, not entirely. Nothing in straight.el proper is broken, only its integration with use-package.

Why not make the context argument to straight-use-package-ensure-function optional

I pushed a commit with this basic idea. If someone has improvements I'm happy to merge them; this part of the code is probably never going to be pretty.

straight relying on a fork, or even straight using vendoring its own use-package implementation

In my opinion, use-package isn't really a dependency of straight.el in any way. straight.el provides _support_ for use-package, but doesn't _rely_ on use-package at all. And once I finish with-feature, straight.el will have support for _both_ use-package and with-feature :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eflanigan00 picture eflanigan00  Â·  4Comments

raxod502 picture raxod502  Â·  3Comments

enko picture enko  Â·  4Comments

MikeTheGreat picture MikeTheGreat  Â·  4Comments

rsbowman picture rsbowman  Â·  3Comments