Subject: Re: bug#17895: 24.3.91; electric-indent-mode not quite right with comments in fortran-mode

From: Glenn Morris <[email-masked]>
Date: Tue, 01 Jul 2014 19:49:30 -0400

Stefan Monnier wrote:

> [ Don't know enough about Fortran to know what is "insert a multiline
>   comment" in this context

AFAIK, there is no such thing as "multiline comments" in Fortran.
I assume he means he has typed:

C this is a comment

Then he presses RET and wants to write more comments, but point gets
indented to column 6 instead. It's impossible for Fortran mode to know
if he was going to write code (column 6) or a comment (column 0). I
could say the same thing about pressing RET after a code line.

> neither do I know what is a "multiline statement" or why it would
> "require fortran-continuation-string"

If you want to write a continued code line, you put eg a "$" in column 5
of the new line. There's no marker in the previous line, so again it is
impossible for Fortran mode to know that's what you intend when you
press RET.

> Maybe a way to fix this problem, then, would be to make fortran's
> indent-line-function indent to column 0 when called on an empty line in
> one of those contexts.

It is impossible for it to know, as I hopefully explain above.

I really don't think that Fortran mode can do anything here.
The new behavior is different to the old one, but I think it will be a
net win in terms of fewer keypresses in most situations.

(Everyone should use free-format Fortran, where these problems were all
solved 20+ years ago!)