justinbarclay / parinfer-rust-emacs

An emacs centric fork of parinfer-rust
ISC License
7 stars 2 forks source link

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

Open gilch opened 2 weeks ago

gilch commented 2 weeks 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 2 weeks 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