Structural MotionWe have seen that as a side-effect of changing the insertion cursor or the textual selection, the structural selection is updated. Such adjustments of the structural selection are secondary effects. We now describe operations whose primary purpose is to establish the structural selection. For these commands, it is the insertion cursor that tracks the structural selection.
Structural-motion commands offer an accurate and efficient way to navigate with respect to the structure of code. For example, commands forward-subphrase (menu: Structure/Forward/Subphrase X: Ctrl+Shift+N NT: F8 ) and backward-subphrase (menu: Structure/Backward/Subphrase X: Ctrl+Shift+P NT: F7 ) advance forward and backward, respectively, in subphrases.
Click somewhere in the upper left corner of the *untitled*
window, then move forward and backward with forward-subphrase
and backward-subphrase.
Note that the insertion cursor tracks the structural selection after each command. Structural-motion commands do not typically set the textual selection.
Some structural-motion commands materialize placeholders at locations where optional syntactic elements are permitted. The RETURN key is actually bound to such a command: forward-from-insertion-point.
Set the insertion cursor just to the right of a semicolon that separates a
pair of statements, then repeatedly strike RETURN. Note that moving
the structural selection away from an optional term causes that optional to be
removed.
Suppose you wish to insert a new statement immediately after some large structured statement. Command forward-phrase-with-optionals (menu: Structure/Forward/Phrase with Optionals X: Shift+ALT+^M NT: Shift+F8) can be used to move there immediately without having to search visually for the correct position.
Click on the if statement and imagine
that the matching end if were off screen. Invoke
forward-phrase-with-optionals.