Motion

Selectable positions

Neomacs try to keep the focus at selectable positions after every command invocation. The direction of this post-command adjustment is controlled by adjust-marker-direction. Programs can also call ensure-selectable to adjust marker positions. Note the difference between (ensure-selectable (focus) t) and (setf (adjust-marker-direction (current-buffer)) 'backward): the former adjust focus backwards directly, while the latter let the command loop adjust backward after post-command hooks and post-command actions.

Function: selectable-p (pos)
Test if POS is selectable.
Standard generic function: selectable-p-aux (buffer pos)
Extension point for selectable-p.
Test if POS is selectable in BUFFER.
Standard generic function, setf-able: adjust-marker-direction (object)
Function: ensure-selectable (marker &optional (backward (eql (adjust-marker-direction (host marker)) (quote backward))))
Move MARKER to nearest selectable position.
Prefer going forward if BACKWARD is nil. Prefer going backward otherwise. Default behavior depends on MARKER's host buffer's adjust-marker-direction slot.

Motion by nodes and elements

Command (arrow-right, C-f): forward-node (&optional (marker (focus)))
Move to closest selectable preorder successor.
Command (arrow-left, C-b): backward-node (&optional (marker (focus)))
Move to closest selectable preorder predecessor.
Command: forward-node-cycle (&optional (marker (focus)))
Like forward-node, but may wrap around to beginning of buffer.
Command: backward-node-cycle (&optional (marker (focus)))
Like backward-node, but may wrap around to beginning of buffer.
Command: forward-element (&optional (marker (focus)))
Move to first element (excluding line break) to the right.
Command (C-M-b): backward-element (&optional (marker (focus)))
Move to first element (excluding line break) to the left.
Command (C-M-u): backward-up-node (&optional (marker (focus)))
Move to closest selectable parent.

Top-level motion

Command (M-a): beginning-of-defun (&optional (marker (focus)))
Move to current or previous toplevel node.
Command (M-e): end-of-defun (&optional (marker (focus)))
Move to next toplevel node.
Command (M-<): beginning-of-buffer (&optional (marker (focus)))
Move to beginning of buffer.
Command (M->): end-of-buffer (&optional (marker (focus)))
Move to end of buffer.

Word motion

Standard generic function, setf-able: word-boundary-list (object)
Function: word-character-p (buffer node)
Test if NODE is a word constituent character in BUFFER.
Function: word-start-p (pos)
Test if POS is at start of a word.
Function: word-end-p (pos)
Test if POS is at end of a word.

Word motion commands:

Command (M-arrow-right, M-f): forward-word (&optional (marker (focus)))
Move to next word end position.
Command (M-arrow-left, M-b): backward-word (&optional (marker (focus) non-interactive))
Move to previous word start position.

Line motion

Test if position is at line boundary:

Function: block-element-p (element)
Test if ELEMENT is a block element.
Standard generic function: block-element-p-aux (buffer element)
Extension point for block-element-p.
Test if ELEMENT is a block element in BUFFER.
Function: line-start-p (pos)
Test if POS is at start of a line.
Function: line-end-p (pos)
Test if POS is at end of a line.

Move to line boundary:

Command (home, C-a): beginning-of-line (&optional (marker (focus)))
Move to beginning of line.
Also returns number of skipped selectable position, useful for non-interactive use.
Command (end, C-e): end-of-line (&optional (marker (focus)) interactive)
Move to end of line.

The following commands try to keep horizontal location approximately the same. Currently, we do this by counting the number of selectable positions between current focus position and beginning-of-line position, and try to keep that number the same.

Command (arrow-up, C-p): previous-line (&optional (n 1) (marker (focus)))
Move to N-th previous line.
Try to keep horizontal location approximately the same.
Command (arrow-down, C-n): next-line (&optional (n 1) (marker (focus)))
Move to N-th next line.
Try to keep horizontal location approximately the same.
Standard generic function, setf-able: scroll-lines (object)
Command (page-up, M-v): scroll-up-command ()
Move up scroll-lines.
Command (page-down, C-v): scroll-down-command ()
Move down scroll-lines.