42   Emacs Modes for MOOS-IvP Mission and Behavior Files


42.1 Using the Emacs MOOS Mode
42.2 Adding Your Own Apps and Behaviors to the Modes
42.3 Using the Emacs MOOS Mode in Older MOOS-IvP Releases
42.4 Further Emacs Links
42.5 Contact Information


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 42.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.

42.1   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.

42.2   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

42.3   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.

42.4   Further Emacs Links    [top]


42.5   Contact Information    [top]


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


Page built from LaTeX source using the texwiki program.