literate-calc-mode.el icon indicating copy to clipboard operation
literate-calc-mode.el copied to clipboard

Wishes Really

Open ddoherty03 opened this issue 4 years ago • 6 comments

  1. After an insert into buffer, would be nice to have a command to clear the results (i.e., the => stuff) and allow revision, and if a region is active limit the clearing to the region.

  2. Unless you're constrained by calc, allow variable names to have digits in them, e.g., Price1, Price2, and perhaps underscores, Price_1 and Price_2

  3. Allow variables from lines with inserted results to continue to participate in calculations, now they seem to be "deactivated."

  4. Real kick-ass addition to Emacs, many thanks Sulami!

ddoherty03 avatar Oct 24 '20 16:10 ddoherty03

I've released something concerning 1 and 2 (though I'm not convinced 1 is entirely free of edge cases).

3 is somewhat difficult, this package is architecturally not keeping track of values very well, a lot of the data is only persisted as buffer content, which is bad for many reasons, but handling that data is also a bit of a pain in Emacs Lisp (like so many things).

  1. Thanks.

sulami avatar Oct 25 '20 13:10 sulami

OK. That's encouraging. Both 1 and 2 are welcome additions. I think clearing the results allows 3, in effect. Just have to re-insert when done.

ddoherty03 avatar Oct 27 '20 20:10 ddoherty03

I'd love an "eval subtree" so it doesn't have to go through my huge buffer. (Ideally taking in the org heading under the cursor or if not on a heading the next heading above it. I don't want to move to the header to refresh my calculation)

cougarten avatar Nov 06 '20 12:11 cougarten

cougarten [email protected] writes:

I'd love an "eval subtree" so it doesn't have to go through my huge buffer.

That's something I've been thinking about as well, given how re-scanning the entire buffer on every keystroke is clearly not infinitely scalable. On the other hand I'd have to actually build a dependency tree, which means recursively searching forward on every edit and selectively updating, or at the very least walking the whole buffer with a dynamically modified search term.

It's a nice idea though, I'd have to prototype a bit, and also do some benchmarks in the first place to evaluate options.

-- Robin

sulami avatar Nov 06 '20 13:11 sulami

Oh right, on any keystroke would be most dope of course :)

cougarten avatar Nov 06 '20 16:11 cougarten

Oh right, on any keystroke would be most dope of course :)

Right now it does actually potentially re-evaluate on every keystroke, at least it checks on every buffer edit whether it is likely inside a calc expression.

The problem here of course is very large buffers with many expressions, that might become laggy at some point.

sulami avatar Nov 09 '20 19:11 sulami