Skip to content

Key and mouse Interaction

Matt Huebert edited this page Jul 11, 2017 · 5 revisions

Notation

Key combinations are written:

(modifier key 1) - (modifier key 2) - key

... to show which modifier keys are pressed with which key. There can be zero or more modifier keys, depending on the keyboard:

Shorthand Key
A alt/option
C control
M ("meta") Command/Win/Tux
S shift

So, for example, M-enter means hold down the Command/Win/Tux key and press enter, whereas C-M-left means hold down the control and Command/Win/Tux keys while pressing the left arrow key.

If we eventually expand to allow emacs-style key sequences, the notation above would expand to allow a series of one or more key combinations, separated by spaces. For example, to encode pressing control + c two times we would write C-c C-c, whereas C-c A-a would represent control + c followed by Alt + a.

An additional special case for mouse gestures:

One would write mouse-1 to indicate clicking with the first (on Macs, only) mouse button, which can also be combined with keys presses as above.

Conventions

Selection/execution

M- selects the current expression and highlights it (not just the surrounding parens). While M- is held,

  • Tapping M-1 further expands the selection to the next larger expression, up to the top-level expression.
  • Tapping M-2 retracts the selection to the next lesser expression, down to the one initially highlighted.

Pressing M-S- selects the current top-level expression.

Releasing M- at any point clears the selection.

Character-by-character mouse-based selection is disabled.

(This kind of behavior is called a "pseudo-mode" in the UI literature, because it is a mode but it doesn't persist after the key is released, so there's no way a user can be unaware that it's on or confused about how to turn it off.)

It would be optimal if one could click-drag the current selection in a structure-preserving way.

In addition to managing selection, the following keys should be bound to M-:

Key Action
M-enter execute currently selected expression
M-S-enter execute current top-level expression
M-x cut selection
M-c copy selection
M-v paste clipboard at cursor, ignoring current selection
M-S-v paste clipboard, replacing current selection

Movement

Let me know if you need further clarification on any of these movement descriptions.

Key Action
A-left/right left/right one atom/expression
A-up "backward-up-list", move backward up/out one level of parens, "out of"
A-down "down-list", move forward/down one level of parens, "into"
A-C-up move up one "definition" (top-level expression)
A-C-down move down one "definition" (top-level expression)

Code manipulation

Key Action
M-( barf
M-) slurp
M-; uneval current form
M-A-; uneval (or comment) top-level form

... more to come ...

Clone this wiki locally