|
| From: | Vincent Belaïche |
| Subject: | RE: using ses programatically (was: a ses question) |
| Date: | Sat, 18 Nov 2023 22:55:08 +0000 |
|
Dear Andrès,
I attached an updated ses-setq macro.
You can both set values and formulas programmatically. There are 4 switches sv rcv sf and rcf. The …v sitches are for setting values, and the …f switches are for setting formula. The s… switches are for indicating the cell by symbol (e.g. A1) and the rc… switches
are for indicating the cell by row col coordinate, (e.g. 0 0 are for A1). Default initial switch is sv. You can change the current switch with the :: argument.
So
(ses-setq A1 1 :: sf B1 (1+ A1))
will set A1 to 1, and B1 to the formula that adds 1 to A1, so B1 will be 2.
Other examples that do the same job :
(ses-setq :: rcv 0 0 1 :: sf B1 (1+ A1))
Or
(ses-setq A1 1 :: rcf 0 1 (1+ A1)) I still need more work
to handle properly the safe function stuff in the case of setting formulae.
In the case of smeter you could use the sf / rcf switch to set any formula you like in order to compute the result.
Vincent. De : andrés ramírez <rrandresf@hotmail.com>
Envoyé : dimanche 5 novembre 2023 20:33 À : Vincent Belaïche <vincent.b.1@hotmail.fr> Cc : emacs-devel <emacs-devel@gnu.org>; boruch_baum@gmx.com <boruch_baum@gmx.com> Objet : Re: using ses programatically (was: a ses question) Hi. Vincent.
My comments below. >>>>> "Vincent" == Vincent Belaïche <vincent.b.1@hotmail.fr> writes: Vincent> Dear Andrès, Vincent> Concerning the backward compatibility you could test emacs version in smeter.el to know Vincent> whether the newer ses is distibuted. Otherwise, if not distributed you could have some Vincent> newer ses.el copied to the same dir as smeter.el and change the load path in smeter.el Vincent> for this newer ses.el to be loaded instead of the coming with the older emacs. Ok. Vincent> FYI, I have no idea when I will push to master the ses-setq etc... changes, and no idea Vincent> when this is in a new release of Emacs. Fine. Vincent> Thank you for the information about the cl-... macros, I will I have look when time Vincent> allows ... Ok. [...] Vincent> PS : Maybe smeter.el would be simpler if the final sum was done by SES rather than Vincent> org-table stuff. Sure. I am thinking a little bit ahead. Why not testing setting formulae on the fly for doing that final calculation? WDYT?. Thank for your help. Andrés Ramírez |
| [Prev in Thread] | Current Thread | [Next in Thread] |