Next: Displaying Selections, Previous: Making Selections, Up: Selecting Subformulas

Once you have selected a sub-formula, you can expand it using the
`j m` (`calc-select-more`

) command. If ‘`a + b`’ is
selected, pressing `j m` repeatedly works as follows:

3 ... 3 ___ 3 ___ (a + b) . . . (a + b) + V c (a + b) + V c 1* ............... 1* ............... 1* --------------- . . . . . . . . 2 x + 1

In the last example, the entire formula is selected. This is roughly
the same as having no selection at all, but because there are subtle
differences the ‘`*`’ character is still there on the line number.

With a numeric prefix argument `n`, `j m` expands `n`
times (or until the entire formula is selected). Note that `j s`
with argument `n` is equivalent to plain `j s` followed by
`j m` with argument `n`. If `j m` is used when there
is no current selection, it is equivalent to `j s`.

Even though `j m` does not explicitly use the location of the
cursor within the formula, it nevertheless uses the cursor to determine
which stack element to operate on. As usual, `j m` when the cursor
is not on any stack element operates on the top stack element.

The `j l` (`calc-select-less`

) command reduces the current
selection around the cursor position. That is, it selects the
immediate sub-formula of the current selection which contains the
cursor, the opposite of `j m`. If the cursor is not inside the
current selection, the command de-selects the formula.

The `j 1` through `j 9` (`calc-select-part`

) commands
select the `n`th sub-formula of the current selection. They are
like `j l` (`calc-select-less`

) except they use counting
rather than the cursor position to decide which sub-formula to select.
For example, if the current selection is `a + b + c` or
`f(a, b, c)` or `[a, b, c]`, then `j 1` selects ‘`a`’,
`j 2` selects ‘`b`’, and `j 3` selects ‘`c`’; in each of
these cases, `j 4` through `j 9` would be errors.

If there is no current selection, `j 1` through `j 9` select
the `n`th top-level sub-formula. (In other words, they act as if
the entire stack entry were selected first.) To select the `n`th
sub-formula where `n` is greater than nine, you must instead invoke
`j 1` with `n` as a numeric prefix argument.

The `j n` (`calc-select-next`

) and `j p`
(`calc-select-previous`

) commands change the current selection
to the next or previous sub-formula at the same level. For example,
if ‘`b`’ is selected in ‘`2 + a*b*c + x`’, then `j n`
selects ‘`c`’. Further `j n` commands would be in error because,
even though there is something to the right of ‘`c`’ (namely, ‘`x`’),
it is not at the same level; in this case, it is not a term of the
same product as ‘`b`’ and ‘`c`’. However, `j m` (to select
the whole product ‘`a*b*c`’ as a term of the sum) followed by
`j n` would successfully select the ‘`x`’.

Similarly, `j p` moves the selection from the ‘`b`’ in this
sample formula to the ‘`a`’. Both commands accept numeric prefix
arguments to move several steps at a time.

It is interesting to compare Calc's selection commands with the
Emacs Info system's commands for navigating through hierarchically
organized documentation. Calc's `j n` command is completely
analogous to Info's `n` command. Likewise, `j p` maps to
`p`, `j 2` maps to `2`, and Info's `u` is like `j m`.
(Note that `j u` stands for `calc-unselect`

, not “up”.)
The Info `m` command is somewhat similar to Calc's `j s` and
`j l`; in each case, you can jump directly to a sub-component
of the hierarchy simply by pointing to it with the cursor.