3. Emacs Package

3.1. Quickstart

Start tinkering with the satoku matrix in Emacs by loading satoku.el:

Press C-x C-e at end of the following expression:

(load-file "satoku.el")

or press:

M-x load-file RET satoku.el RET

Then execute the command satoku-insert-matrix:

M-x satoku-insert-matrix RET

which will give you a Satoku matrix with a single clause sub-matrix as shown in listing 3.1.

listing 3.1 Satoku matrix with single clause sub-matrix
 // |    ||   S||  0|   0|| 1 1 1 |
 // +----++----++---+----++-------+
 // +-----+----++---+----++-------+
 // |  0 H|   0||   |    || 1 * * |
 // |     |   1||   |    || * 1 * |
 // |     |   2||   |    || * * 1 |
 // +-----+----++---+----++-------+
 // |:info:| move point inside and press `C-u M-x satoku-mode RET'

Position point at the first * inside the matrix and execute:

C-u M-x satoku-mode RET

This constrains your cursor movements to the matrix and assigns special commands to certain keys. (Note: Outside the matrix, the keys work as usual).

Press ? for help.

Some commands are prefix commands (e.g. g). Press ? after the prefix command to get help.

To extend the matrix with another 3x3 clause sub-matrix, as shown in listing 3.2, press C-u 3 > >.

listing 3.2 Extend matrix with 3x3 clause sub-matrix
 // |    ||   S||  0|   0|| 1 1 1 | 1 1 1 |
 // +----++----++---+----++-------+-------+
 // +-----+----++---+----++-------+-------+
 // |  0 H|   0||   |    || 1 * * | _ _ _ |
 // |     |   1||   |    || * 1 * | _ _ _ |
 // |     |   2||   |    || * * 1 | _ _ _ |
 // +-----+----++---+----++-------+-------+
 // |  1 H|   0||   |    || _ _ _ | 1 * * |
 // |     |   1||   |    || _ _ _ | * 1 * |
 // |     |   2||   |    || _ _ _ | * * 1 |
 // +-----+----++---+----++-------+-------+
 // |:info:| move point inside and press `C-u M-x satoku-mode RET'

Press > > to get a separator line as shwon in listing 3.3.

listing 3.3 Satoku matrix with separator line
 // |    ||   S||  0|   0|| 1 1 1 | 1 1 1 ||
 // +----++----++---+----++-------+-------++
 // +-----+----++---+----++-------+-------++
 // |  0 H|   0||   |    || 1 * * | _ _ _ ||
 // |     |   1||   |    || * 1 * | _ _ _ ||
 // |     |   2||   |    || * * 1 | _ _ _ ||
 // +-----+----++---+----++-------+-------++
 // |  1 H|   0||   |    || _ _ _ | 1 * * ||
 // |     |   1||   |    || _ _ _ | * 1 * ||
 // |     |   2||   |    || _ _ _ | * * 1 ||
 // +-----+----++---+----++-------+-------++
 // +-----+----++---+----++-------+-------++
 // |:info:| move point inside and press `C-u M-x satoku-mode RET'

Press C-u 2 > > to get a 2x2 clause sub-matrix, repeat, and repeat again (hint: you can use keyboard macros).

Normal keys are disabled inside the matrix (but not the legend), use 0 to mark state conflicts, - to clear a state. (Mirror states are automatically changed accordingly.)

Do not use 1 to mark required states. Exclude all other states with 0 instead as shown in listing 3.4.

listing 3.4 Satoku matrix with required state by exclusion
 // |    ||   S||  0|   0|| 1 1 1 | 1 1 1 || 1 1 | 1 1 | 1 1 |
 // +----++----++---+----++-------+-------++-----+-----+-----+
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  0 H|   0||   |    || 1 * * | 0 _ _ || _ 0 | _ _ | _ _ |
 // |     |   1||   |    || * 1 * | _ _ 0 || _ _ | _ _ | _ _ |
 // |     |   2||   |    || * * 1 | _ _ 0 || _ _ | _ _ | _ _ |
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  1 H|   0||   |    || 0 _ _ | 1 * * || 0 _ | _ _ | _ _ |
 // |     |   1||   |    || _ _ _ | * 1 * || _ _ | _ _ | _ _ |
 // |     |   2||   |    || _ 0 0 | * * 1 || _ _ | _ _ | _ _ |
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  2 H|   0||   |    || _ _ _ | 0 _ _ || 1 * | _ _ | _ _ |  a
 // |     |   1||   |    || 0 _ _ | _ _ _ || * 1 | _ _ | _ _ | ¬a
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  3 H|   0||   |    || _ _ _ | _ _ _ || _ _ | 1 * | _ _ |  b
 // |     |   1||   |    || _ _ _ | _ _ _ || _ _ | * 1 | _ _ | ¬b
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  4 H|   0||   |    || _ _ _ | _ _ _ || _ _ | _ _ | 1 * |  c
 // |     |   1||   |    || _ _ _ | _ _ _ || _ _ | _ _ | * 1 | ¬c
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |:info:| move point inside and press `C-u M-x satoku-mode RET'

Then press r u to run the requirements update algorithm, which detects and fills in the hard one requirements as shown in listing 3.5.

listing 3.5 Satoku matrix with updated requirement propagation
 // |    ||   S||  0|   0|| 1 1 1 | 1 1 1 || 1 1 | 1 1 | 1 1 |
 // +----++----++---+----++-------+-------++-----+-----+-----+
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  0 H|   0||   |    || 1 * * | 0 _ _ || 1 0 | _ _ | _ _ |
 // |     |   1||   |    || * 1 * | _ _ 0 || _ _ | _ _ | _ _ |
 // |     |   2||   |    || * * 1 | _ _ 0 || _ _ | _ _ | _ _ |
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  1 H|   0||   |    || 0 _ _ | 1 * * || 0 1 | _ _ | _ _ |
 // |     |   1||   |    || _ _ _ | * 1 * || _ _ | _ _ | _ _ |
 // |     |   2||   |    || 1 0 0 | * * 1 || 1 0 | _ _ | _ _ |
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  2 H|   0||   |    || _ _ _ | 0 _ _ || 1 * | _ _ | _ _ |  a
 // |     |   1||   |    || 0 _ _ | _ _ 0 || * 1 | _ _ | _ _ | ¬a
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  3 H|   0||   |    || _ _ _ | _ _ _ || _ _ | 1 * | _ _ |  b
 // |     |   1||   |    || _ _ _ | _ _ _ || _ _ | * 1 | _ _ | ¬b
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |  4 H|   0||   |    || _ _ _ | _ _ _ || _ _ | _ _ | 1 * |  c
 // |     |   1||   |    || _ _ _ | _ _ _ || _ _ | _ _ | * 1 | ¬c
 // +-----+----++---+----++-------+-------++-----+-----+-----+
 // |:info:| move point inside and press `C-u M-x satoku-mode RET'

If you did use 1 and are no longer sure, whether the matrix conditions are proper, press r c to clear all hard one requirements. Then press r u to run the requirements update algorithm.