justinbarclay / parinfer-rust-emacs

An emacs centric fork of parinfer-rust
ISC License
9 stars 3 forks source link

Edge case when symbol contains #| (Common Lisp) #15

Open gilch opened 3 months ago

gilch commented 3 months ago

Minimal test case:

(defun foo ()
  2)

'foo#|bar|

At least in smart mode, if you delete any of the trailing brackets, they don't come back.

I think what's happening is that parinfer-rust-emacs is treating the #| like the start of a #|...|# comment that isn't closed, even though it's in the middle of a symbol, and thus not actually a comment. E.g., in sbcl this is just a symbol:

* 'foo#|bar|
|FOO#bar|
gilch commented 3 months ago

This is worse than I thought. Not just symbols, but also comments can trigger the problem.

Either an unbalanced | in a comment:

;; |
(defun foo (
  2

Or a #|, without a |#, even if the |s are balanced: [Never mind. I can't seem to reproduce this one now]

;; #| |
(defun foo (
  2