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

haskell-indentation-indent-region and smartparens interact poorly #796

Open
rpglover64 opened this issue Aug 5, 2015 · 13 comments
Open

Comments

@rpglover64
Copy link

Calling a smartparens command like sp-raise-sexp or sp-forward-slurp calls indent-region which calls haskell-indentation-indent-region, which indents the region exactly 1 space, which is almost never what is wanted.

I think this is a misfeature in haskell-indentation-indent-region.

@gracjan
Copy link
Contributor

gracjan commented Aug 5, 2015

Region indentation can be considered unimplemented feature. We do not have that working yet.

@rpglover64
Copy link
Author

Then it would be more useful if region indentation did absolutely nothing.

@gracjan
Copy link
Contributor

gracjan commented Aug 9, 2015

@rpglover64: Are you able to submit a unit test in tests/haskell-indentation-tests.el that shows the broken behavior?

@gracjan gracjan changed the title Indentation mode and smartparens interact poorly haskell-indentation-indent-region and smartparens interact poorly Aug 9, 2015
@rpglover64
Copy link
Author

Not in the style of the file (i.e. not using haskell-indentation-check); AFAICT, haskell-indentation-find-indentations is behaving correctly, and that's what the file is testing.

I personally worked around this by redefining haskell-indentation-indent-region to do nothing.

@gracjan
Copy link
Contributor

gracjan commented Aug 9, 2015 via email

@gracjan
Copy link
Contributor

gracjan commented Dec 23, 2015

Noted the need of indent-region in #1032.
And closing this particular issue because it seems that smartparens has a flag to work around haskell-mode missing feature.

@gracjan gracjan closed this as completed Dec 23, 2015
@khanage
Copy link

khanage commented Dec 24, 2015

What is the flag that works around this @gracjan?

@gracjan
Copy link
Contributor

gracjan commented Dec 24, 2015 via email

@bergey
Copy link
Contributor

bergey commented Dec 24, 2015

@khanage From my answer to #1031:

(add-to-list 'sp-no-reindent-after-kill-modes 'haskell-mode)

That works for sp-kill-sexp. It doesn't work (in my quick test) for sp-raise-sexp or sp-forward-slurp. Maybe smartparens should apply sp-no-reindent-after-kill-modes to these functions also; I'm not certain. I think #1032 covers the issue from haskell-mode perspective.

@gracjan
Copy link
Contributor

gracjan commented Mar 5, 2016

Reopening as this does not seem to be solved good enough with #1032 (i.e. I have bad feelings but no proof yet).

@gracjan
Copy link
Contributor

gracjan commented Mar 5, 2016

Yes, sp-forward-slurp-sexp usually bound to C-right calls indent-region-function without looking at sp-no-reindent-after-kill-modes and messes up the layout.

@gracjan
Copy link
Contributor

gracjan commented Mar 5, 2016

smartparens will also interact poorly even if haskell-indent-region is implemented properly. Consider:

foo = (h $ do abc
              def
              ghi)

And now use sp-splice-sexp M-s-d inside the parentheses:

foo = h $ do abc
              def
              ghi

Layout is already messed up and even properly implemented haskell-indent-region cannot salvage the meaning of this program.

@peterbecich
Copy link
Member

peterbecich commented Jul 17, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants