Subject: bug#78635: 30.1.90; wishlist: labels/comments/annotations for individual stack entries

From: Christopher Howard <[email-masked]>
Date: Tue, 26 Aug 2025 13:41:14 -0800

I've continued to look into this a few minutes here and there, as I find time. This has proven a tricky feature to implement. My working idea is to add a fourth element onto the stack entry list, which currently has three elements per stack entry, then modify math-format-stack-value to display the fourth element. This is maybe a good plan, but not all modes of calc, like the various calc "languages", use math-format-stack-value, and a lot of calc functions will just delete the fourth element.

An even trickier part is dealing with the stack itself. It looks like the stack manipulation API, like calc-push-list and calc-top, is meant for dealing, not with entire stack entries, but just the values stored in the first element of each stack entry. But I need to deal with a whole stack entry when I'm adding a fourth element. And it will be a problem if I'm ending up needing to modify some other calc functions that need to respect the fourth element, but these functions only deal with the stored val. There is some API like calc-pop-stack which might be an exception to this, but I'm still trying to figure out how they work.

Maybe the correct approach would be to modify the stored value data structure to have a slot of some kind for a stack entry comment, but that I imagine would require a massive rewrite of the code-base.

Starting to lose steam here, trying to figure this all out by myself and with no documentation. But there are some other features I'd like to see added to Calc, so I suppose I should continue to study the code base and figure out how things work.

-- 
Christopher Howard