Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

mesa-minor-mode

This software is unmaintained; it is superseded by mesa-major-mode.

An Emacs minor mode for use with the MESA stellar evolution code.

It makes it easy to take advantage of the tag-related features in Emacs when editing MESA inlists. The default tag file will include everything in the star_job, controls, pgstar, binary_job, and binary_controls namelists.

There are also a couple functions to help with toggling booleans and commenting/uncommenting things.

I’ve produced a short screencast showing the basic features.

Installation

Prerequisites

To run the master branch, you need Emacs 24.

Create a file named .mesa_init in your home directory. List the paths to your various MESA versions using ini format, as below.

[r7624]
    MESA_DIR = /path/to/mesa-r7624

[r6596]
    MESA_DIR = /path/to/mesa-r6596

You can have one or more of these entries. If you have more than one, you may want to take a look at mesa-init.

Configure Emacs

Put the .el file in your load-path and then add

(require 'mesa-minor-mode)

to your Emacs init file

You also want to specify the default version of MESA whose documentation you want to emacs to use. Add

;; set default MESA version
(setq mesa-default-version "r7624")

where “r7624” is the identifier of whatever version of MESA you want to be the default.

This is a minor mode because I edit my inlists using f90-mode (mainly for the syntax coloring). You can toggle the minor-mode manually with

M-x mesa-minor-mode

You can have Emacs automatically start f90-mode and mesa-minor-mode when you edit a file whose name starts with inlist, by adding something like

(add-to-list 'auto-mode-alist '("/inlist[^/]*$" . (lambda () (f90-mode) (mesa-minor-mode))))

to your Emacs init file. (If you’re already automatically starting a major-mode to edit inlist files, adjust as needed. I didn’t use the major-mode hook because I don’t want mesa-minor-mode to start every time f90-mode does.)

I find it useful to do something similar for the .defaults files that will be opened for their documentation, but instead of mesa-minor-mode I use read-only view-mode, which keeps me from confusing them with my inlists and editing them accidentally.

(add-to-list 'auto-mode-alist '("\\.defaults\\'" . (lambda () (f90-mode) (view-mode))))

Caveats

I use this primarily with the latest Emacs version (presently 24.5) on Linux, so that’s where it is least likely to be broken. Also, I’m not much of an elisp hacker, so you shouldn’t take anything done here as representative of the “right way”.

Usage

Generate Tags File

If a TAGS file doesn’t exist when mesa-minor-mode starts, it creates one. To regenerate the TAGS file (for example, after you upgrade MESA), use M-x mesa-regen-tags.

Change MESA Version

If you specified multiple MESA versions in your .mesa_init, you can use C-c C-v to switch where the minor mode will look for the defaults files.

Jump to/from a tag

This is the feature I find most useful when editing a MESA inlist. The command M-. will jump you to a variable’s definition in the appropriate .defaults file. This lets you see the default value and surrounding documentation. M-* will jump you back to your place in the inlist. For full details about using tags (including searching and completion), read the Emacs docs.

Toggle Boolean Values

The mesa-toggle-boolean function switches an inlist value between true and false. This function is bound to C-c C-t by default.

Comment and Uncomment Variables

To make commenting easy, mesa-minor-mode binds C-c C-c to a function that will toggle the comment status of lines, regions, etc.

About

An Emacs minor mode for use with the MESA stellar evolution code

Resources

License

Releases

No releases published

Packages

No packages published