When I need while editing a .org
file to calculate, say, 23.45 * 15
, I copy (M-w) that string then call M-x calc
.
I paste the numbers as a string, preceded by a single tick (using algebraic mode so I don't have to reenter the numbers or the operation).
Once the answer comes back (351.75
), I mark+copy the output, return (two instances of C-xo) and paste (C-y) the result.
It almost works. I get 1: 351.75
rather than 351.75
, but I'm sure there is a superior way that doesn't involve quite so many keystrokes. Can you suggest one?
P.S.1
I am familiar with the basic
spreadsheet
in org-mode
, but here I'm wondering if there is something I'm missing for much simpler needs.
P.S.2
The same problem arises with .txt
file, but a solution using what's available in .org
is quite adequate.
calc
src block and evaluate it. Mark the expression, doC-c C-, s
to add the src block delimiters, typecalc
to make it into acalc
src block andC-c C-c
to evaluate it. You still have to do a bunch of keystrokes for that and then another bunch to clean things up though, so I'm not sure whether you are saving anything. You also have to enablecalc
as an Org babel language in your init file (it's not enabled by default), but that's a one-time thing. And you might define a keyboard macro/function to do the setup/cleanup. – NickD Jun 08 '23 at 20:07