Part of Emacs's electric-pair-mode
functionality (controlled by a variable called electric-pair-delete-adjacent-pairs
) is that when the point is between an empty set of delimiters and you delete the opening one, it also deletes the closing one for you: if the point is at the pipe character in (|)
, pressing backspace will delete both the opening and closing parenthesis.
I like this functionality very much but annoyingly it doesn't work in the Slime REPL. I do have electric-pair-mode
enabled in the REPL, and it does do the other things it is supposed to, like insert the closing parenthesis automatically when you insert the opening one, or wrap the region in parenthesis when the mark is active and you press (
. Just deleting adjacent pairs doesn't work. How do I get that functionality in the Slime REPL? (I think the answer has to do with keymap precedence. Maybe...)
EDIT: Here is how I'm testing this: I'm using Emacs 26.1 (on both GNU/Linux and on Windows 10, the same problem appears) and Slime 2.23. To test I run emacs -Q
and then evaluate this in the scratch buffer:
(package-initialize)
(setq slime-contribs '(slime-repl slime-indentation))
(setq slime-lisp-implementations '((sbcl ("sbcl"))))
(require 'slime)
Then I run M-x slime
and when the REPL appears, I run M-x electric-pair-mode
. Then typing a (
inserts ()
leaving the point between the parenthesis. Typing backspace then deletes only the opening parenthesis insetad of both.
emacs -Q
.emacs -Q
.slime-repl
contrib? Because I just tried without it and their backspace does delete the pair. I forgot to specify I´m usingslime-repl
.smartparens
instead ofelectric-pair
and see if it works well underslime-repl