Fortran files: gedit code-comment plugin and gtksourceview

Bug #204547 reported by John M
2
Affects Status Importance Assigned to Milestone
gedit-plugins (Ubuntu)
Confirmed
Low
Unassigned

Bug Description

Binary package hint: gedit-plugins

Hi,

I just installed the beta of Hardy Heron, and have a couple of comments regarding gedit:

In Gutsy, the gedit code-comment plugin was unable to comment/uncomment Fortran files (*.f90, *.f95, etc.), although that option used to be available in Feisty ---I thought it was related to the "sort-of-beta" status of gktsourceview-2.0, so my solution was simply to add an old version of codecomment.* to my plugins folder. The problem still persists in Hardy.

Also, I noticed that the gedit version that comes with Hardy is unable to identify an *.f90 file as Fortran source, if the file starts with "!-" (without the quotes) , as in the following:

!-------------------------------------------------------------------------------
program hello
   print *, 'Hello world!'
end program
!-------------------------------------------------------------------------------

In those cases the mime type, according to the the tooltip, is text/x-vhdl, instead of text/x-fortran. It looks like gedit/gtksourceview is not considering the file extension at all.

John.

...:~$ lsb_release -rd
Description: Ubuntu hardy (development branch)
Release: 8.04

...:~$ apt-cache policy gedit
gedit:
  Installed: 2.22.0-0ubuntu1
  Candidate: 2.22.0-0ubuntu1
  Version table:
 *** 2.22.0-0ubuntu1 0
        500 http://us.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

...:~$ apt-cache policy libgtksourceview2.0-0
libgtksourceview2.0-0:
  Installed: 2.2.0-0ubuntu1
  Candidate: 2.2.0-0ubuntu1
  Version table:
 *** 2.2.0-0ubuntu1 0
        500 http://us.archive.ubuntu.com hardy/main Packages
        100 /var/lib/dpkg/status

Revision history for this message
John M (jwmwalrus) wrote :

There are two new issues, besides the one I pointed out above, with the way gedit highlights Fortran files:

-If the file extension is F90 (instead of f90) and the file was originally written in MS-Windows, it is clasiffied as a MATLAB file (mime: text/x-matlab)

-If the file extension is f or F, the file is not highlighted at all (i.e., the mime is text/plain).

Revision history for this message
Daniel T Chen (crimsun) wrote :

Is this symptom still reproducible in 8.10 or 9.04?

Changed in gedit-plugins:
status: New → Incomplete
Revision history for this message
John M (jwmwalrus) wrote : Re: [Bug 204547] Re: Fortran files: gedit code-comment plugin and gtksourceview

Hi,

I'm still using Hardy (Network Manager issues in Intrepid make it
unusable), and it's still too early for me to test 9.04.

In Hardy, the code-comment plugin now works as expected ---although
there are two extra entries in the Edit menu for commenting code
(<Ctrl><Alt>C and <Ctrl><Alt>U), and those don't work.

The source is still taken as text/x-vhdl if the first two characters
in the source file are "!-" (without the quotes).

I added some missing extensions to the freedesktop.org.xml file
(*.f03; *.fpp and so on) and also modified the fortran.lang file
---I'm no xml expert so I don't know if modifying it made things
worse... although it seems to work. The file is attached. That's it.

John.

...:~$ lsb_release -rd
Description: Ubuntu 8.04.1
Release: 8.04
...:~$ apt-cache policy gedit
gedit:
   Installed: 2.22.3-0ubuntu1
   Candidate: 2.22.3-0ubuntu1
   Version table:
  *** 2.22.3-0ubuntu1 0
         500 http://us.archive.ubuntu.com hardy-updates/main Packages
         100 /var/lib/dpkg/status
      2.22.1-0ubuntu1 0
         500 http://us.archive.ubuntu.com hardy/main Packages
...:~$ apt-cache policy libgtksourceview2.0-0
libgtksourceview2.0-0:
   Installed: 2.2.2-0ubuntu1
   Candidate: 2.2.2-0ubuntu1
   Version table:
  *** 2.2.2-0ubuntu1 0
         500 http://us.archive.ubuntu.com hardy-updates/main Packages
         100 /var/lib/dpkg/status
      2.2.1-1 0
         500 http://us.archive.ubuntu.com hardy/main Packages

At 04:24 PM 12/3/2008, you wrote:

>Is this symptom still reproducible in 8.10 or 9.04?
>
>** Changed in: gedit-plugins (Ubuntu)
> Status: New => Incomplete
>
>--
>Fortran files: gedit code-comment plugin and gtksourceview
>https://bugs.launchpad.net/bugs/204547
>You received this bug notification because you are a direct subscriber
>of the bug.

Revision history for this message
Pedro Villavicencio (pedro) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering is this still an issue for you? Could you try the same with Karmic or Jaunty? Thanks in advance.

Changed in gedit-plugins (Ubuntu):
importance: Undecided → Low
Revision history for this message
John M (jwmwalrus) wrote :

Hi,

The issue with wrong mime type assignment due to "!-" or uppercase file extension is solved in Jaunty (and, so far, it's working just fine in Karmic Alpha 4). Although the syntax highlighting still misbehaves. For example:

^program test
^character arg
^call testsub(arg)
^case('a')
^case default
^cycle
^end program test

All the lines within the program block are highlighted as comments ---according to the fortran.lang file incluided with Jaunty and Karmi (alpha 4), that's due to a "hack to avoid considering ^COMMON a comment". The hack, at line 46, is:

      <start>!|(^[Cc](\b|[^Oo]))</start>

A better form would be:

      <start>!|^[*]|(^[Cc](\b|[^OoAaHhYyLl]))</start>

Although there might be better ways (I've never been good at regular expressions).

Also, there are some missing keywords (in regards to Fortran 95; e.g., ALLOCATE, DEALLOCATE, DEFAULT, INTERFACE...) and none of the Fortran 2003 keywords are included (e.g., BIND).

GFortran has supported the Fortran 2003 ISO C Bindings (among other Fortran 2003 features) since 2006 at least, so it's about time they're included in the gtksourceview file.

My version of the fortran.lang file was attached to a previous post in this bug report (it includes the new hack and the missing keywords, among others); it can be used to improve the current version of the fortran.lang file a little bit.

Revision history for this message
John M (jwmwalrus) wrote :
Revision history for this message
Pedro Villavicencio (pedro) wrote :

thanks, marking the report as confirmed.

Changed in gedit-plugins (Ubuntu):
status: Incomplete → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.