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

[sly-mrepl-indent-and-complete-symbol][TAB]strange behaviour ... #165

Closed
rprimus opened this issue Jun 29, 2018 · 16 comments
Closed

[sly-mrepl-indent-and-complete-symbol][TAB]strange behaviour ... #165

rprimus opened this issue Jun 29, 2018 · 16 comments

Comments

@rprimus
Copy link
Contributor

rprimus commented Jun 29, 2018

Fri Jun 29 18:32:26 BST 2018

Info:

ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G54a
"GNU Emacs 26.1 (build 1, x86_64-apple-darwin17.7.0, Carbon Version 158 AppKit 1561.4) of 2018-06-14"
sly: 20180613.1714 (from MELPA)

Problem:

In the mREPL, <TAB> does not perform completion consistently at the prompt.

Background:

Initially encountered this when going through the manual in section: 3. A SLY tour for SLIME users - at the point where cl-ppcre needs to be loaded via quicklisp.

Steps to reproduce:

  1. emacs -Q
  2. (add-to-list 'load-path "~/.emacs.d/elpa/sly-20180613.1714")
  3. (require 'sly-autoloads)
  4. M-x sly
  5. ql:<TAB> ;; works as expected
  6. <TAB> ;; nothing happens
  7. <SPACE><TAB> ;; cursor moves to position 0 (start of line)
  8. <SPACE>ql:<TAB>;; cursor moves to start of line
  9. (ql<TAB>) ;; works as expected
  10. <SPACE>(ql:<TAB>) ;;cursor moves to start of line

Is this the expected behaviour when using <TAB>?

Initially, I thought this was related to this lispy issue (during regular usage), however, the above testing proves otherwise.

[During regular usage, I've tested by tracing sly-mrepl-indent-and-complete-symbol, indent-for-tab-command and lispy--indent-for-tab, but nothing conclusive.]

@rprimus rprimus changed the title [sly-mrepl-indent-and-complete-symbol] strange behaviour ... [sly-mrepl-indent-and-complete-symbol][TAB]strange behaviour ... Jun 29, 2018
@joaotavora
Copy link
Owner

Thanks for such a detailed report, it's very important for me to have such a good guide to reproduce the problem.

@joaotavora
Copy link
Owner

I can't detect anything wrong. Here's a GIF (another eloquent way to show problems nowadays, using Peek)

sly-completion-seems-ok

@joaotavora
Copy link
Owner

Forgot to show that my sbcl version is 1.4.1.

@joaotavora
Copy link
Owner

joaotavora commented Jun 29, 2018

There seem to be only a few more variables:

  • the emacs version you are using
  • the operating system you are on
  • the fact that I'm doing this with a git checkout of Sly

can you tell me the first two and try doing the third?

@joaotavora
Copy link
Owner

EDIT: I see you had already shown the OS and emacs version. I'm really at a loss here. I will try later with Mac OSX 10.9

@rprimus
Copy link
Contributor Author

rprimus commented Jun 29, 2018

Fri Jun 29 21:38:12 BST 2018

Will attempt to find a peek equivalent.

In the animated gif you provided, you've only done step 5 (out of what I provided).

Try step 7. At the CL-USER> prompt, type a space, then hit tab.

@rprimus
Copy link
Contributor Author

rprimus commented Jun 29, 2018

Fri Jun 29 21:59:53 BST 2018

Here's a gif ...

sly-1

In the above, whenever the cursor goes to the start of the line (over the C of the prompt), the TAB key has been hit.

@rprimus
Copy link
Contributor Author

rprimus commented Jun 29, 2018

Fri Jun 29 22:18:10 BST 2018

Using sly from github:

sly-2

@joaotavora
Copy link
Owner

Wow, really strange. I wonder if it's terminal emacs, I mean emacs used without a windowing kit... Will try that later. Almost surely a bug in Sly or Emacs itself.

(Btw your original report was fine, no need for gifs, tho it's cool)

@joaotavora joaotavora added the bug label Jun 29, 2018
@joaotavora
Copy link
Owner

I confirmed this in Emacs 26.1 in the following case: type SPC, then some text, then TAB. Point goes to beginning of line and errors. The error doesn't produce a backtrace even with debug-on-error set to t.

In Emacs 25.2 this brings back the contents of the first line one position, which is the correct, expected behaviour.

I don't know if this is a bug in Emacs or SLY's misuse of some Emacs feature (that happened to work without problems in Emacs 25.2).

@joaotavora
Copy link
Owner

By the way @rprimus, are you sure that in your point 6. (the second TAB) you don't get a completion of the first option?

@joaotavora
Copy link
Owner

joaotavora commented Jun 29, 2018

@rprimus this is an Emacs bug, a regression in version 26.1. Follow it here: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32014. In the meantime, or until I find a workaround, refrain from typing SPC before an expression in the first line of a multi-line REPL expression.

@rprimus
Copy link
Contributor Author

rprimus commented Jun 29, 2018

Sat Jun 30 00:29:50 BST 2018

By the way @rprimus, are you sure that in your point 6. (the second TAB) you don't get a completion of the first option?

A TAB at the prompt does nothing. In SLIME, a TAB at the prompt produces a list of completions.

For steps 5 - 10, everything presented is typed directly after the REPL prompt.

@rprimus this is an Emacs bug. Follow it here: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32014. In the meantime, or until I find a workaround, refrain from typing SPC before an expression in the first line of a multi-line REPL expression.

@joaotavora - thanks for reporting!!

joaotavora added a commit that referenced this issue Jun 30, 2018
* contrib/sly-mrepl.el (sly-workaround-for-emacs-bug-32014): Work
around emacs Bug#32014.
@joaotavora
Copy link
Owner

@rprimus, there are now two issues here:

  • the indentation bug will be fixed in Emacs. But I've pushed a workaround to SLY.

  • your expectations about completion, to which I answer below:

By the way @rprimus, are you sure that in your point 6. (the second TAB) you don't get a completion of the first option?

A TAB at the prompt does nothing.

I meant that point 6 in your original recipe, the second TAB ever in that session, should, in theory complete the string ql: to ql:register-local-projects.

In SLIME, a TAB at the prompt produces a list of completions.

SLY opts to not show completions if there's nothing preceding point. I think this is reasonably sane, but I'll have a look if I can change this.

@rprimus
Copy link
Contributor Author

rprimus commented Jun 30, 2018

Sat Jun 30 21:32:35 BST 2018

Woo hoo!
Commit 8fc90fe works perfectly and also solves the lispy issue.

Thank you for the quick workaround!!

SLY opts to not show completions if there's nothing preceding point. I think this is reasonably sane, but I'll have a look if I can change this.

Makes sense. This is an all-or-nothing situation. As a CL beginner, having all completions allows me to explore whats available.

@joaotavora - many thanks.

@joaotavora
Copy link
Owner

Thank you for the quick workaround

You're welcome, thank you for the report.

Makes sense. This is an all-or-nothing situation. As a CL beginner, having all completions allows me to explore whats available.

May I suggest C-c C-d C-p (sly-apropos-package)? It lists the external functions of any package, and is a good way to explore. It's easier to type than in sounds (hold ctrl, then type c, d and p).

Before letting TAB complete from the empty string, there's a few changes I have to make first, so I'm closing this in the meantime. Let me know if you want me to reopen.

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

2 participants