Help Topic: The Emacs MOOS Mode


Maintained by: mikerb@mit.edu         Get PDF


Emacs Modes for MOOS-IvP Mission and Behavior Files


The Emacs moos-mode was written by MIT student Jacob Gerlach in 2014, in Release 14.7, to provide syntax highlighting in Emacs for mission (.moos) files and behavior (.bhv) files. The aim is to make simple syntax errors easier to detect, before a mission is launched. Once a mission is launched there are other provisions for catching syntax errors, especially in appcast-enabled applications. The Emacs mode makes this a lot easier, especially for newcomers. The idea is shown in the figure below. Note how much easier it is, with highlighting on the right, to detect the syntax error in the first line of the pNodeReporter configuration.

Figure 1.1: The MOOS Emacs Mode: One the left is a sample mission file without syntax highlighting. On the right, highlighting is enabled. Note the syntax error in the first line of pNodeReporter is more apparent.

Using the Emacs MOOS Mode    [top]


The Emacs MOOS mode is implemented in three files distributed with MOOS-IvP source code:

  $ cd moos-ivp/editor-modes
  $ ls
    moos-apps.el  moos-bhvs.el  moos-mode.el

To use the mode in your Emacs session, just add a couple lines in your .emacs file like this:

  (add-to-list 'load-path "~/moos-ivp/editor-modes/")
  (require 'moos-mode)

The exact path on the first line above may depend on where you have moos-ivp checked out on your system.

Adding Your Own Apps and Behaviors to the Modes    [top]


At some point you may want to add your own MOOS applications to this mode. This can be done by adding further lines to your .emacs file, below the two lines mentioned above. For example, if you have a pFooBar app that has two parameters time and date, the following in your ~/.emacs file should do the trick:

  (add-to-list 'load-path "~/moos-ivp/editor-modes/")
  (require 'moos-mode)
  ...
  (moos-add-user-app '("pFooBar" "time" "date"))                <<-- Add this line

The operation is similar for IvP behaviors. If you have a behavior BHV_Smarty with parameters insight and intuition, the following in your ~/.emacs file should do the trick:

  (add-to-list 'load-path "~/moos-ivp/editor-modes/")
  (require 'moos-mode)
  ...
  (moos-add-user-bhv '("BHV_Smarty" "insight" "intuition"))     <<-- Add this line

Using the Emacs MOOS Mode in Older MOOS-IvP Releases    [top]


If you are working with an older release of MOOS-IvP, using the Emacs MOOS mode is still possible. Just download the three lisp files separately:

 svn co https://oceanai.mit.edu/svn/moos-ivp-aro/releases/moos-ivp-14.7/editor-modes

And adjust the line in your .emacs file accordingly. For the most part, the supported MOOS application names and parameters defined in these lisp files should be applicable with older releases of MOOS-IvP.

Further Emacs Links:

Contact Information    [top]


For bug reports, suggestions or feature requests, email Jake at jacobgerlach@gmail.com.


Document Maintained by: mikerb@mit.edu        
Page built from LaTeX source using texwiki, developed at MIT. Errata to issues@moos-ivp.org. Get PDF