bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#3729: f90-mode indentation


From: Glenn Morris
Subject: bug#3729: f90-mode indentation
Date: Tue, 30 Jun 2009 21:51:12 -0400
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

reassign 3729 emacs,f90
tags 3729 wontfix
stop

Evangelos Evangelou wrote:

> The f90-mode indents by two spaces the code when the first non-comment
> line starts with include. For example, starting emacs with -Q flag and
> typing the following in f90-mode
>
> !! Comment
>
> include "file.f90"
>
> subroutine test (x)
>   real x
>   x = x+1.
>   return
> end subroutine test
>
> pointing in the first line and then running f90-indent-subprogram will
> indent all lines by 2. This is not the case (the correct) if the line 
>
> include "file.f90"
>
> was missing. I think there shouldn't be any indentation.


I think it's not that simple. The reason is, there is no need for a
leading "program" statement in Fortran. If there is any non-comment
line at the "top-level" (outside of a function, subroutine, etc) at
the start of the file, f90 mode assumes it is dealing with a program
without an explicit start.

Consider the following two cases:

1)

  !! Program without an explicit PROGRAM statement.
  !! Everything from the start of the file is implicitly inside the program.
  include "stuff.f90"

  write (*,*) 'hi'

end program


2)

!! Program with an explicit program statement.
!! This comment is outside the program

program foo

  !! This comment is inside the program.
  include "stuff.f90"
  write (*,*) 'hi'

end program foo


The present behaviour is designed to make these two cases indent in
the same way. The behaviour is not specific to "include"; any
non-comment code will make F90 mode think this is a program.

I don't see any simple way to distinguish between your example and
case 1 above. So I think the behaviour of f90-mode is unlikely to
change in this regard.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]