GNU bug report logs -
#3729
f90-mode indentation
Previous Next
Full log
Message #10 received at 3729 <at> emacsbugs.donarmstrong.com (full text, mbox):
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.
This bug report was last modified 12 years and 172 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.