sulami / literate-calc-mode.el

🧮 Literate programming for M-x calc
https://melpa.org/#/literate-calc-mode
GNU General Public License v3.0
327 stars 13 forks source link

Wishes Really #13

Open ddoherty03 opened 3 years ago

ddoherty03 commented 3 years ago
  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!

sulami commented 3 years ago

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.
ddoherty03 commented 3 years ago

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.

cougarten commented 3 years ago

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)

sulami commented 3 years ago

cougarten notifications@github.com 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

cougarten commented 3 years ago

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

sulami commented 3 years ago

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.