Hello,

I just started with Maude (.maude), and I'm currently using gedit as the preferred editor. I do however have some questions I'm sure some here could answer for me.

How do I get it highlighted in gedit? I cant seem to find a way to highlight Maude... - or, I DID find a guide, but it was in Spanish, which I cant speak :D

Is there an editor that copes better with Maude, or does anyone have a clue on what to do to get the highlight?

All answers will be highly appreciated. :)

- Mop

Dani AI

Generated

A concise expert addendum that builds on 's helpful direction.

Creating a gtksourceview language-spec and a matching MIME entry is the right approach to get Maude highlighting in gedit. For an iterative workflow, develop the language XML in a per-user location (so root access is not required) and test against a small Maude sample file that contains the constructs intended to be highlighted (headers, declarations, rules, comments, strings). Validate the XML with a standard XML tool before installing; many highlighting problems come from malformed spec files rather than gedit itself.

When authoring the language file, start by isolating the simplest token classes: comment delimiters, string boundaries, and one small keyword list. Add contexts to prevent keyword matching inside strings or comments, and break large keyword sets into groups so the spec stays maintainable. Make sure the MIME identifier used by the language spec matches the MIME declaration so gedit can map file extensions to the syntax rules. If highlighting still fails, check XML validity, file permissions, and whether the system MIME database/cache needs refreshing; different gtksourceview/gedit versions use different directories, so confirm the correct version-specific locations.

If authoring XML seems tedious, look for community-contributed Maude grammars or editor modes (Emacs, Vim, Sublime/Atom/VS Code) that can be adapted or converted. The gtksourceview language-spec schema and examples are documented in the GNOME developer pages, and the shared MIME-info spec explains how MIME declarations are meant to be authored and refreshed: and shared-mime-info specification.

Recommended Answers

All 2 Replies

Perhaps put a request in to the gEdit developers for a maude highlight plugin?

Otherwise, you could make your own, which will involve creating an xml file describing the various rules of the language in /usr/share/gtksourceview-2.0/language-specs/ calling it maude.lang (take a look at a few of the other .lang files in that directory if you want to know how the xml should be structured). You also have to set up a new mime-type (another .xml file) for the .maude files and update your mime types database. which will allow gEdit to automatically highlight your .maude files according to the rules set out in maude.lang.

Anyway, offhand I can't remember where you have to put the xml file for the new mime type, or the command-line commands required to rebuild the mime-type database.

I had to manually set up Actionscript highlighting for gEdit on one of my linux boxes at home, so I've made some notes on how to do it. But I don't have it in front of me, so I'm operating purely from memory ATM. But if I get a chance tonight, I'll try firing up one of my Linux boxes and have a gander and repost with more info.

Cheers for now,
Jas.

Aha, got it!

As mentioned previously, you'll need to create an xml file called maude.lang and put it in the following location:
/usr/share/gtksourceview-2.0/language-specs/

If you take a look at the other .lang files already there, you can get a feel for how they work, ready for when you create your own.

You also need to set up a mime-type .xml file called maude.xml and save it to the following location:
/usr/share/mime/packages/

Again, take a look at a few of the existing ones to see how they're laid out and create yours to follow a similar fashion.

The final step is to rebuild your mime-type database. To do this open up a command-line and type the following command:
sudo update-mime-database /usr/share/mime
(obviously the sudo part only applies if you're using a debian/ubuntu derived distro, you might need to substitute that for su. or whatever else you use in order to run as root!)

Cheers for now,
Jas.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.