Go to the first, previous, next, last section, table of contents.

Editing Stack Entries

The backquote, ` (calc-edit) command creates a temporary buffer (`*Calc Edit*') for editing the top-of-stack value using regular Emacs commands. With a numeric prefix argument, it edits the specified number of stack entries at once. (An argument of zero edits the entire stack; a negative argument edits one specific stack entry.)

When you are done editing, press M-# M-# to finish and return to Calc. The RET and LFD keys also work to finish most sorts of editing, though in some cases Calc leaves RET with its usual meaning ("insert a newline") if it's a situation where you might want to insert new lines into the editing buffer. The traditional Emacs "finish" key sequence, C-c C-c, also works to finish editing and may be easier to type, depending on your keyboard.

When you finish editing, the Calculator parses the lines of text in the `*Calc Edit*' buffer as numbers or formulas, replaces the original stack elements in the original buffer with these new values, then kills the `*Calc Edit*' buffer. The original Calculator buffer continues to exist during editing, but for best results you should be careful not to change it until you have finished the edit. You can also cancel the edit by pressing M-# x.

The formula is normally reevaluated as it is put onto the stack. For example, editing `a + 2' to `3 + 2' and pressing M-# M-# will push 5 on the stack. If you use LFD to finish, Calc will put the result on the stack without evaluating it.

If you give a prefix argument to M-# M-# (or C-c C-c), Calc will not kill the `*Calc Edit*' buffer. You can switch back to that buffer and continue editing if you wish. However, you should understand that if you initiated the edit with `, the M-# M-# operation will be programmed to replace the top of the stack with the new edited value, and it will do this even if you have rearranged the stack in the meanwhile. This is not so much of a problem with other editing commands, though, such as s e (calc-edit-variable; see section Other Operations on Variables).

If the calc-edit command involves more than one stack entry, each line of the `*Calc Edit*' buffer is interpreted as a separate formula. Otherwise, the entire buffer is interpreted as one formula, with line breaks ignored. (You can use C-o or C-q C-j to insert a newline in the buffer without pressing RET.)

The ` key also works during numeric or algebraic entry. The text entered so far is moved to the *Calc Edit* buffer for more extensive editing than is convenient in the minibuffer.


Go to the first, previous, next, last section, table of contents.