AmaiKinono / puni

Structured editing (soft deletion, expression navigating & manipulating) that supports many major modes out of the box.
GNU General Public License v3.0
401 stars 21 forks source link

Right paren is removed when remove semi-colon in lisp-interaction-mode #65

Closed conao3 closed 1 month ago

conao3 commented 4 months ago

In lisp-interaction-mode or something lisp like major-mode, when I remove semi-colon, puni also remove trailing right paren. Due to this behavior, paren balance become broken.

repro step

  1. Save below file as ~/.debug.emacs.d/puni/init.el
    
    (prog1 "leaf"
    (custom-set-variables
    '(package-archives '(("melpa" . "https://melpa.org/packages/")
                        ("gnu"   . "https://elpa.gnu.org/packages/"))))
    (package-initialize)
    (use-package leaf :ensure t))

(leaf puni :ensure t :global-minor-mode electric-pair-mode puni-global-mode)


2. Load this init.el via `emacs --init-directory ~/.debug.emacs.d/puni`

3. Switch buffer to `*scratch*`

4. Type and occur issue. (`|` is cursor)

```elisp
;; type it
(a (b|))

;; type ;
(a (b;|))

;; backspace to remove ;
(a (b|

;; and you can see, right trailing paren is removed too.
conao3 commented 4 months ago

It seems this issue comes from this code but I didn't figure out how to handle this.

https://github.com/AmaiKinono/puni/blob/72e091ef30e0c9299dbcd0bc4669ab9bb8fb6e47/puni.el#L1591-L1595

brongulus commented 3 months ago

Seeing the same behavior, it's very annoying when you accidentally type a semi-colon and it removes evrything following it on deletion.

AmaiKinono commented 1 month ago

I'm very sorry for the delay. This should be fixed now.

conao3 commented 1 month ago

Confirmed. thanks!!