-
Notifications
You must be signed in to change notification settings - Fork 347
Running indent-according-to-mode moves the cursor way to the right #488
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
Comments
@EDmitry This is exactly due to the cycling behaviour, and because the beginning of the line is simply the first of multiple possible indent levels. My guess is that it is impossible in this context to call For my own part, I have disabled auto-indenting on Not sure what the |
Hmm, I can definitely change some evil bindings, but is there some haskell-mode API to be able to just say "please indent this to the first position you have without cycling over"? I could just make evil call that instead of |
Not really. You'd presumably have the same issue in |
Does that mean that there is no way to indent to the first valid position when making a newline with |
That's already what it's doing, but beginning-of-line is the first valid indent position most of the time. :-) So what you're asking is for something to know whether you want to move to the first or second syntactically-valid indentation point, and that can't be determined automatically.
Right. |
Still, this behavior makes only sense if the internal workings of emacs indentation are known. @EDmitry, you are not alone surprised by this. For example |
It actually looks like |
If completely disabling "indent after newline" is your goal then disable Unless I misunderstand something opening line above without moving sounds like a basic emacs command that does not require anything haskell-mode related. Am I wrong? |
I am talking about cases when there are several valid indentation positions for a given place in the code including the beginning of the line I want to ask haskell-mode to move the cursor (indent) to the most probable indentation level. Because if I just move the cursor to the beginning of the line and call I am making an assumption that haskell-mode ranks indentation levels and chooses the best one and not just indents to the first valid one, but I might be wrong. |
Neither |
Hm, then why doesn't it always move the cursor to the beginning of the line whenever it is a possible indentation level? Say I have:
The cursor will be right under |
With Note also that |
Checking out the new branch, thanks! |
@EDmitry: branch wip/hi2 got merged in place of |
Reopen if you have additional information about this issue. |
When using
turn-on-haskell-indentation
if I create two new lines after some haskell block of code and runindent-according-to-mode
this will result in the indentation about 12 spaces to the right. This breaks a bunch of modes (like evil-mode) that move the cursor around and then callindent-according-to-mode
to get the right indentation for that line. I suspect this is because of the functionality of tab to cycle through various indentation so executing the command results in cycling to the second tab position because when the cursor is in the beginning of the line that is the first tab position. Is there any workaround?The text was updated successfully, but these errors were encountered: