unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: Evangelos Evangelou <vangelis@email.unc.edu>
Cc: 3729@emacsbugs.donarmstrong.com
Subject: bug#3729: f90-mode indentation
Date: Tue, 30 Jun 2009 21:51:12 -0400	[thread overview]
Message-ID: <b6iqid188f.fsf@fencepost.gnu.org> (raw)
In-Reply-To: u4otxrji7.fsf@email.unc.edu

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	other threads:[~2009-07-01  1:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30 12:30 bug#3729: f90-mode indentation Evangelos Evangelou
2009-07-01  1:51 ` Glenn Morris [this message]
2009-07-01  1:55   ` Processed: " Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b6iqid188f.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=3729@emacsbugs.donarmstrong.com \
    --cc=vangelis@email.unc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).