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

buffer-local parens? #347

Closed
wavexx opened this issue Jul 18, 2014 · 4 comments
Closed

buffer-local parens? #347

wavexx opened this issue Jul 18, 2014 · 4 comments

Comments

@wavexx
Copy link

wavexx commented Jul 18, 2014

Is it possible to add a pair just for the current buffer?

By skimming through the source, it looks like most of the relevant variables are already buffer-local, though calling (sp-pair) from within a mode hook results in emacs going crazy.

The reason behind this is having complex modes such as ess-mode do "the right thing"(tm) depending on the real language being used. Unfortunately, the major-mode is always "ess-mode", thought the underlying language could vary (R, SAS, Julia...). Several hooks are provided by ess for this reason.

I'm also baffled as of why (sp-local-pair) requires a mode. Wouldn't be more simple to make (sp-local-pair) simply work on buffer-local variables and just call it from a hook, like most other minor modes do?

@Fuco1
Copy link
Owner

Fuco1 commented Jul 18, 2014

What is simple is for everyone to decide. sp-local-pair requires mode because that's how I prefer it to work, no other reason.

As for the question, it's not possible. You can work around that by adding predicates using the :when argument testing for currently used language or something you can decide on.

This is suboptimal, I agree. I'm redesigning the UI once again for the next version, I will make sure this issue (of adding buffer-local pairs) is addressed. Currently, there is no UI for that. The pairs can have complex dependencies and inheritance and this is resolved each time major-mode is changed. You can of course replace the data structures manually, but there's too much state to do that reliably.

In the next version, there will definitely be no sp-pair and sp-local-pair or sp-local-tag. One function to set up everything is enough. There will be support for named configurations as well, so you can do something like (sp-pair :name 'ess-mode-julia ....) and then load it in your hook with (sp-load-pairs 'ess-mode-julia). If the name is major mode, it will get loaded automatically.

However, the release date is probably quite far.

@wavexx
Copy link
Author

wavexx commented Jul 18, 2014

Using :when though will not stop highlighting, only autoinsertion.

@Fuco1
Copy link
Owner

Fuco1 commented Jul 18, 2014

If you test for the navigate action, that will disable both navigation
and highlighting.

@Fuco1 Fuco1 modified the milestone: Backlog Jun 14, 2016
@Fuco1 Fuco1 modified the milestones: 2.0, Backlog May 12, 2017
@Fuco1 Fuco1 closed this as completed in 20b457e Jun 17, 2017
@Fuco1
Copy link
Owner

Fuco1 commented Jun 17, 2017

@Fuco1 Fuco1 modified the milestones: 1.11, 2.0, Backlog Jun 17, 2017
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

2 participants