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

Emulation of (setq show-paren-style 'expression) for show-smartparens-mode? #856

Closed
kqr opened this issue Feb 11, 2018 · 5 comments
Closed

Comments

@kqr
Copy link

kqr commented Feb 11, 2018

I don't have a particularly attention-grabbing colour for the matching delimiter, so in order to avoid having to scan the entire window looking for a matching delimiter that may very well be off-screen, I used (setq show-paren-style 'expression). I'd like to drop show-paren for show-smartparens-mode but I'm missing the expression style highlighting.

Is this a low-hanging fruit that even a beginner like me could deal with, or is it likely to be more complicated?

Note that this might also require something akin to (setq show-paren-priority -200), since we don't want the expression-style highlight to override e.g. the region.

@Fuco1
Copy link
Owner

Fuco1 commented Feb 11, 2018

Hey. If I understand this correcly you want to highlight the entire expression when the cursor is placed at either opening or closing delimiter, correct?

It should be enough to change this one function: sp-show--pair-create-overlays It takes as arguments the positions of opening and closing delimiters and their lengths. From that you can calculate the span and everything else.

So adding some customize option and a check in that method to do the additional work would be a start. We can either "stretch" one of the overlays over the entire sexp (easy variant and I would go with this at first) or we can add a third one for the body and put that there only if the option is enabled (also possible and maybe a bit nicer solution as it allows for different faces for the boundaries and the body).

Feel free to hack on it. If you know the overlay api at least a bit this should provide just enough difficult for a beginner to be interesting :)

@SamirHafez
Copy link
Contributor

Hello!
Is this ticket still a thing? I think it would be a useful feature.

@Fuco1
Copy link
Owner

Fuco1 commented Jul 18, 2018

@SamirHafez It is a thing but nobody is probably working on it.

@SamirHafez
Copy link
Contributor

I added #910

@kqr
Copy link
Author

kqr commented Jul 25, 2018

This is now formally resolved by #910. Thanks again, @SamirHafez!

@kqr kqr closed this as completed Jul 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants