First “release” of the rev-mode package

A week or so ago I attended a workshop on the RevBayes platform on graphic probabilistic models for evolutionary biology held at the Museo Argentino de Ciencias Naturales. There is abundant literature documenting the theory behind the design of RevBayes, that can be thought as MrBayes with steroids with a completely-different design based on the theory of probabilistic graphs; an appealing theory of model specification with a big deal of application in phylogenetics and related fields.

One major drawback of it is that it lacks an interpreter with code redirection capabilities (mostly for MS Windows, where the batch mode does not support copy-paste capabilities); however, Dr. Höhna has just released RevStudio, an IDE for the Rev language with code redirection (for Windows and Mac), pretty much the same thing as RStudio is for the R language. Although its design targets Windows users (and maybe MacOS ones too), it still lacks support for Linux, and therefore, I started to develop a linux-based interpreter with IDE capabilities under a GNU-based system.

As I already use Emacs, I decided that it was pretty simple to develop a major mode for the Rev language with all the basic features for an IDE, that is, an interpreter, code redirection, and (soon to be implemented) syntax aesthetics. I basically constructed a Frankenstein of julia-mode (for the rb process) as well as essh (mostly for code redirection). With these tools at hand, a Rev IDE could be set up “nearly” running smoothly.

Syntax highlight (feature pending, actually), auto-completion (pending, too), and command redirection features are expected to work in this mode to provide a development environment for RevBayes.

At this moment it just runs, provided that you include the following in your .emacs file or wherever appropriate:

(add-to-list 'load-path "/path/to/rev-mode")
(require 'rev-mode)                                                    ;;
(defun rev-mode-sh-hook ()                                             ;;
  (define-key sh-mode-map "\C-c\C-r" 'pipe-region-to-rev)        ;;
  (define-key sh-mode-map "\C-c\C-b" 'pipe-buffer-to-rev)        ;;
  (define-key sh-mode-map "\C-c\C-j" 'pipe-line-to-rev)          ;;
  (define-key sh-mode-map "\C-c\C-n" 'pipe-line-to-rev-and-step) ;;
  (define-key sh-mode-map "\C-c\C-f" 'pipe-function-to-rev))      ;;
(add-hook 'sh-mode-hook 'rev-mode-sh-hook)
;; setup files ending in “.rev” to open in rev-mode
(add-to-list 'auto-mode-alist '("\\.rev\\'" . rev-mode))

How to use

First of all be sure that RevBayes is already installed in your system and that it is in your path so that you can call it from the command line. At present rev-mode does run automatically so first you will need to open a .rev file (it will be recognized as rev-mode); this unfortunately opens a terminal buffer that is unnecessary but also harmless as all the code redirection goes directly to the rb process. You will need to start a RevBayes process with M-x run-rev; this will open a command line interpreter of the rb program. Afterwards just use the keystroke combinations described above.

You can download rev-mode from


Author: gaballench

Ictiólogo con interés en informática y música, simpatizante de iniciativas open source.

One thought on “First “release” of the rev-mode package”

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s