unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#345: Bug in F90 mode
@ 2008-06-01 13:57 ` Gabor Toth
  2008-06-02 20:40   ` bug#345: marked as done (Bug in F90 mode ) Emacs bug Tracking System
  0 siblings, 1 reply; 2+ messages in thread
From: Gabor Toth @ 2008-06-01 13:57 UTC (permalink / raw)
  To: bug-gnu-emacs

Dear GNU emacs developers,

I truly appreciate the work put into the emacs editor. This is the  
editor of choice for editing source code files because of the many  
advanced features that help programmers. I have been using the F90  
module for a long time and I encountered a small but annoying bug. I  
tried to work around it, but I could not.

The bug is present in every version of emacs I know of. It is a bug  
in the F90 module. To reproduced the bug, simply create a file  
with .f90 extension, say

bug.f90

open the file, and type the following lines

program bug

    AnyVariable = 1.0
    TypeVariable = 2.0
        OtherVariable = 3.0

    end program bug

and let Emacs indent it (by hitting TAB at the beginning of each  
line). The result is what you see above, ie the lines following the  
TypeVariable = 2.0 line are indented.

The reason is that if a line starts withTypeXXX the F90 module  
regards it as a type definition, although it is not matched when an  
end statement is typed. I suspect that the error is in the definition  
of f90-type-def-re in the f90.el file. The definition is

(defconst f90-type-def-re
   "\\<\\(type\\)\\([^(\n]*\\)\\(::\\)?[ \t]*\\b\\(\\sw+\\)")

It seems that this regular expression is too permissive. The [^(\n]**  
part matches anything that follows the "type" string except for  
opening paren and end-of-line. This should probably be replaced with  
[ \t]*

I would be greatful if you could suggest a work around that I can put  
into my .emacs file. My attempts at redefining the f90-type-def-re  
did not work. I managed to set the indentation to 0 for type/ 
interface/blockdata definitions to avoid this problem, but then the  
true type and interface definitions will not be indented, and that's  
pretty ugly. We have some huge F90 codes, and not allowing variables  
to start with the string "type" is not an option.

Thanks for your work and kind help,

Gabor Toth
Research scientist
University of Michigan








^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#345: marked as done (Bug in F90 mode )
  2008-06-01 13:57 ` bug#345: Bug in F90 mode Gabor Toth
@ 2008-06-02 20:40   ` Emacs bug Tracking System
  0 siblings, 0 replies; 2+ messages in thread
From: Emacs bug Tracking System @ 2008-06-02 20:40 UTC (permalink / raw)
  To: Glenn Morris

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]


Your message dated Mon, 02 Jun 2008 16:29:59 -0400
with message-id <b5hccb37i0.fsf@fencepost.gnu.org>
and subject line Re: bug#345: Bug in F90 mode
has caused the Emacs bug report #345,
regarding Bug in F90 mode 
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
345: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=345
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 3863 bytes --]

From: Gabor Toth <GTOTH@UMICH.EDU>
To: bug-gnu-emacs@gnu.org
Subject: Bug in F90 mode
Date: Sun, 1 Jun 2008 09:57:27 -0400
Message-ID: <7638BF9C-95FC-4104-980B-FEAED84AEF63@UMICH.EDU>

Dear GNU emacs developers,

I truly appreciate the work put into the emacs editor. This is the  
editor of choice for editing source code files because of the many  
advanced features that help programmers. I have been using the F90  
module for a long time and I encountered a small but annoying bug. I  
tried to work around it, but I could not.

The bug is present in every version of emacs I know of. It is a bug  
in the F90 module. To reproduced the bug, simply create a file  
with .f90 extension, say

bug.f90

open the file, and type the following lines

program bug

    AnyVariable = 1.0
    TypeVariable = 2.0
        OtherVariable = 3.0

    end program bug

and let Emacs indent it (by hitting TAB at the beginning of each  
line). The result is what you see above, ie the lines following the  
TypeVariable = 2.0 line are indented.

The reason is that if a line starts withTypeXXX the F90 module  
regards it as a type definition, although it is not matched when an  
end statement is typed. I suspect that the error is in the definition  
of f90-type-def-re in the f90.el file. The definition is

(defconst f90-type-def-re
   "\\<\\(type\\)\\([^(\n]*\\)\\(::\\)?[ \t]*\\b\\(\\sw+\\)")

It seems that this regular expression is too permissive. The [^(\n]**  
part matches anything that follows the "type" string except for  
opening paren and end-of-line. This should probably be replaced with  
[ \t]*

I would be greatful if you could suggest a work around that I can put  
into my .emacs file. My attempts at redefining the f90-type-def-re  
did not work. I managed to set the indentation to 0 for type/ 
interface/blockdata definitions to avoid this problem, but then the  
true type and interface definitions will not be indented, and that's  
pretty ugly. We have some huge F90 codes, and not allowing variables  
to start with the string "type" is not an option.

Thanks for your work and kind help,

Gabor Toth
Research scientist
University of Michigan





[-- Attachment #3: Type: message/rfc822, Size: 1977 bytes --]

From: Glenn Morris <rgm@gnu.org>
To: Gabor Toth <GTOTH@UMICH.EDU>
Cc: 345-done@emacsbugs.donarmstrong.com
Subject: Re: bug#345: Bug in F90 mode
Date: Mon, 02 Jun 2008 16:29:59 -0400
Message-ID: <b5hccb37i0.fsf@fencepost.gnu.org>

Gabor Toth wrote:

> The bug is present in every version of emacs I know of.

I can't reproduce it in Emacs 21.4, 22.1 or 22.2.

(The CVS trunk does have a separate problem here; funny coincidence.)

> (defconst f90-type-def-re
>   "\\<\\(type\\)\\([^(\n]*\\)\\(::\\)?[ \t]*\\b\\(\\sw+\\)")

This form was replaced 6 years ago, ie in Emacs 21.3.

I strongly advise you to use a more recent version of Emacs (the
latest is 22.2), where we have the equivalent of:

(setq f90-type-def-re "\\<\\(type\\)\\>\\(?:[^()\n]*::\\)?[ \t]*\\(\\sw+\\)")


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-06-02 20:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <b5hccb37i0.fsf@fencepost.gnu.org>
2008-06-01 13:57 ` bug#345: Bug in F90 mode Gabor Toth
2008-06-02 20:40   ` bug#345: marked as done (Bug in F90 mode ) Emacs bug Tracking System

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).