#471 Make it easier to add language modes

none
closed-fixed
Dale Anson
None
5
2015-08-10
2013-07-26
No

Currently, adding new modes involves some pretty complicated steps:

1. Putting the files in the right place
2. Editing the catalog

To make this better, jEdit should offer a "Install mode" menu where users can select a file which jEdit them puts int he right place.

Also, jEdit shouldn't depend on a catalog file or at least it shouldn't require users to edit it themselves.

I suggest that jEdit should load all modes automatically. Please move the FILE_NAME_GLOB option to the root MODE element of the mode.

If a mode consists of several files, they should be put into a single JAR file with the XML being in mode.xml in the root of the archive.

Dropping a mode file/archive into the mode folder should be enough to install it. If necessary, you can add a prefs page where modes can be en-/disabled.

It would also be nice to wrap the loading of a mode in a single try-catch and disable the mode if there were any errors loading it. Currently, problems in the mode. I forgot to copy a DTD file that was referenced 50 times and that forced me to click 50 error dialogs...

Discussion

  • Alan Ezust
    Alan Ezust
    2013-10-22

    • status: open --> open-accepted
     
  • Alan Ezust
    Alan Ezust
    2013-12-09

    Another idea is to add an API to let plugins provide additional edit modes that can override built-in edit modes.

     
  • Dale Anson
    Dale Anson
    2015-08-09

    • assigned_to: Dale Anson
    • Group: --> none
     
  • Dale Anson
    Dale Anson
    2015-08-09

    Lots of good ideas here, my comments are inserted with +++++:

    Currently, adding new modes involves some pretty complicated steps:
    1. Putting the files in the right place
    2. Editing the catalog

    To make this better, jEdit should offer a "Install mode" menu where users can select a file which jEdit them puts int he right place.
    +++++ I'm thinking to add an "Add Mode" button to Global Options/Editing. This is where modes are currently adjusted by the user.

    Also, jEdit shouldn't depend on a catalog file or at least it shouldn't require users to edit it themselves.
    +++++ The catalog file is useful in that it lets jEdit know about all the modes (currently 223) without having to actually load them all, that's 18KB versus 3.2MB. Modes are then loaded dynamically as they are actually needed. I think the "Add Mode" button should show a dialog that collects the info needed to add an entry to the catalog and writes that entry without the user needing to edit it by hand.

    I suggest that jEdit should load all modes automatically. Please move the FILE_NAME_GLOB option to the root MODE element of the mode.
    +++++ No, see my comment above. There is no need to load 223 modes when the user is only editing 2 or 3 kinds of files. Further, the file name and first line globs are editable in Global Options/Editing, which is handy in several use cases and doesn't require the user to edit the mode file itself.

    If a mode consists of several files, they should be put into a single JAR file with the XML being in mode.xml in the root of the archive.
    +++++ I don't know of any mode file that consists of several files. Many mode files do delegate to other mode files, e.g. html delegates to javascript and css as needed, but it doesn't make sense to bundle these together since these modes may be used as delegates from other modes. For example, the javascript mode is used as a delegate in 18 other mode files.

    Dropping a mode file/archive into the mode folder should be enough to install it. If necessary, you can add a prefs page where modes can be en-/disabled.
    +++++ This would require the mode files to have name, file name glob, and first line glob as part of the mode file, which isn't currently supported. While it wouldn't be difficult, it would be tedious to go back through the 223 current modes and retrofit them with these values. I think going with an explicit "Add Mode" button is a better route. I also think adding a "Disable mode" check box to the Global Options/Editing area is a good idea.

    It would also be nice to wrap the loading of a mode in a single try-catch and disable the mode if there were any errors loading it. Currently, problems in the mode. I forgot to copy a DTD file that was referenced 50 times and that forced me to click 50 error dialogs...
    +++++ Yes, this needs to be done.

    +++++ One last comment, this adding a mode option would only add modes to the modes in the users settings directory and would not add the modes to the jEdit installation itself.

     
  • Dale Anson
    Dale Anson
    2015-08-10

    Fixed in revision 23980.

     
  • Dale Anson
    Dale Anson
    2015-08-10

    • status: open-accepted --> closed-fixed