2

I have a problem with using calc. When I have two windows open in emacs, split vertically, calc frequently opens in the wrong window. Here's a demonstration of the problem that I ran with emacs -Q.

First, have a split window. In this case, the scratch buffer and a random other buffer, with the point in the scratch buffer:

before calc

I do M-x calc, and this happens:

during calc

It should have split the scratch buffer, not the right one. This in itself is not a huge issue, but the problem is that when i try to yank stuff from calc back into to the buffer, it winds up in the wrong one:

incorrect yanking

I wanted the 43 that I yanked into the buffer from calc (with y in calc, which runs calc-copy-to-buffer) to wind up in the scratch buffer (since that's where i started from), but it doesn't.

Anyone know a way to fix this issue?

1

According to the manual (14.6 - Yanking into other buffers):

The plain y (calc-copy-to-buffer) command inserts the number at the top of the stack into the most recently used normal editing buffer. (More specifically, this is the most recently used buffer which is displayed in a window and whose name does not begin with ‘’. If there is no such buffer, this is the most recently used buffer except for Calculator and Calc Trail buffers.) The number is inserted exactly as it appears and without a newline. (If line-numbering is enabled, the line number is normally not included.) The number is not removed from the stack. *

The scratch buffer therefore is not a "normal editing buffer".

As for the first issue , If you start calc before splitting the window ( with only one buffer showing), you will get both the calc and the trail buffers, which is very useful and will prevent the unwanted behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.