From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?iso-8859-1?Q?Vincent_Bela=EFche?= Newsgroups: gmane.emacs.devel Subject: RE: using ses programatically (was: a ses question) Date: Sun, 5 Nov 2023 16:55:46 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="_000_PAXP192MB1608AB2F20A535B0F6E0749084ABAPAXP192MB1608EURP_" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30076"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel , "boruch_baum@gmx.com" To: =?iso-8859-1?Q?andr=E9s_ram=EDrez?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 05 18:02:54 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qzgWT-0007Wz-Si for ged-emacs-devel@m.gmane-mx.org; Sun, 05 Nov 2023 18:02:54 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qzgWD-0004yp-N0; Sun, 05 Nov 2023 12:02:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qzgPf-0002SB-2Z for emacs-devel@gnu.org; Sun, 05 Nov 2023 11:55:51 -0500 Original-Received: from mail-db8eur05olkn2081.outbound.protection.outlook.com ([40.92.89.81] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qzgPd-0002Ap-72 for emacs-devel@gnu.org; Sun, 05 Nov 2023 11:55:50 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nSXFV8DZu9l8Z2H3ktcyyNKMKas4yic66Cn2ttZj2m+uRaZO3ugN1vEWlWViQubkWV+zxQyyEorUIm8ZwlRWsgcMYpEdPv8wvhb4ibN6YUYyOv+jhRelp8MOq1ba92M0xFlri2J9yaR6TOghPpVGVkDl06eC0yMbKV2SZur0Oa7zQHMllViSDNZXJ9MMSXMrHBJXO40G7uCFkQrdo7vr4ZwddXFvI/O28Etpq9OREO5hRC4NG/KvXy6zgCZVjTvKfZh7cJR/kD1k5unS+9WEiwEJ9/EKBfWT5+LnYS4sgVPLEcjNe0CizM4eC6Eof/K/4b/kaD5tYyipi7mtc/MFMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=x8Z8kjW1V0/rWq4H0KjFBa0JJ3tQXuifg9N3Z5vM+pk=; b=DSN0s8h/R1PrYYVfW6LyEMqcbs0uhW4o/V55Tmjh5cP/goqhVIJ/1XxW3QqGfL4D8KJJg79RADGBvxzZv6oIXsPqFft6pjK0cpF9R+1FW8UP+R+CYvQdXb0l5OiSKnV6brMBk8rSM3xEbi03st3WumIi1BDhtEKuGJ/b82ykkS3end1KX2pcibyehB9jGZ5XDinXwWvi6TEKtrM16I66LktGVnWOh3IbUD7M5O1p17/ruHrMYNe9XIGioGTIbPBmt4Cq9SjU1qfkOnKNrvGaN2+sfnKzX+fCgIXkbyF8B4PYHVytnCQ1wbjuvLA8Dol1rcNb9zM9C5H7O9B9q5/Q2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Original-Received: from PAXP192MB1608.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:28c::22) by DB8P192MB0741.EURP192.PROD.OUTLOOK.COM (2603:10a6:10:16f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.27; Sun, 5 Nov 2023 16:55:46 +0000 Original-Received: from PAXP192MB1608.EURP192.PROD.OUTLOOK.COM ([fe80::a0e9:c28e:ff43:2125]) by PAXP192MB1608.EURP192.PROD.OUTLOOK.COM ([fe80::a0e9:c28e:ff43:2125%6]) with mapi id 15.20.6954.025; Sun, 5 Nov 2023 16:55:46 +0000 Thread-Topic: using ses programatically (was: a ses question) Thread-Index: AQHaDyaIFxl+uTQAXkSovHGVyH2ZGrBrhKoNgABOFwCAAB8A5Q== In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: fr-FR x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [+I6nWegjfaZEIMDla4Yd2/jZ5i8J5k0w] x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PAXP192MB1608:EE_|DB8P192MB0741:EE_ x-ms-office365-filtering-correlation-id: d5188ec7-a057-4b38-304d-08dbde200e45 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KLMDM0qnOMycPMFUXMJKrxHGCkFwvHSWhBH1iQee2F69I/2tT5Rz6SMniq6BJLOfZLiarLi9jb5/OIYWL/gLb6LagZfLb3XSNAmC9/wagL0+lyXTwjWQWp9RJ3el8kPrNAGeD2jEzszAclfHdh2fX7RmVk2D56nfGoUZeRBhu9JTrC40nNC6BPjg4Q9R0IWRDRHalhNDhb2n9ENm7Ec50Et7f0jAjdoLsxU7E947Ah37P3dCKtvXapGNcsptL6hfmRA8fC16OrWi+qYayMftOXLvAeeD/BDqgckRFwgiFQzxxzcW9RH/3q60LCc86qH4ltnaaByg3rvzOFKB516jebIppkkj9Hj1MYZrnSDO+3+qz3taIVbL7UkQdblXRJHtys5oLQHVTxvchBmJ3ePChHB+mBKkhWIAKp3hZPoweRYPzpq3BjUUaIxTd+PGmk0HKhvSp5vJociaT0Jt3NK+CLqQmsyYfhtvzVyiTi8L8KgMxBFxu+jxQ8quw6642LeGzWg1HIFGAYJvrfygzRBEw7maRbvS7p411QAgpeCRjBj48TN6hsyzwkCdHwi11Icp x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?JI+egcQ1ku7YaHI1o0UcCvtN9MGA8k4ohDEBJDqiz7wJAMnBPa72o1wDUT?= =?iso-8859-1?Q?je5JCiE5ge88GTLXVK6etnhuhEufJIEKAGptq8zUWwDhOG1eN0fEEheCxM?= =?iso-8859-1?Q?f6k66/xzcZYJ19F5WfRhpspNCnZ916+D19udZ3+N93Eb7vogzPrtvJ0Yv2?= =?iso-8859-1?Q?aZmeNt15zkMNthZVLz6uYxem+aNBCGO4PQ7mpL8vhQlclFiF+njgZwx4I8?= =?iso-8859-1?Q?g23xOTXulgIcaomO0LWI2Jim7HVJmv2XrKf2UHG+sQ5ItehcaRY9i6QcxM?= =?iso-8859-1?Q?Vm2kO2Nk0qxK0kqUapA6pKaXq9c3xBFyzQrs7aoKpAqXhIeuovIWNKqi76?= =?iso-8859-1?Q?8wPl5maNYLHzIpEu3Z2Jr6NoEpSV1ErPxKPx8OOmaQHsCedAeiXXacvfjp?= =?iso-8859-1?Q?66vOxTszeJpYPlxSTxdKYRr9E+Z7NRXl0khd91LdNMQqe1MQRj2lEBRDA0?= =?iso-8859-1?Q?TbkHorsNNmVIctbSXawUAJTw04JIulHyDyyDP7nRyRO7EwMG+8fBEnXMW7?= =?iso-8859-1?Q?Zp97FOTXpJ8BzXh4m7GXuXPUBYzuJA+ge3rWEWbD1pML98i8X2PyGZmjbS?= =?iso-8859-1?Q?f+CdAzBHxG56QxyWuigexcxPwvxHiFSY3TUm5Nj5TmnlCcAqTMPH0F2ESc?= =?iso-8859-1?Q? X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-fb43a.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PAXP192MB1608.EURP192.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: d5188ec7-a057-4b38-304d-08dbde200e45 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Nov 2023 16:55:46.2423 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P192MB0741 Received-SPF: pass client-ip=40.92.89.81; envelope-from=vincent.b.1@hotmail.fr; helo=EUR05-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 05 Nov 2023 12:02:36 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:312254 Archived-At: --_000_PAXP192MB1608AB2F20A535B0F6E0749084ABAPAXP192MB1608EURP_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear Andr=E8s, Concerning the backward compatibility you could test emacs version in smete= r.el to know whether the newer ses is distibuted. Otherwise, if not distrib= uted you could have some newer ses.el copied to the same dir as smeter.el a= nd change the load path in smeter.el for this newer ses.el to be loaded ins= tead of the coming with the older emacs. FYI, I have no idea when I will push to master the ses-setq etc... changes,= and no idea when this is in a new release of Emacs. Thank you for the information about the cl-... macros, I will I have look w= hen time allows ... Vincent. PS : Maybe smeter.el would be simpler if the final sum was done by SES rath= er than org-table stuff. ________________________________ De : andr=E9s ram=EDrez Envoy=E9 : dimanche 5 novembre 2023 15:58 =C0 : Vincent Bela=EFche Cc : emacs-devel ; boruch_baum@gmx.com Objet : Re: using ses programatically (was: a ses question) Hi. Vincent. My comments below. >>>>> "Vincent" =3D=3D Vincent Bela=EFche writes: Vincent> Dear Andr=E8s, Vincent> I drafted a macro ses-setq to allow access a SES spreadsheet p= rogramatically, and I Vincent> updated your code to use it. This allowed to remove all the wo= rkarounds. Please note Vincent> that ses-setq is just a draft, far from complete. I intend to = add some switches to Vincent> allow access the cells eaither by cell name or by row col, and= to modify either value Vincent> or formula. That's great. Just to mention again I have a newt-C-language app that calls emacs this way: --8<---------------cut here---------------start------------->8--- system ("cp workbook.ses /tmp; cp smeter.el /tmp; emacs -Q --batch -l /tmp/= smeter.el /tmp/smeteroutput -f smeter/further-processing > /dev/null 2>&1")= ; --8<---------------cut here---------------end--------------->8--- And when the calling ends. It reads ses-output from /tmp/smeter.mail. The C-language app does not known anything about emacs. So the logic of calculation is within workbook.ses. That way when calculation logic changes. The newt-C-language-App does not need to be changed. Just the formulae within workbook.ses would be changed, which BTW is simpler than re= -compiling the newt-C-language-App. [...] The published version works as expected. Thanks for It. But. I have a question. If emacs does NOT have the ses-setq buffer (29.1 as an example). Which function calls should I do for having ba= ckward compatibility with older emacsen?. I see ses-setq calls ses-write-cells. I added a call to ses-write-cells after every call to ses-set-cell. But It did NOT work as expected. Do You think It is possible to have that behaviour without using ses-setq on older emacsen? Vincent> PS: I need to improve the macro, notable setting a cell value = should also affect its Vincent> formula if any. Ok. BTW: JIC ses-setq is using 'cl-pushnew' this week there has been a long discussion on emacs-devel about 'use or not to use those cl- prefixes macros' an alternatives that are preloaded on emacs by default. Best Regards Andr=E9s Ram=EDrez --_000_PAXP192MB1608AB2F20A535B0F6E0749084ABAPAXP192MB1608EURP_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear Andr=E8s,

