What is a good way to evaluate the (+ 100 (+ 100 100))
part in
(+ (+ 1 2) (+ 100 (+ 100 100)))
?
For now, I do it by C-x C-e, which means I need to locate the ending parenthesis, which is difficult in most cases. Options > Paren Matching Highlighting
helps, but still I need to move the cursor toward the ending parenthesis until the highlighted match is the starting parenthesis.
One way would be to have the reverse version of C-x C-e, so that I can place the cursor at the starting parenthesis like this:
(+ (+ 1 2) |(+ 100 (+ 100 100)))
and then press the appropriate keybinding.
Or I could place the cursor inside the expression, but not inside smaller expressions,:
(+ (+ 1 2) (+ | 100 (+ 100 100)))
and press a keybinding. Because aiming at a target is easier if the target is big.
How can I make such a command? Or is there one already provided?
Sidenote: bar cursor and box cursor
Emacsers who use box cursor (default) might wonder where I'm putting the cursor with the bar notation above. In emacs, you can choose box cursor or bar cursor, (bar-cursor-mode t)
. When the bar cursor is between the letters A and B, the box cursor is on B. So the bar is the left wall of the box.
BTW, the concept of bar cursor is useful in some unusual way: The practice of iterating from index1 to index2-1 in programming surprises beginners. It helps to imagine index1 and index2 as indicating bars (left walls) rather than boxes.