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

sp-forward-slurp-sexp broken sometimes #664

Closed
willghatch opened this issue Oct 20, 2016 · 1 comment
Closed

sp-forward-slurp-sexp broken sometimes #664

willghatch opened this issue Oct 20, 2016 · 1 comment
Labels
Milestone

Comments

@willghatch
Copy link

In my config I have a lot of weird parenthesis types defined, and sp-forward-slurp-sexp seems to work fine with all of them but one. Here is an example:

In an otherwise unconfigured emacs, evaluate:

(require 'smartparens)
(sp-pair "«" "»")

Then put this text in your buffer:

«fo|o»«bar»

where | represents the cursor position. Then type M-x sp-forward-slurp-sexp and you get this:

«foo bar»»«

when I'm expecting this:

«foo «bar»»

sp-backwards-slup seems to work fine, and barfing both directions seems fine.

@Fuco1
Copy link
Owner

Fuco1 commented Oct 21, 2016

Huh, this is odd but I think I know why it happens. The character << has a "sticky" syntax type and so the closing paren of the first expression drags it along. Imagine }; in something like C or Java, you usually want to drag the semicolon around.

So this is a "misconfiguration", but it's simple to fix, look at sp-sexp-suffix.

I'm trying to come up with some better setting, but given that it is quite random how emacs assigns the syntax it doesn't always work.

In your case however, it should just figure it out automatically as the thing it drags along is actually a vaild pair opening, and that should obviously never happen. So I'm marking this a bug and you can, in the mean time, fix it by using the above setting.

Thanks.

@Fuco1 Fuco1 added the bug label Oct 21, 2016
@Fuco1 Fuco1 added this to the 1.10 milestone Nov 5, 2016
@Fuco1 Fuco1 closed this as completed in 76311ef Mar 11, 2017
jojojames pushed a commit to jojojames/smartparens that referenced this issue Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants