Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.F77 file extension does not syntax highlight #3425

Closed
RolandHughes opened this issue Mar 7, 2023 · 15 comments · Fixed by #3427
Closed

.F77 file extension does not syntax highlight #3425

RolandHughes opened this issue Mar 7, 2023 · 15 comments · Fixed by #3427
Labels
can't reproduce A developer couldn't reproduce the issue
Milestone

Comments

@RolandHughes
Copy link

Source files with uppercase .F77 file extension do not syntax highlight when opened. .F90 works perfectly.

f77-bug-001
f77-bug-002
f77-bug-003
f77-bug-004

@elextr
Copy link
Member

elextr commented Mar 7, 2023

Well its not listed here. I guess the people who made that filetype didn't accept it.

Tools->Configuration Files->filetype_extensions.conf and add it to your own copy.

@RolandHughes
Copy link
Author

RolandHughes commented Mar 7, 2023 via email

@elextr
Copy link
Member

elextr commented Mar 7, 2023

I presume you removed the comments (the #~ ) from the [extensions] heading and the F77= line?

@RolandHughes
Copy link
Author

RolandHughes commented Mar 7, 2023 via email

@elextr
Copy link
Member

elextr commented Mar 7, 2023

What system are you running Geany on?

What filetype shows in the status bar for one of those files?

And I presume you put *.F77 in the pattern? And remembered the ; ending?

@RolandHughes
Copy link
Author

RolandHughes commented Mar 8, 2023 via email

@elextr
Copy link
Member

elextr commented Mar 8, 2023

For the .F77 file

f77 bottom of window

What? Thats not a Geany filetype, the Geany filetype is F77 (filetypes are case sensitive) Are you loading a custom filetype?

For the .f77 file

.f77 bottom of window

Again, thats not a Geany filetype, none have a . at the start.

It looks like its finding something as a filetype, but not the right thing.

What version of Geany? Do you have any custom filetypes?

PS you have been caught by the github edit trap, I added a couple of extra questions to my previous comment, but github doesn't email edits, so you missed them. Its always best to go to github, not answer the email.

@RolandHughes
Copy link
Author

What a crummy email interface GitHub has!!!!!!
I couldn't understand your questions but this (&)(&)(*& strips out images from email. I use images so we don't end up going down a terminology rabbit hole. Kind of like you asking for a "Geany filetype" without explaining what you mean. I've been in IT over 30 years writing software on many platforms and given the pictures I provided I had no clue what you were asking. Now I realize you never saw the pictures. GitHub really is barbaric.

I'm dealing with relative in hospital. Can check email, but cannot always get to GitHub and even if I could would need screen shots from this machine in office.

So, from the beginning: System

f77-bug-001

Configured file types
f77-bug-030

That was only uncommented with .F77 added after Geany failed to recognize .F77 as a Fortran 77 file extension.

.F90 file extension worked out of the box
f77-bug-003
f77-bug-032

.F77 file extension does not, even with the addition in ~/.config/geany/filetype_extensions.conf and a restart of Geany
f77-bug-004
f77-bug-010

If I save that exact file with a .f77 file extension Geany likes it.
f77-bug-033
f77-bug-034

Even if I change the system level file and restart Geany, it does not like files with .F77 extension.
f77-bug-035
f77-bug-036

When I went back in for grins and giggles to my local .conf and added *.F78; after the *.F77; then saved, Geany now started liking .F77 files. Didn't have to exit at all.

Here is a short .F77 file if you wish to test.

FTN_FILL_IN_LOGICALS.F77

        SUBROUTINE FTN_FILL_IN_LOGICALS
        IMPLICIT NONE
C
C       Subroutine to fill in all of the logicals needed by the 
C       Mega_Zillionare application when written in fortran
C

        INCLUDE 'SYS$LIBRARY:FORSYSDEF(LIB$ROUTINES)'

C;;;;;
C       Fill in default file names
C;;;;;
        CHARACTER*12    DRAWING_DATA
        DATA DRAWING_DATA/'MY_MEGA_FILE'/

        CHARACTER*13    DRAWING_STATS
        DATA DRAWING_STATS/'DRAWING_STATS'/

        CHARACTER*10    MEGA_STATS
        DATA MEGA_STATS/'MEGA_STATS'/ 



        CHARACTER*255   TRANSLATED_NAME_STR, WORK_STR
        CHARACTER*1     FIRST_CHAR
        INTEGER*4       L_X
        INTEGER*2       W_X
        LOGICAL         IS_BLANK_LG


C;;;;;
C       Make certain the drawing_data logical exists
C       if not, give it a value in the local directory
C;;;;;
        TRANSLATED_NAME_STR = ' '
        L_X = LIB$GET_LOGICAL( DRAWING_DATA, TRANSLATED_NAME_STR, 
     1          W_X,,,,)


        FIRST_CHAR = TRANSLATED_NAME_STR
        IS_BLANK_LG = FIRST_CHAR .EQ. ' '

        IF (IS_BLANK_LG) THEN
            TRANSLATED_NAME_STR = DRAWING_DATA // '.IDX'
            L_X = LIB$SET_LOGICAL( DRAWING_DATA, 
     1              TRANSLATED_NAME_STR,,,)
        END IF


        TRANSLATED_NAME_STR = ' '
        L_X = LIB$GET_LOGICAL( DRAWING_STATS, TRANSLATED_NAME_STR, 
     1          W_X,,,,)


        IF (TRANSLATED_NAME_STR(1:1) .EQ. ' ') THEN
            TRANSLATED_NAME_STR = DRAWING_STATS // '.IDX'
            L_X = LIB$SET_LOGICAL( DRAWING_STATS, 
     1              TRANSLATED_NAME_STR,,,)
        END IF



        TRANSLATED_NAME_STR = ' '
        L_X = LIB$GET_LOGICAL( MEGA_STATS, TRANSLATED_NAME_STR, 
     1          W_X,,,,)


        FIRST_CHAR = TRANSLATED_NAME_STR

        IF (FIRST_CHAR .EQ. ' ') THEN
            TRANSLATED_NAME_STR = MEGA_STATS // '.IDX'
            L_X = LIB$SET_LOGICAL( MEGA_STATS, 
     1              TRANSLATED_NAME_STR,,,)
        END IF


        RETURN
        END

This acts like multiple things are going on.

  1. Geany stores whatever syntax it was using and never checks again until a "new" .conf requires a reload. Stopping and starting Geany will not "fix" an existing opened file.
  2. There is some kind of parsing error for the F77 geany type that doesn't like *.F77; if it is the last thing in the line. I mean I tried opening many different files after changing both local .conf and system without Geany recognizing .F77 as an F77 file.
  3. Something else I haven't tracked down.

On the big systems
*.F is common for Fortran IV or earlier (Yes, lots of that still in production.)
*.FIV for shops that were straddling the change between Fortran IV and Fortran 77
*.F77 for Fortran 77.
We always used upper case because that is all the early terminals had.

I hope this answers all of the questions.

As a workaround, if these file extensions could just be "functional" in the base package the other issues wouldn't surface.

@elextr
Copy link
Member

elextr commented Mar 8, 2023

What a crummy email interface GitHub has!!!!!!

No argument, it should remove it and just be a website with email notifications.

Kind of like you asking for a "Geany filetype" without explaining what you mean.

"Filetype" is basic terminology used throughout the Geany manual and UI (Document->Set Filetype-> ... etc ) and is displayed in the status bar as filetype: F77 as your new image shows and thats explicitly what I asked for: "What filetype shows in the status bar for one of those files?". Sadly your original images did not show the status bar but your new one does and it correctly shows F77.

Images have their uses, but should be used sparingly, you are spamming everybody watching the repo with them and as above they often omit the important part.

Thank you for the example, for the same reason as above, next time please put it in a Gist and just paste the link here.

The example highlights here when opened after I add *.F77; to the filetype.extensions file.

Geany stores whatever syntax it was using and never checks again until a "new" .conf requires a reload. Stopping and starting Geany will not "fix" an existing opened file.

What I think you call the "syntax" is the "filetype" we are talking about, and yes Geany will not change the filetype of an opened file, because a user can set the filetype and it should not therefore be changed. That is preserved in the Geany session and therefore over restart. You can either set it yourself, or close and re-open the file.

... changing both local .conf and system ...

If you mean you edited the files directly instead of the suggested method here? If so you need to reload configuration, or restart Geany to load the edited config file, whereas using the menu does it automatically on save. Then you also need to re-open the file to have its filetype autodetected again.

There is some kind of parsing error for the F77 geany type that doesn't like *.F77; if it is the last thing in the line.

Works here, the F77 line in my filetype.extensions is exactly the same as that shown in your image and your example (saved as /tmp/untitled.F77) works. I am not sure where the problem is, I can't see your setup, but the parsing of conf files is performed by the Glib library that is in use everywhere GTK is, not Geany code, so its unlikely it has such an obvious bug as missing the end of the list. I suspect a procedure issue as explained above which was cured when you made an additional change.

As a workaround, if these file extensions could just be "functional" in the base package the other issues wouldn't surface.

Not sure what you mean, is that "functional" as in functional languages like Haskell or what?

The filetype extensions are specified in a configuration file exactly to cater for examples like this, where a specific use-case needs additional extensions, and to allow users to tailor the annoying case of two applications using the same extension (Matlab and Objective C .m for example).

I've been in IT over 30 years writing software on many platforms and given the pictures I provided I had no clue what you were asking.

Well as I have 15+ more years experience than you I guess I can call you a newby 😄

But its very likely that whoever contributed the fortran filetype and extensions list was even younger and had never heard of VMS, or a Teletype, (ASR33 anybody?) so since .F77 isn't listed as an extension for GNU gfortran (but .f77 is) it wasn't added to the list. Geany is a volunteer project and people contribute what they know about.

@b4n
Copy link
Member

b4n commented Mar 9, 2023

Geany stores whatever syntax it was using and never checks again […]. Stopping and starting Geany will not "fix" an existing opened file.

Isn't that the only real issue here? No, Geany won't change the file type of a loaded file, even on restart, so long as it's part of the session. To force redetection, the simplest solution is to close and reopen the file.

So if you had your .F77 file open all along, no, changing the extensions lists will not have helped. Of course, when you added .F78 I guess you loaded such a file afterwards and thus it worked.

Have you tried to open .F77 files you never had before, or Close each file and reopen them? I really can't figure out why .F77 in particular would give you trouble…

@RolandHughes
Copy link
Author

Geany stores whatever syntax it was using and never checks again […]. Stopping and starting Geany will not "fix" an existing opened file.

Isn't that the only real issue here?

No. I had many files to choose from. I closed all that were open. I bounced Geany and chose different .F77 files. I just replicated the entire problem on this system as well.
f77-bug-100

I made the change to extensions, saved the file, bounced Geany, loaded a completely different .F77 file and had it not highlight. When *.F77; isn't dead last in the list, it works. When it is dead last highlighting does not work.

At this point I'm done. I've reported the bug, reproduced the bug on an entirely different system, and answered questions. I use pictures so I don't get pulled into a terminology war and now I'm being pulled into a terminology war. I always paste everything in the report because using something like Gist is exactly how critical information gets lost. Internet rot strikes without warning.

Thank you for your time.

I now have to go un-install Geany from the 6-8 machines that will be used for this project. They will either have to use Emacs to have a combined editor and GDB front end or split editor and GDB front end.

Fix it, don't fix it, I've reported it and replicated it on different OS.

@elextr
Copy link
Member

elextr commented Mar 9, 2023

As I said, works for me.

@elextr elextr added the can't reproduce A developer couldn't reproduce the issue label Mar 9, 2023
@elextr
Copy link
Member

elextr commented Mar 9, 2023

Although you have reported it, if we can't reproduce it we can't fix it. Seems there is something unusual about your system that doesn't occur here.

@elextr
Copy link
Member

elextr commented Mar 9, 2023

Note I also tested with LMDE 5 and the Geany it supplies, 1.37.1 as well as current git version, both worked.

@b4n
Copy link
Member

b4n commented Mar 9, 2023

OK, so, I still cannot reproduce the issue (yet I have a clue, see below), but I made #3427 to fix that for good and make it "functional by default".

Now, to what I think the issue is: looking at your screenshot of the filetype_extensions.conf file:
f77-bug-030
we don't really see clearly the symbols tree, but the piece we see 7 [30] refers to the F77 key: the line matches, and it should show up. However, it seems to be on the second row of the tree, which it should not. The tree should look like so:
f77stree
Notice that:

  • F77 is on the 3rd row
  • Extensions [4] above is wider so should show up in your capture.

This leads me to believe that the issue is that you did not uncomment the [Extensions] section on line 4.
Admittedly it's not obvious one has to do that, although @elextr mentioned it, but #3413 should improve the situation (and I believe, would have prevented you from most of the pain).

FWIW, this filetype_extensions.conf should suffice to solve the initial issue:

# Filetype extension configuration file for Geany
# Insert as many items as you want, separate them with a ";".
# See Geany's main documentation for details.
[Extensions]
F77=*.f;*.for;*.ftn;*.f77;*.F;*.FOR;*.FTN;*.fpp;*.FPP;*.F77;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't reproduce A developer couldn't reproduce the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants