Closed andyleejordan closed 8 years ago
Thanks for a very detailed bug report! Much appreciated!
Of the modes you have enabled electric-indent
immediately stands out as a candidate for a bad interaction. Does turning that mode off affect the issue?
No, I tested without it, turning it off had no effect :(
markdown-indent-line
moves point, I'm pretty sure it's not supposed to do that.
Hm. I have a fix for the bug in markdown-mode
. But it didn't fix ledger-mode
.
So, for ledger-mode
, indent-line-function
is set to indent-relative
, which is what's aligning it to the previous non-blank line (as it is supposed to, I guess). Why this is set such is a question for Ledger, not for evil-smartparens
.
I see two options:
1) wrap indent-according-to-mode
with save-excursion
(I have a branch doing this that I can PR)
2) remove the calls to indent-according-to-mode
The latter might be a better choice. Indenting when using overridden Evil operators seems to be an undesired side-effect. Why was this call originally added?
It was added in ff9c4b4bc7edd5d5a220d5e26b6001bc56ff02b4.
I'd prefer 1) if those are the only possible solutions, to avoid messing up the buffer's indentation.
Ah, but one only solved half the problem when testing.
Another fix would be to modify evil-sp--new-beginning to use the start of the current sexp as the beginning of the motion. This is probably a bit smarter, as the current feature feels a bit hairy, though it works.
When I get some time I'll give this alternative a shot.
@ane I've been playing with this. We don't necessarily want it to use the start of the current sexp, because then an unbalanced attempted delete is no longer a no-op (do we maybe want this as a feature?). To keep a no-op and respect indentation, what I have is an evil-sp--safe-beginning
function which takes the max of beg
and back-to-indentation
(as if at beg
).
This seems to do what we want, except now a dd
ignores the indentation of a line, and so doesn't delete the whole line.
What behavior do we really want for dd
in balanced and unbalanced expressions?
I've got it fixed, with just one last issue to deal with (point moves, but indentation is unaffected :smile:).
Bug
I have a strange (new-ish) issue. When using an operator such as
ce
in certain modes (so far,markdown-mode
andledger-mode
), upon entering insert state, two unexpected things happen: a) the line indents up completely unindented, and b), the cursor is left at the beginning of the line.Trace
When I remove the call to
indent-according-to-mode
at the end ofevil-sp-change
, the issue no longer reproduces (of course, this isn't a solution).Examples
In
ledger-mode
, where<P>
is the location of the point (the point being on the next letter):When I
ce
at any point in that snippet (for example, on theF
ofFood
), here's what happens:In
markdown-mode
:Again,
ce
:Versions
Minor modes
I have a lot of minor modes:
But I've tested with and without
smartparens-strict-mode
,smartparens-mode
,electric-indent-mode
,dtrt-indent-mode
, etc. It'sevil-smartparens
, but I bet it's interacting with something else odd (as there haven't been any changes to this package recently).