Concerning the backward compatibility you could test emacs version in smete= r.el to know whether the newer ses is distibuted. Otherwise, if not distrib= uted you could have some newer ses.el copied to the same dir as smeter.el a= nd change the load path in smeter.el for this newer ses.el to be loaded instead of the coming with the older em= acs.

FYI, I have no idea when I will push to master the ses-setq etc... changes,= and no idea when this is in a new release of Emacs.

Thank you for the information about the cl-... macros, I will I have look w= hen time allows ...

  Vincent.

PS : Maybe smeter.el would be simpler if the final sum was done by SES rath= er than org-table stuff.

De : andr=E9s ram=EDrez <= ;rrandresf@hotmail.com>
Envoy=E9 : dimanche 5 novembre 2023 15:58
=C0 : Vincent Bela=EFche <vincent.b.1@hotmail.fr>
Cc : emacs-devel <emacs-devel@gnu.org>; boruch_baum@gmx.c= om <boruch_baum@gmx.com>
Objet : Re: using ses programatically (was: a ses question)
 
Hi. Vincent.
My comments below.

>>>>> "Vincent" =3D=3D Vincent Bela=EFche <vinc= ent.b.1@hotmail.fr> writes:

    Vincent>  Dear Andr=E8s,

    Vincent> I drafted a macro ses-setq to allow access a= SES spreadsheet programatically, and I
    Vincent> updated your code to use it. This allowed to= remove all the workarounds. Please note
    Vincent> that ses-setq is just a draft, far from comp= lete. I intend to add some switches to
    Vincent> allow access the cells eaither by cell name = or by row col, and to modify either value
    Vincent> or formula.

