Fuco1 / smartparens

Minor mode for Emacs that deals with parens pairs and tries to be smart about it.
GNU General Public License v3.0
1.83k stars 195 forks source link

Unnecessary whitespace added when slurping in bibtex-mode #528

Open Poquaruse opened 8 years ago

Poquaruse commented 8 years ago

In bibtex-mode:

1) type: "asdf asdf asdf() asdf" 2) do backward slurp with point in () 3) end up with "asdf asdf ([WAY TOO MUCH WHITESPACE HERE]asdf) asdf" 4) similar problem with forward slurp...

Best regards

Fuco1 commented 8 years ago

It's because SP tries to reindent the region but bibtex's indentation is wonky... There's a patch for this waiting to be merged so you can disable this for bibtex then.

Poquaruse commented 8 years ago

Thanks for letting me know. I'm looking forward to be able to turn reindenting off. :-)

ajrouvoet commented 5 years ago

I think this issue is affecting me in other whitespace sensitive languages (haskell, Agda, python). Is there a workaround for disabling reindenting on slurp/barf?

Fuco1 commented 5 years ago

There are two settings sp-no-reindent-after-kill-modes and sp-no-reindent-after-kill-indent-line-functions that you can use to customize this.

I thought we already fixed this for haskell out of the box, but it seems we didn't. Patches welcome if you come up with the solution.

ajrouvoet commented 5 years ago

Does that also apply when calling slur/barf (in strict mode)? Because it seems to still reindent the line even when I add agda-mode to the sp-no-reindent-after-kill-modes list.

Fuco1 commented 5 years ago

It doesn't but it probably should or we should have a setting for that.

I have a plan to add a lot more "actions" (i.e. "feature switches) to the interactive commands and these could be toggled individually. It will be part of the "2.0" permissions system. Unfortunately there is no ETA at all.

ajrouvoet commented 5 years ago

Does it make sense to check sp-no-reindent-after-kill-modes on slurp/barf until there is a more finegrained notion in the mean time? Or is there a function I can monkeypatch as a workaround to disable reindenting at all?

Fuco1 commented 5 years ago

@ajrouvoet Yea I was just thinking about monkeypatching. There is sp--indent-region you could probably advice to do nothing when in haskell mode.

ajrouvoet commented 5 years ago

Okay, I'm very new to elisp, so I'll have to dig a bit to see how and whether it works.