Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Have => trigger a calculation parse from previous = sign even if spans multiple lines #10

Open
wakatara opened this issue Jun 6, 2020 · 1 comment

Comments

@wakatara
Copy link

wakatara commented Jun 6, 2020

First off, thank you soooooo much for making this!!

I was a huge user of Calca previously and basically, this if you hadn't have built this I would have had to myself. I've been testing the minor mode today and love it. I am taking a look at your code later to figure out how you did it. =] This rocks. (only tried it with my old markdown Calca files so far. Also, supporting most of the features in Calca would be baller if you need some extra roadmap ideas.)

One thing that would be amazing in order to support more ordered, thoughtful files would be to support the => as an trigger on calculaton on the last previous variable you've defined a formula for (ie the last thing_to_calculate = this + that.+ other things) even if it spans multiple lines.).
Eg.

Food            = 150 * Months * Days
                => 36,000 (derived from literate-calc package)

instead of

Food            = 150 * Months * Days => Food: 36,000. (derived)

I'd also suggest that that would also work better than having every line provide a solution to each declaration (right now I have lines that look like this:

Months         		= 8. => Months: 8
Days			= 30 => Days: 30
Working Days	        = 20 => Working Days: 20

from ol Calca formulas.

But just wanted to say thank you so much for your work on this. I had this as a project I really needed to get to towards the end of the year, so am ecstatic someone has beat me to it. \o/

@sulami
Copy link
Owner

sulami commented Oct 25, 2020

Thank you for the kind words. Funnily enough I had never heard of Calca before, but it looks remarkably similar, multiple discovery strikes again.

You've got an interesting idea there. I can see how it can become a bit cluttered with a lot of named intermediate values.

The original reason why I included results on every line was that I'm doing line-wise processing, so each line can (in theory) be calculated with just itself and a map of variable names to values. It has since turned out that this is also useful to verify that things are working and there are no typos, which might be hard to track down if intermediate results are hidden.

In theory this should be possible though, we have all the data already, we could do the calculations, add them to our map but don't display an overlay, and then trigger the overlay manually.

Another complication is that especially with inserting the results, we're doing a lot of text-munging for lack of proper metadata (it's just text after all), and this would make it hard to reliably track the relationships between calculations and results across edits. We're already treading the hashrocket in a more magical way than I originally intended (I was planning to make that a defcustom).

This is not me saying wontfix, more laying out thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants