Is the mode catalog still used?

50 views
Skip to first unread message

Thomas Passin

unread,
Nov 27, 2022, 3:18:02 PM11/27/22
to leo-editor
"Modes" are programming languages recognized by Leo, e.g., by the @language xx directive.  They are in the modes directory.  They are for the most part python files except for clojure.xml and markdown.xml.

In the directory there is also a file named catalog.  It lists most or (maybe all) of the .py files as entries.  The file starts with this comment:

<!-- This is a mode catalog. Edit modes must be listed here, -->
<!-- otherwise they will not be available to jEdit. -->

The entries look like this:

<MODE NAME="javascript"        FILE="javascript.xml"
                FILE_NAME_GLOB="*.js" />

Now here is the point that caught my attention.  Those FILE attributes all end in .xml, but there are no such .xml files in the leo directory tree.

I'm guessing that this catalog file was taken from jEdit or some other source and that Leo has never used those .xml files.  Leo could just directly look for *'py and .xml files in the directory and not ever need the catalog.

Is this speculation right, or does Leo actually use the catalog file?

Thomas Passin

unread,
Nov 27, 2022, 6:25:02 PM11/27/22
to leo-editor
I didn't find any "catalog" used in LeoPyRef.leo except for one plugin, and that used what was a clearly different catalog.  Maybe this answers the question...

Edward K. Ream

unread,
Nov 28, 2022, 4:08:36 AM11/28/22
to leo-e...@googlegroups.com
On Sun, Nov 27, 2022 at 2:18 PM Thomas Passin <tbp1...@gmail.com> wrote:

In the [leo/modes] directory there is also a file named catalog.  It lists most or (maybe all) of the .py files as entries.  The file starts with this comment:

<!-- This is a mode catalog. Edit modes must be listed here, -->
<!-- otherwise they will not be available to jEdit. -->

Good catch. Leo uses neither the catalog nor the xml files. Does VR 3 use either xml file?

Please issue a PR that deletes these files.

Edward

Edward K. Ream

unread,
Nov 28, 2022, 4:21:18 AM11/28/22
to leo-e...@googlegroups.com
On Mon, Nov 28, 2022 at 3:08 AM Edward K. Ream <edre...@gmail.com> wrote:

Please issue a PR that deletes these files.

See #2975. VR3 doesn't appear to use the xml files, so I'll create the PR myself.

Edward

Thomas Passin

unread,
Nov 28, 2022, 6:54:30 AM11/28/22
to leo-editor
VR3 does not use any of those files.  If Leo knows about any of the modes, VR3 can be modded to use them.  In fact, I'm thinking about allowing all the mode languages.  It would be a minor change to the code, so far as I can see.  Now, whether pygments can colorize every one of them in the rendered output, that I don't know.  Pygments supports a great number of languages, so we can hope ...

Edward K. Ream

unread,
Nov 29, 2022, 9:06:09 AM11/29/22
to leo-e...@googlegroups.com
On Mon, Nov 28, 2022 at 5:54 AM Thomas Passin <tbp1...@gmail.com> wrote:
VR3 does not use any of those files.  If Leo knows about any of the modes, VR3 can be modded to use them. 

Thanks for this heads up.

Edward
Reply all
Reply to author
Forward
0 new messages