GNU bug report logs - #78635
30.1.90; wishlist: labels/comments/annotations for individual stack entries

Previous Next

Package: emacs;

Reported by: Christopher Howard <christopher <at> librehacker.com>

Date: Thu, 29 May 2025 19:05:02 UTC

Severity: wishlist

Found in version 30.1.90

Full log


Message #23 received at 78635 <at> debbugs.gnu.org (full text, mbox):

From: Christopher Howard <christopher <at> librehacker.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 78635 <at> debbugs.gnu.org, emacs-devel <at> gnu.org
Subject: Re: bug#78635: 30.1.90; wishlist: labels/comments/annotations for
 individual stack entries
Date: Tue, 29 Jul 2025 12:53:19 -0800
After exploring the calc codebase for a while, it seems like this is the simplest approach to implementing this feature: store the stack entry "comment", as a string, in the currently unused fourth slot of the entry's stack entry list (see calc-stack variable). Also, modify math-format-stack-value so that it can extract the fourth entry (if non-nil) and modify the output string accordingly:

```
    (setq s (if (stringp c)
		(if calc-display-raw
		    (prin1-to-string c)
		  c)
	      (math-composition-to-string c w)))
    (if comment (setq s (concat s " ;; " comment)))
    (when calc-language-output-filter
      (setq s (funcall calc-language-output-filter s)))
```

...the "comment" variable being the cadddr of the entry parameter of math-format-stack-value.

So far, this seems to work fine. Other calc functions don't seem to care whether or not there is a fourth element in the entry list, either ignoring it or dropping it. I could modify the other functions to be aware of the entry comment, as appropriate.

An area I could use help with: to test this, I am currently editing the stack by hand (using setq), not being familiar with the API for modifying the calc stack. Could somebody throw together for me a basic example function that accesses the proper stack entry (topmost entry...? entry selected...?) and shows me how I would save the entry back to stack after I modified it? I have been trying to look at conceptually simple functions like calc-enter for guidance, but am still getting lost in the weeds.

-- 
Christopher Howard




This bug report was last modified 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.