gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
231 stars 21 forks source link

completion bug #156

Open dahtah opened 1 month ago

dahtah commented 1 month ago

There's a bug involving the REPL completion mechanism when strings contain the backslash character. To trigger the bug:

  1. Open a julia-snail .jl buffer
  2. C-c C-z to active REPL if necessary
  3. C-c C-z to go back to .jl buffer
  4. Type "\a then Tab for completion

I'm getting the following error (Julia 1.10): "ParseError:

Error @ none:1:1

try; JuliaSnail.replcompletion("\"\a", Main); catch; JuliaSnail.replcompletion("\"\a", Main); end ──────────────────┘ ── try without catch or finally"

gcv commented 1 month ago

Commit 3c4d13d makes this problem go away, and completion still seems to work for me, but I'm not sure why that code was originally there and what might have broken as a result of removing it.

gcv commented 1 month ago

There's unexpected subtlety involved in completion, leading backslashes, and quotes. It seems that sending the Emacs-quoted string "\\a" to REPLCompletions.completions works, but "\\c" does not. The "\\c" case requires re-quoting the backslash, which the code I removed in 3c4d13d does, which led to the breakage in #157.

The real problem leading to the bug in #156 is here: https://github.com/gcv/julia-snail/commit/8df01e9d13140a57962e788cf1d00f546ad92d22#diff-829cb14fef8569cb3c6920eff9f54e364e6c9f9df2edb3fdacc46b83f364dcf0L1353-L1359

I'm sure some people use this, but this code has too many subtle interactions and makes my head hurt. I'll just remove it, at least for now.