Hi all,
In the same idea as j.lhomme did for
Notepad++, I share here my configuration for editing cas files with Emacs (which is an extensible and customizable opensource cross-platform editor).
The shared files (link to download is at the end of the post) consist of a major mode written for telemac cas file edition, containing multiple text files and scripts.
Firstly, the telemac .dico files have been parsed and text files generated (with the python3 script: ~/.emacs.d/my-packages/telemac-mode/generate_files_from_all_dico.py).
This first step can be run again to use a different version of telemac, but the generated files (for telemac dico from V7P0R1) are included in the shared files.
The text files are then read by Emacs to define the telemac major mode (itself written in Emacs Lisp) for the different modules of telemac (artemis, postel3d, sisyphe, stbtel, telemac2d, telemac3d and tomawac).
The main features are:
* selection of module and language (to define the right keywords)
* syntax highlighting
* keyword auto-completion
* popup documentation/help of the current keyword (analyzes the current line)
The principle is the following:
The major telemac-mode should be active (can be set automatically with the .cas file extension) and then the functions are accessible (to change the module or the language for example).
It is possible to edit cas files with different modules and/or languages without mixing them (they are defined locally in each buffer).
The module and language are set automatically (deduced from the filename prefix if possible or with the default value), but should be set manually if necessary with the defined functions: telemac-set-module and telemac-toggle-lang.
A documentation is available in the upper commented part of the telemac-mode.el file.
Find below a screenshot combinaison to illustrate the features :
Finally, in parsing the dico files, I noticed some problems:
* keyword "OPTION FOR THE DISPERSION" (sisyphe) has no default value in english, but has one in french.
* "LISTING PRINTOUT PERIOD" (telemac2d) is a duplicated keyword in english, but has two different corresponding french keyword.
You will find below a minimal working example in a zip. It includes also the auto-complete Emacs package (which is a recommanded dependencies). After merging ith your ~/.emacs.d, it should work (but it requires a newer version of Emacs, if possible >=24).
A complete implementation example is also avaiblable on my
.emacs.d on github).
All suggestions and remarks are welcomed.
Hope it will be useful,
Regards,
Luc