Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent commit breaks wrapping symbols with question marks in them #1212

Open
or opened this issue Jul 2, 2024 · 5 comments
Open

Recent commit breaks wrapping symbols with question marks in them #1212

or opened this issue Jul 2, 2024 · 5 comments

Comments

@or
Copy link

or commented Jul 2, 2024

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

  • smartparens version: I used git bisect to identify commit 65881cd 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
@github-project-automation github-project-automation bot moved this to To triage in Triage Jul 2, 2024
@or
Copy link
Author

or commented Jul 2, 2024

Likely related: if I use sp-raise-sexp on (foobar?), then the result is foobar, it removes everything after the ?.

@Fuco1 Fuco1 moved this from To triage to Backlog in Triage Jul 2, 2024
@maris-orbidans-otm
Copy link

maris-orbidans-otm commented Jul 31, 2024

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. 😢

@dpassen
Copy link
Contributor

dpassen commented Oct 3, 2024

This is still a real problem

@or
Copy link
Author

or commented Oct 4, 2024

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")

@deejayem
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

5 participants