That's great. Just to mention again I have a newt-C-language app that
calls emacs this way:
--8<---------------cut here---------------start------------->8---
system ("cp workbook.ses /tmp; cp smeter.el /tmp; emacs -Q --batch -l = /tmp/smeter.el /tmp/smeteroutput -f smeter/further-processing > /dev/nul= l 2>&1");
--8<---------------cut here---------------end--------------->8---
And when the calling ends. It reads ses-output from /tmp/smeter.mail.

The C-language app does not known anything about emacs. So the logic of
calculation is within workbook.ses. That way when calculation logic
changes. The newt-C-language-App does not need to be changed. Just the
formulae within workbook.ses would be changed, which BTW is simpler than re= -compiling the
newt-C-language-App.


[...]

The published version works as expected. Thanks for It.

But. I have a question. If emacs does NOT have the ses-setq
buffer (29.1 as an example). Which function calls should I do for having ba= ckward compatibility with older emacsen?.

I see ses-setq calls ses-write-cells. I added a call to ses-write-cells
after every call to ses-set-cell. But It did NOT work as expected.

Do You think It is possible to have that behaviour without using
ses-setq on older emacsen?

    Vincent> PS: I need to improve the macro, notable set= ting a cell value should also affect its
    Vincent> formula if any.

Ok.

BTW: JIC ses-setq is using 'cl-pushnew' this week there has been a long
discussion on emacs-devel about 'use or not to use those cl- prefixes
macros' an alternatives that are preloaded on emacs by default.

Best Regards
Andr=E9s Ram=EDrez
--_000_PAXP192MB1608AB2F20A535B0F6E0749084ABAPAXP192MB1608EURP_--