motform / processing-3-mode

emacs mode for Processing 3
GNU General Public License v3.0
7 stars 2 forks source link
emacs processing3

processing-3-mode

A minimalist major mode for Processing 3, leveraging the p3 command line tools. It provides convenient access to compiler features and some basic development niceties, such as p3-aware keyword font locking.

Installation

The mode requires Processing 3 with CLI tools enabled. For more information on those, read the official documentation.

Until the package is published on melpa, I recommend using straight.el.

If you want p3-mode to automatically start when opening .pde files, add the following snippet to your init file.

(add-to-list 'auto-mode-alist '("\\.pde$" . p3-mode))

Customization

You can enable any of the flags supported by processing-java.

Flag Values
processing-3-no-java nil (default), t
processing-3-force nil (default), t
processing-3-platform nil (default), 'linux, 'macosx, 'windows
processing-3-compile-key 'run (default), 'build, 'present, 'export
processing-3-args "" (default), any string

processing-3-args is a string used to add command-line arguments when calling processing-java. As this is most likely file-dependent, it can be useful to add these using buffer local variables. Below is an example using the block quote syntax.

/* Local Variables:                   */
/* mode: processing-3                 */
/* processing-3-args: "300 400"       */
/* End:                               */

void setup() {

// etc

Keymap

The following keybindings are provided out of the box.

Function Keymap
run C-c C-r
build C-c C-b
present C-c C-p
export C-c C-e
compile-cmd C-c C-c

compile-cmd (C-c C-c) is meant as a convenience bind to whatever build function you use the most. It is controlled by processing-3-compile-cmd and defaults to 'run.

Limitations