Skip to content

GuillermoOlivera/modelica-mode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This directory contains extensions for Emacs supporting Modelica.
Modelica is a unified object-oriented language for physical systems modeling
(see http://www.Modelica.org).

This code has been written for use with Emacs and shares its licensing (See COPYING).

Emacs lisp code
===============
  modelica-mode.el     -- major mode for editing Modelica files

  mdc-browse.el        -- Modelica extension for the OO-Browser
  br-mdc.el               (see http://sourceforge.net/projects/oo-browser)

Installation
============

See the files modelica-mode.el and mdc-browse.el for installation
instuctions.

At least put the files
  modelica-mode.el
  mdc-browse.el
  br-mdc.el
to an Emacs lisp directory, e.g. ~/elisp

and add the following lines to your file ~/.emacs

;; Modelica mode
(setq load-path (cons "~/elisp" load-path))
(autoload 'modelica-mode "modelica-mode" "Modelica Editing Mode" t)
(setq auto-mode-alist (cons '("\.mo$" . modelica-mode) auto-mode-alist))

;; Enable Modelica browsing
(autoload 'mdc-browse "mdc-browse" "Modelica Class Browsing" t)
(autoload 'br-mdc "br-mdc" "Modelica Class Browsing" t)

(defvar br-env-lang-avector
  '[
    ("C++/C"   . "c++-")
    ("Eiffel"  . "eif-")
    ("Info"    . "info-")
    ("Java"    . "java-")
    ("Lisp"    . "clos-")
    ("Modelica" . "mdc-")
    ("Obj-C"   . "objc-")
    ("Python"  . "python-")
    ]
  "Association vector of elements of OO-Browser languages.")

;; Autostart OO-Browser (the installation is assumed under ~/oo-browser)
(setq load-path (append
		 '("~/oo-browser/"
		   "~/oo-browser/hypb/")
		 load-path))
(load "br-start")
(global-set-key "\C-c\C-o" 'oo-browser)


Modelica mode for Emacs
=======================

The aim is to provide basic support as known from many programming
languages under Emacs. This includes proper indentation, automated
closing of code blocks, movement by statements and code blocks,
support for writing comments, and syntax highlighting.


Tutorial introduction into OO-Browser for Modelica
==================================================

The following steps should be helpful to start investigating
OO-Browser for Modelica without the need to read its documentation
before. Please follow the installation instructions given above first.

Source files to browse can be placed in multiple directories, which
are grouped into library directories (for stable code to be re-used)
and system directories (for code under development). For now we will
just work with one system directory. Copy Modelica code examples there.

Now start Emacs and open one of the files in your directory.

-> select the menu item <OO-Browser -> Create-or-Load-Env>

It is prompted for the environment name.
-> Choose a name, e.g. hello-world.

It is prompted for the file to store class information in.
-> confirm the default name OOBR

Now you must choose a language to work with.
-> select Modelica

Finally specify system and library directories
(specify the current directory "." as the only system directory)

Hit RET to specify the code directories for the Environment
-> Return

Top-level system-specific code dir #1 (RET to end):
-> . Return

Top-level system-specific code dir #2 (RET to end):
-> Return

Top-level reusable code library dir #1 (RET to end):
-> Return

Now OO-Browser is ready to scan your Modelica files

Build Environment 'hello-world now? (y or n)
-> y

Build Environment in the background? (y or n)
-> n

Now all Modelica code files in the specified directories are scanned.
Afterwards a list with all obtained classes appears. Some basic
operations are:

- show ancestors and descendants of a class,
   e.g. click on a listed class name to show its definition,
        hit the "a" key to show ancestors
        (hit the "x" key to return to the list of all classes
         if ancestors were found)
        hit the "d" key to show descendants

- obtain information about classes
   e.g. hit the "i" key to obtain the class location and documentation

- view and edit class implementations
   e.g. hit the "v" key to view the implementation of a class
        hit the "e" key to edit the implementation of a class

- view class definition by clicking the Action Key
  (shift-left mouse button or shift-middle mouse button)
  over a class name in any buffer showing a Modelica file


Have fun!

Ruediger Franke <rfranke@users.sourceforge.net>

About

Extensions for Emacs supporting Modelica

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 100.0%