Default behavior of sp-forward-slurp-sexp and related functions in C-like modes is wrong, at least unless you apply special configuration to fix it. In comparison, everything works correctly out-of-the-box if you open a JavaScript file, despite JS having a pretty C-like or Java-like syntax.
Steps to reproduce the problem
Open a file with text
foo.bar (42);
in a C-like mode (extensions .c, .cpp, .java and likely others associated with C-like modes).
Type ( then M-x sp-forward-slurp-sexp RET several times (or whatever keybinding you use for that).
Expected behavior
After (:
()foo.bar (42);
After consecutive slurping:
(foo).bar (42);
(foo.bar) (42);
(foo.bar (42));
Actual behavior
()foo.bar (42); // As expected
(foo.)bar (42); // Wrong
(foo.bar) (42); // As expected
(foo.bar (42);) // Wrong
Environment & version information
smartparens version: Git checkout at 79a338d
Active major-mode: c++-mode
Smartparens strict mode: nil
Emacs version (M-x emacs-version): GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.33, cairo version 1.16.0) of 2023-04-08
Default behavior of
sp-forward-slurp-sexp
and related functions in C-like modes is wrong, at least unless you apply special configuration to fix it. In comparison, everything works correctly out-of-the-box if you open a JavaScript file, despite JS having a pretty C-like or Java-like syntax.Steps to reproduce the problem
Open a file with text
in a C-like mode (extensions
.c
,.cpp
,.java
and likely others associated with C-like modes).Type
(
thenM-x sp-forward-slurp-sexp RET
several times (or whatever keybinding you use for that).Expected behavior
After
(
:After consecutive slurping:
Actual behavior
Environment & version information
smartparens
version: Git checkout at 79a338dmajor-mode
:c++-mode
M-x emacs-version
): GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.33, cairo version 1.16.0) of 2023-04-08