smartparens
smartparens copied to clipboard
Recent commit breaks wrapping symbols with question marks in them
Expected behavior
In Clojure mode I can wrap foobar? with parentheses with sp-wrap-round, getting (foobar?).
Actual behavior
I get (foobar)?.
Steps to reproduce the problem
Open a file in Clojure mode type foobar?, try to wrap it with parentheses with sp-wrap-round.
Backtraces if necessary (M-x toggle-debug-on-error)
N/A
Environment & version information
smartparensversion: I usedgit bisectto identify commit 65881cd575df9cda09401aba69432c34ef56027b as the one introducing this behaviour.- Active
major-mode:clojure-mode - Smartparens strict mode: nil
- Emacs version (
M-x emacs-version): GNU Emacs 29.4 (build 2, aarch64-apple-darwin23.5.0, NS appkit-2487.60 Version 14.5 (Build 23F79)) of 2024-06-30 - Starterkit/Distribution: Doom
- OS: darwin
Likely related: if I use sp-raise-sexp on (foobar?), then the result is foobar, it removes everything after the ?.
In Clojure mode "?" is no longer considered a part of sexp. I think it affects all sexp commands: sp-mark-sexp and sp-forward-sp.
sp-mark-sexp on |foo? selects only foo
Versions: Emacs 29.3 smartparens 20240713.1002
I installed smartparens 1.11.0. I cannot do my work with buggy smartparens. 😢
This is still a real problem
For https://github.com/doomemacs/doomemacs the package can be pinned to the last commit before the broken one:
;; in packages.el
(package! smartparens
;; until https://github.com/Fuco1/smartparens/issues/1212 is resolved
:pin "8459f2f7f025baa8c0c98d18531a5fa32f63d949")
Is the problem in smartparens, or in clojure-mode? It doesn't happen in emacs-lisp-mode.
The difference seems to be that when the character after the point is ?, then (syntax-after (point)) returns '(3) in emacs-lisp-mode, but '(1048579) in clojure-mode.
This causes different behaviour in sp-syntax-after-is-prefix:
(when-let ((syntax (syntax-after p)))
(or (= (syntax-class syntax) 6)
(/= 0 (logand (lsh 1 20) (car syntax)))))
(syntax-class syntax) returns 3 in both modes, but (car syntax) returns 3 in emacs-lisp-mode and 1048579 in clojure-mode.