/campus-emacs

simple and sane approach to repl programming

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

Campus-emacs

Campus is a simple but effective improvement to the inferior-process repl development experience in emacs.

Essentially, campus offers three main functions:

  • campus-make-partition: inserts a special comment that breaks the existing code-section (at first the whole file) into two parts.
  • campus-make-partition-from-region: delimits the selected region with the special partition comment. This operates somewhat like a cell in an interactive notebook.
  • campus-send-region: sends the code-section you’re in to a repl process using a customizable list of commands.

I find this useful when developing with a repl open and

  • I don’t want to re-evaluate the whole file every time
  • My code isn’t in a single function, so I can’t use C-M-x.
  • I find myself selecting a region and using C-c C-r or the equivalent frequently.

video demo

Installation

Installable via straight like this:

(straight-use-package
 '(campus :type git
          :repo "https://github.com/eshrh/campus-emacs"))

The source is self-contained in campus.el and depends on s and dash.

Customization

Two main things to customize:

  • campus-partition-string: the comment string used for partitions.
  • campus-eval-region-alist: map of functions to use to eval code.
    • see the docstring via C-h f or reading the source for more info