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
: the former adjust focus backwards directly, while the latter let the command loop adjust backward after post-command hooks and post-command actions.(setf (adjust-marker-direction (current-buffer)) 'backward)
selectable-p
(pos)
selectable-p-aux
(buffer pos)
selectable-p
.adjust-marker-direction
(object)
ensure-selectable
(marker &optional (backward (eql (adjust-marker-direction (host marker)) (quote backward))))
adjust-marker-direction
slot.arrow-right, C-f
): forward-node
(&optional (marker (focus)))
arrow-left, C-b
): backward-node
(&optional (marker (focus)))
forward-node-cycle
(&optional (marker (focus)))
forward-node
, but may wrap around to beginning of buffer.backward-node-cycle
(&optional (marker (focus)))
backward-node
, but may wrap around to beginning of buffer.forward-element
(&optional (marker (focus)))
C-M-b
): backward-element
(&optional (marker (focus)))
C-M-u
): backward-up-node
(&optional (marker (focus)))
M-a
): beginning-of-defun
(&optional (marker (focus)))
M-e
): end-of-defun
(&optional (marker (focus)))
M-<
): beginning-of-buffer
(&optional (marker (focus)))
M->
): end-of-buffer
(&optional (marker (focus)))
word-boundary-list
(object)
word-character-p
(buffer node)
word-start-p
(pos)
word-end-p
(pos)
Word motion commands:
M-arrow-right, M-f
): forward-word
(&optional (marker (focus)))
M-arrow-left, M-b
): backward-word
(&optional (marker (focus) non-interactive))
Test if position is at line boundary:
block-element-p
(element)
block-element-p-aux
(buffer element)
block-element-p
.line-start-p
(pos)
line-end-p
(pos)
Move to line boundary:
home, C-a
): beginning-of-line
(&optional (marker (focus)))
end, C-e
): end-of-line
(&optional (marker (focus)) interactive)
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.
arrow-up, C-p
): previous-line
(&optional (n 1) (marker (focus)))
arrow-down, C-n
): next-line
(&optional (n 1) (marker (focus)))
scroll-lines
(object)
page-up, M-v
): scroll-up-command
()
scroll-lines
.page-down, C-v
): scroll-down-command
()
scroll-lines
.