Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Wrong type argument: stringp when creating *sly-completion* buffer #534

Open
BooAA opened this issue Sep 15, 2022 · 17 comments
Open

Comments

@BooAA
Copy link

BooAA commented Sep 15, 2022

Hi, thanks for the work.

When using sly-symbol-completion-mode, there is error "(wrong-type-argument stringp #<buffer sly-completions>)" when creating the completion buffer. Screenshot:

2022-09-15.23-47-25.mov

Version:
Sly: Master, 805c29672c8a1f6c68286ab379359f9ab9ad9dc2
Emacs: Master, 4cf9c92e27d20da9453f9abe89d84bee5d776329

I think the error is from sly--completion-transient-mode-display-guard-p, backtrace listed below:

Debugger entered--Lisp error: (wrong-type-argument stringp #<buffer *sly-completions*>)
  sly--completion-transient-mode-display-guard-p(#<buffer *sly-completions*> ((display-buffer--maybe-same-window display-buffer-reuse-window display-buffer--maybe-pop-up-frame-or-window display-buffer-below-selected) (window-height . t) nil))
  #f(compiled-function (conditions) #<bytecode -0x620ed9aa9162099>)((sly--completion-transient-mode-display-guard-p))
  buffer-match-p(sly--completion-transient-mode-display-guard-p #<buffer *sly-completions*> ((display-buffer--maybe-same-window display-buffer-reuse-window display-buffer--maybe-pop-up-frame-or-window display-buffer-below-selected) (window-height . t) nil))
  display-buffer-assq-regexp(#<buffer *sly-completions*> ((sly--completion-transient-mode-display-guard-p (sly--completion-transient-mode-teardown-before-displaying))) ((display-buffer--maybe-same-window display-buffer-reuse-window display-buffer--maybe-pop-up-frame-or-window display-buffer-below-selected) (window-height . t) nil))
  display-buffer(#<buffer *sly-completions*> ((display-buffer--maybe-same-window display-buffer-reuse-window display-buffer--maybe-pop-up-frame-or-window display-buffer-below-selected) (window-height . t) nil))
  temp-buffer-window-show(#<buffer *sly-completions*> ((display-buffer--maybe-same-window display-buffer-reuse-window display-buffer--maybe-pop-up-frame-or-window display-buffer-below-selected) (window-height . t) nil))
  sly--completion-pop-up-completions-buffer("def" (#("decf" 0 2 ... 2 3 ... 3 4 ...) #("defun" 0 3 ... 3 5 ...) #("deref" 0 2 ... 2 4 ... 4 5 ...) #("defvar" 0 3 ... 3 6 ...) #("defsetf" 0 3 ... 3 7 ...) #("deftype" 0 3 ... 3 7 ...) #("defclass" 0 3 ... 3 8 ...) #("defmacro" 0 3 ... 3 8 ...) #("uiop:defun*" 0 5 ... 5 8 ... 8 11 ...) #("sb-c:xdefun" 0 6 ... 6 9 ... 9 11 ...) #("sb-c:id-leaf" 0 6 ... 6 7 ... 7 9 ... 9 10 ... 10 11 ... 11 12 ...) #("defmethod" 0 3 ... 3 9 ...) #("delete-if" 0 2 ... 2 8 ... 8 9 ...) #("defstruct" 0 3 ... 3 9 ...) #("defglobal" 0 3 ... 3 9 ...) #("asdf:perform" 0 2 ... 2 3 ... 3 6 ... 6 7 ... 7 8 ... 8 9 ... ...) #("delete-file" 0 2 ... 2 7 ... 7 8 ... 8 11 ...) #("sb-c:defknown" 0 5 ... 5 8 ... 8 13 ...) #("defgeneric" 0 3 ... 3 10 ...) #("defpackage" 0 3 ... 3 10 ...) ...))
  sly--completion-in-region-function(#<marker at 286 in *sly-mrepl for sbcl<5>*> 289 #f(compiled-function (string pred action) #<bytecode 0x6377807fa8846dc>) nil)
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15>(#f(compiled-function (&rest args) #<bytecode -0x1d7af936d74db536>) #<marker at 286 in *sly-mrepl for sbcl<5>*> 289 #f(compiled-function (string pred action) #<bytecode 0x6377807fa8846dc>) nil)
  apply(#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15> #f(compiled-function (&rest args) #<bytecode -0x1d7af936d74db536>) (#<marker at 286 in *sly-mrepl for sbcl<5>*> 289 #f(compiled-function (string pred action) #<bytecode 0x6377807fa8846dc>) nil))
  #f(advice #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_15> :around #f(compiled-function (&rest args) #<bytecode -0x1d7af936d74db536>) ((name . sly--setup-completion)))(#<marker at 286 in *sly-mrepl for sbcl<5>*> 289 #f(compiled-function (string pred action) #<bytecode 0x6377807fa8846dc>) nil)
  completion-in-region(#<marker at 286 in *sly-mrepl for sbcl<5>*> 289 #f(compiled-function (string pred action) #<bytecode 0x6377807fa8846dc>) nil)
  completion-at-point()
  sly-mrepl-indent-and-complete-symbol(nil)
  funcall-interactively(sly-mrepl-indent-and-complete-symbol nil)
  command-execute(sly-mrepl-indent-and-complete-symbol)

Thanks.

@joaotavora
Copy link
Owner

Can't reproduce on an Emacs master build from about 1,5 months ago. Can you confirm this is only in a very recent Emacs 29?

@BooAA
Copy link
Author

BooAA commented Sep 17, 2022

Can you confirm this is only in a very recent Emacs 29?

Sorry for the late reply, as there are many broken builds during July and Aug in the Emacs master branch. I have tested builds in 2022-09-02 (commit: 0ec831b91cde2a0e1b65f99c1190975c6e6959f9) and 2022-08-15 (commit: d5e74d9cd7fd657f13ef7ac72cf84c3bc3a03ba9). Both of them exist the problem I mentioned above.

I will update more information if I can find some earlier builds that works.

@joaotavora
Copy link
Owner

Can't reproduce, just tried with the latest commit as of today:

commit 8892abbaf92ebd2e8f968fe86270fba08bf1d07a (HEAD -> master, origin/master, origin/HEAD)
Author: Stefan Kangas <stefankangas@gmail.com>
Date:   Fri Sep 23 11:50:28 2022 +0200

My test:

cd ~/Source/Emacs/sly
~/Source/Emacs/emacs/src/emacs -Q -L . -l sly
C-u M-x sly <path-to-my-sbcl>
;; type (def
C-M-i to invoke completion

Everything works as expected

@joaotavora
Copy link
Owner

Peek 2022-09-23 11-19

@BooAA
Copy link
Author

BooAA commented Sep 23, 2022

I think I found the issue. How if you config (setq tab-always-indent 'complete) to use tabs for both indentation and completion? I found using C-M-i can trigger completion normally, but using tabs will result in the issue mentioned above.

2022-09-24.00-38-17.mov

@joaotavora
Copy link
Owner

Well it triggers an issue, but not the issue mentioned above. Furthermore, I can't even get a backtrace.

I think the best way is to git bisect this. It works fine in Emacs 28.2. A good bisection test is

emacs -Q -L . -l sly --eval '(setq tab-always-indent (quote complete))' -f sly

followed by a quick manual test (like you have in the gif)

Unfortunately, I don't have time to do this bisection right now. Maybe you do?

@BooAA
Copy link
Author

BooAA commented Sep 28, 2022

Sorry for the late reply.

Unfortunately, I don't have time to do this bisection right now. Maybe you do?

I'm very willing to do that but might not recently, as I'm busy onboarding my first job this 2 weeks. I will do the test when I'm free.

@1player
Copy link

1player commented Oct 26, 2022

Same issue here on Emacs master, and I too have (setq tab-always-indent 'complete). I'll try a bisect when I find a moment to do so.

@joaotavora
Copy link
Owner

This is foremost a regression in Emacs master. It would be good to figure out first when it started failing before thinking about fixes to Sly.

@joaotavora
Copy link
Owner

joaotavora commented Nov 9, 2022 via email

@joaotavora
Copy link
Owner

joaotavora commented Nov 9, 2022 via email

@joaotavora
Copy link
Owner

Finally found time to do the bisection:

❯ git bisect bad
59ecf25fc86081c9df05b84194c36414c225c265 is the first bad commit
commit 59ecf25fc86081c9df05b84194c36414c225c265
Author: Philip Kaludercic <philipk@posteo.net>
Date:   Thu Mar 10 10:59:52 2022 +0100

    * window.el (display-buffer-assq-regexp): Use buffer-match

 lisp/window.el | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

The bisection test I used, for reference:

make -j
src/emacs -Q -nw -L ~/Source/Emacs/sly -l sly --eval '(setq tab-always-indent (quote complete))' -f sly
;; type (def, following by TAB

@joaotavora
Copy link
Owner

Reported to Emacs https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62417. Fix proposed there.

@sebasmonia
Copy link

Just yesterday I ran into this in a Sly w/Emacs compiled from master (I am setting up a fresh dev environment).
In the linked post, Eli suggests "The users can easily make local changes". Does he mean applying your patch, or is there some other (smaller) way to get this working?

@joaotavora
Copy link
Owner

No, the best way is just wait for Eli to finally understand what is going on and solve this in a perfectly equivalent way. Give them time :-)

@joaotavora
Copy link
Owner

"The users can easily make local changes" is completely misguided. Most SLY users aren't even awayre SLY is using display-buffer-alist temporarily. This is already fixed in Emacs 29. Eli is just going to tweak it, and that's fine.

@sebasmonia
Copy link

sounds good, thanks for replying! the timing of seeing this reported and being patched just as yesterday I ran into it.

Best workaround I guess is using C-M-i to invoke completion, rather than C-i/TAB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants