Closed daanturo closed 2 years ago
Ah, I think electric-pair-mode
is doing the job for me (I've been using it from day 1), so I haven't noticed that Puni didn't implement this.
I've seen your PR (thanks!). It's great but I'm mainly worried about multi-char delimiters. For example, in HTML (with your patch):
<p>|</p>
;; Call `puni-backward-delete-char
(nothing left)
To me this is actually reasonable but I think some people may just want this:
<p|></p>
This may because in Lisp, they are used to press DEL
to go backward in opening parentheses. I sometimes do that myself.
I'm thinking if this can happens to keyword delimiters, and I found in sh-mode
:
if|fi
# Call `puni-backward-delete-char`
(nothing left)
This is a surprise, though it's a corner case.
So, to me it's better to limit this behavior to single-char delimiters. What do you think?
Yes, I think that the behavior for multi-char delimiters is debatable and hard to define correctly, too. So let's limit it for now.
I've modified it a bit and it now it deals with the multi-char delimiter case. This is because I do like it, and by switching the order of conditional branches, the if|fi
problem is gone.
Instead of not doing anything,
puni-backward-delete-char
should splice the sexp around point when the delimiters are next to each other.Currently,
puni-mode-map
doesn't provide any key bindings to delete the pair, the shortest I have found (without additional bindings) isbackspace delete delete
: 3 key presses.