wwwjfy / emacs-fish

fish-mode for emacs
99 stars 15 forks source link

Interacts poorly with electric indent mode. #11

Closed ghost closed 9 years ago

ghost commented 9 years ago

I get really bizarre indentation behavior when using electric indent mode. It's difficult for me to describe but essentially every time I press enter, the line I'm leaving has it's indentation moved around semi-randomly, leaving an incorrect result (which is especially annoying when the indentation started out correct).

Another symptom is that if my cursor is at the start of a line and I press tab, the indentation is inserted but my cursor remains at the beginning of the line, so I often find myself hitting enter, tab, C-e every time I want to start a new line. It's a bit frustrating.

For now the workaround is just to disable electric indent:

(add-hook 'fish-mode-hook (lambda () (electric-indent-local-mode -1)))

But it would be nice if the indentation settings for this mode could handle electric indent.

I had a peek at the code but I just don't even know what i'd be looking for to fix this. Any help is appreciated, thanks.

I'm using emacs git master (built Jan 9th, v25.0.50.1) if that matters.

wwwjfy commented 9 years ago

Thanks for reporting.

I've no idea it's broken since when, but the reason is the goto-char, which is to keep the cursor's position the same as before indention.

I'll work on a fix soon.

wwwjfy commented 9 years ago

This should fix the problem, though I haven't tested it on 25

ghost commented 9 years ago

Indeed this is much better, thank you.