Macaulay2 / M2-emacs

Macaulay2 emacs files
GNU General Public License v3.0
5 stars 3 forks source link

Determine indentation based on the last non-blank line #55

Closed d-torrance closed 5 months ago

d-torrance commented 5 months ago

One thing that I broke in a recent pull request (probably #52) was preserving indentation between blank lines.

For example, suppose we have something like the following:

f = x -> (

    x + 2)

We want the x + 2 indented since it's inside the parentheses. But currently, when Emacs is determining the indentation of the third line, it looks back to the second line, sees that there's nothing there, and figures that there should be no indentation. So we end up with:

f = x -> (

x + 2)

With this PR, we keep going back until we either hit a non-blank line or the beginning of the buffer to determine the indentation.

We also add a docstring to the M2-this-line-indent-amount function.

Cc: @DanGrayson