Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#3741 Edit mode matching by exact filename does not work

closed-fixed
Dale Anson
5
2012-09-20
2012-08-29
EdorFaus
No

Some edit modes have a specific filename (without any wildcards) as its FILE_NAME_GLOB in the catalog file, because those files always have the same name - e.g. CMakeLists.txt for the cmake mode.

However, this does not seem to function as intended - when I open a file named CMakeLists.txt it ends up using the "text" mode instead of the "cmake" mode.

This happens with custom modes defined in the catalog file in the user's settings dir as well, so the problem does not seem to be limited to that particular edit mode. A bit of testing suggests that modes with a matching FIRST_LINE_GLOB seems to be preferred over exact filename matches, regardless of order, while exact filepath matches work as expected (when the full path to the file (not just its name) is given in the FILE_NAME_GLOB) - but that doesn't help for cases like the CMakeLists.txt file, which can be anywhere.

I've attached an activity log from a run of jedit -nosettings where I opened a CMakeLists.txt file and observed the problem.

This is in jEdit 4.5.2 on Linux, with Java 1.6.0_24, and only the QuickNotepad extension loaded (due to the -nosettings param).

To reproduce:
- create a CMakeLists.txt file somewhere (content shouldn't matter)
- open it in jEdit
- check which edit mode is active

Expected result: edit mode should be "cmake"

Actual result: edit mode is "text"

Discussion

  • EdorFaus
    EdorFaus
    2012-08-29

    Log of a jEdit run reproducing the problem.

     
    Attachments
  • Dale Anson
    Dale Anson
    2012-09-20

    • assigned_to: nobody --> daleanson
     
  • Dale Anson
    Dale Anson
    2012-09-20

    • status: open --> closed-fixed
     
  • Dale Anson
    Dale Anson
    2012-09-20

    Fixed in revision 22224. I'd noticed the same thing with maven files, which are almost always named "pom.xml".