emacs
Posted: 15 Jul 2011, 20:30
Elmeristas,
After years editing Elmer sif files with Emacs, I have realized today how easy is to create an Emacs mode for sif files and put a bit of colour in them.
This is my first attempt, essentially a copy and paste from the emacs generic mode tutorial in http://www.emacswiki.org/emacs/GenericMode . The following code have to be added to the ".emacs" file.
It doesn't work perfectly but comments, keywords and MATC expresions look great.
I am just wondering if anyone has been working on this and doesn't mind to share it. Comments welcomed!
After years editing Elmer sif files with Emacs, I have realized today how easy is to create an Emacs mode for sif files and put a bit of colour in them.
This is my first attempt, essentially a copy and paste from the emacs generic mode tutorial in http://www.emacswiki.org/emacs/GenericMode . The following code have to be added to the ".emacs" file.
Code: Select all
(require 'generic-x)
(define-generic-mode
'sif-mode ;; name of the mode to create
'("!" "#") ;; comments start with '!' or "#'
'("Header" "Constants" "Material" "End" "Solver" "Boundary Condition"
"Simulation" "Body" "Body Force" "Initial Condition" "Equation") ;; some keywords
'(("=" . 'font-lock-operator) ;; This doesn't do anything!
("$$" . 'font-lock-builtin) ;; or this!
("Real" "Logical" "String" "Integer" . 'font-lock-type-face)) ;; or this!
'("\\.sif$") ;; files for which to activate this mode
nil ;; other functions to call
"A mode for sif files" ;; doc string for this mode
)
I am just wondering if anyone has been working on this and doesn't mind to share it. Comments welcomed!