Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write an emacs mode for a new language?

Tags:

emacs

mode

I would like to write an Emacs major mode for a 4GL. Can someone show me a tutorial? As far as I googled I was able to find only this broken:

link http://two-wugs.net/emacs/mode-tutorial.html

like image 697
Prabu Avatar asked Sep 18 '08 09:09

Prabu


People also ask

How do I change modes in Emacs?

A buffer may have multiple minor modes. To get a list of the all the available modes, both major and minor, on your system's version of Emacs, look up "mode" using Emacs' apropos command. Do this by pressing C-h a and entering the word mode .

How do I make Emacs major mode?

Usually, the major mode is automatically set by Emacs, when you first visit a file or create a buffer (see Choosing File Modes). You can explicitly select a new major mode by using an M-x command.

What languages does Emacs support?

Emacs has programming language modes for Lisp, Scheme, the Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++, Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, M4, Makefiles, Metafont (TeX's companion for font creation), Modula2, Object Pascal, Objective-C, Octave, Pascal, Perl, Pike, PostScript, ...


1 Answers

If you're lazy, one easy way is to extend generic-mode to know about your new language:

http://emacswiki.org/emacs/GenericMode

I do this a lot for config files for applications that I work with a lot to get decent syntax highlighting. Here's one I did for the asterisk PBX a long time ago as an example.

like image 139
bmdhacks Avatar answered Sep 28 '22 09:09

bmdhacks