Subject: bug#14076: 24.3; Comments in Fortran Source

From: Fred Krogh <[email-masked]>
Date: Tue, 02 Apr 2013 17:34:58 -0700

On 04/02/2013 05:19 PM, Glenn Morris wrote:
> Please keep the debbugs address cc'd.
>
> Fred Krogh wrote:
>
>> O.k. The program shows up with emacs -Q with this program
>>
>> program tmp
>>    integer :: i
>>    do i = 1, 5
>> ! Comment
>>       print '("i=",i0)', i
>>    end do
>> end program tmp
>>
>> Highlight the whole program, then <cntrl><alt>\
>> and the ! Comment is indented, and I think this should not happen.
> Why do you think it should not happen?
> F90 mode has always behaved like this.
I'm hoping that just because it has "always" done this, that does not 
make it correct.
>
> Earlier you said:
>
>> I have options set so that comments should not be touched when
>> formatting a region,
> What options are those?

fortran-comment-indent-style is a variable defined in `fortran.el'.
Its value is nil
Original value was fixed

   This variable is safe as a file local variable if its value
   satisfies the predicate which is a byte-compiled expression.

Documentation:
How to indent comments.
nil forces comment lines not to be touched;
`fixed' indents to `fortran-comment-line-extra-indent' columns beyond
   `fortran-minimum-statement-indent-fixed' (if `indent-tabs-mode' nil), or
   `fortran-minimum-statement-indent-tab' (if `indent-tabs-mode' non-nil);
`relative' indents to current Fortran indentation plus
   `fortran-comment-line-extra-indent'.

You can customize this variable.

Specifically nil forces comment lines not to be touched.  When you get 
down to it, I don't care what nil does, but I certainly want some way to 
say "don't change my comments".  But from the above, that seems to be 
what nil is supposed to do.  I'd be happy if there was some choice that 
did this, but here is what I see for choices

Fortran Comment Indent Style:
(*) Untouched
( ) fixed
( ) relative
     State : SAVED and set.
    How to indent comments. Hide
    nil forces comment lines not to be touched;
    `fixed' indents to `fortran-comment-line-extra-indent' columns beyond
      `fortran-minimum-statement-indent-fixed' (if `indent-tabs-mode' 
nil), or
      `fortran-minimum-statement-indent-tab' (if `indent-tabs-mode' 
non-nil);
    `relative' indents to current Fortran indentation plus
      `fortran-comment-line-extra-indent'.
Groups: Fortran Indent

I have fortran-comment-line-extra-indent set to 0.  Perhaps there is 
some combination in there that would make it do what I want, but since 
it appears that nil should do the job, I've filed this report.

Many thanks for looking into this.
Fred