Emacs mode indentation trouble


#1

I’m having a weird, very inconsitent problem with indentation in emacs mod.

I’m currently editing a file and have a line part way down a function definition which indents the way it should and the very next line does not. The next line and all subsequent lines want to snap back to the beginning of line.

I get this problem off and on and have no idea how i could track it down. Could i have some strange partial unicode character in the buffer that’s tricking julia-mode’s indent routines ?

I can fix the problem by deleting certain lines but there’s no obvious reason as to why deleting a line helps, i.e. i’m not using any \chars or anything other than plain text.

consider my current situation
line 1
blank line
comment line
blank line
line 2
line 3

line 3 will not indent properly.
line 2 DOES indent properly.
deleting line 1 leads to line 3 then indenting properly.

highly weird, and highly annoying.
any suggestions on what I could do to try and track this down ?
Thanks!


#2

There is a limit on how many lines back emacs can look to track indentation. So if your function is fairly long, it may lose track of the indent position. You can extend this limit as follows. M-X customize-variable. Then then when prompted for the variable name, type julia-max-block-lookback. A new buffer opens, showing the current value of the variable is 5000. Change it to 20000, then push the button for apply and save.