The tntphylo-mode Emacs package

Since approximately mid-year I started developing an Emacs package for doing interactive work with RevBayes, a program for bayesian phylogenetic inference. Since then the project has grown steadily and now it’s in a better shape, with a cleaner setup and execution, and is about to be submitted to Melpa. However, this post is not about that package but instead concerns a new one more or less forked from rev-mode but this time to allow interactive work with TNT, a program for phylogenetic analysis using parsimony.

An arbitrary script with `tntphylo-mode` active

This first release ‘just works’ in the sense that some features are still unavailable; however, up to now the package is able to start a TNT process whenever there is a command for text redirection and there is still no process available, and if so, it redirects text from the active buffer (e.g., a TNT script) to the buffer with the process.

Sending the first three commands in the script to the TNT process with `C-c C-n`

Font locking is still derived from sh-mode and thus most of syntax formatting is not as nice as if it was deriving from c-mode; alternatively, at its current state, the package inherits the sh-mode redirection capabilities that are absent in c-mode (and with all reason, since C is a compiled language where you can’t carry out interactive work as opposed to interpreted languages). Long story short, we need the text redirection from sh-mode and syntax font locking from c-mode; and I’m still trying to figure out how to manage to accomplish such hybrid.

How to use it

  1. Get tntphylo-mode from
  2. Add the following to your .emacs
(add-to-list 'load-path "path/to/tntphylo-mode")
(require 'tntphylo-mode)
  1. Open a TNT script.
  2. Call the function tntphylo-mode. It will load the package on the active buffer.
  3. Step on a line with a TNT command (e.g., mxram) and press C-c C-n for redirecting just one line. It will send the text to the TNT process that will execute it and print output to the TNT buffer.
  4. Rinse and repeat.

Final comments

You might be wondering why the odd “tntphylo” part of the name instead of just “tnt” as the program; it happens that there is already a package called tnt for Emacs and I didn’t want to mess things up in the remote case that somebody needs such package. Please note that it is customary in Emacs to start the function names with the package name (e.g., tntphylo-next-code-line) and therefore it will be confusing whether a given function starting with tnt- belongs to this package or to the earlier tnt.el package, unrelated to this one.

A few other functions are planned for this package, among others, inspection and maybe visualization of the objects produced through the interactive section, autocompletion of commands, and interactive help.

Please note that TNT is NOT open source (unfortunately) but instead freeware with a license agreement. You can call the TNT process only after agreeing with such license during the first time you launch the program. In order to work properly, your copy of TNT must be in your PATH, that is, in a directory where your operative system can look for executables.


Author: gaballench

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

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