emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: a ses question


From: Vincent Belaïche
Subject: RE: a ses question
Date: Fri, 3 Nov 2023 22:13:12 +0000

Dear Andrés,

Please find a tentative fix ses.el that allows ses-range to be expanded not in a SES buffer, provided that the result is evaluated in a SES buffer. So you can get values from the SES buffer this way (without the (eval (quote …)) workaround to delay evaluation) :

(let ((range (with-current-buffer the-ses-buffer (ses-range A1 A2 >v))))
   … do some processing with range. …
  )

Doing this way rather than getting strings with buffer-substring from the print area you get raw values, not formatted values. This may be more convenient if you need to format them otherwise than SES does. Also you do not suffer from any text truncation done by SES due to cells' limited width. This is why this is the method which I always use, even though you need to do some reformatting of these values.

If you really want to read from the print area you need to call ses-write-cells before reading, to ensure that the print area is up-to-date.

Please tell be if the linked ses.el works fine for you, and then I would commit it.

   V.
  

De : Vincent Belaïche <vincent.b.1@hotmail.fr>
Envoyé : vendredi 3 novembre 2023 16:54
À : Stefan Monnier <monnier@iro.umontreal.ca>
Cc : emacs-devel <emacs-devel@gnu.org>; boruch_baum@gmx.com <boruch_baum@gmx.com>; Andrés Ramírez <rrandresf@hotmail.com>
Objet : RE: a ses question
 
Dear Stefan,

Thank you for your reply. On second thought I think that I just did a mistake in the fix I intended to do. I am investigating it and will come back with a working fix for Andrès's problem or more questions …

  V.



De : Stefan Monnier <monnier@iro.umontreal.ca>
Envoyé : jeudi 2 novembre 2023 19:19
À : Vincent Belaïche <vincent.b.1@hotmail.fr>
Cc : emacs-devel <emacs-devel@gnu.org>; boruch_baum@gmx.com <boruch_baum@gmx.com>; Andrés Ramírez <rrandresf@hotmail.com>
Objet : Re: a ses question
 
> (let ((the-ses-buffer (get-buffer "toto.ses")))
>   (with-current-buffer the-ses-buffer (insert (format "%S" (ses-range A1 A1)))))

`ses-range` is a macro.  The exact moment at which a macro is expanded
is not defined precisely.  It can be expanded basically any time as long
as it's before the resulting code is needed for execution.

In other words, it's perfectly normal that the macro call `(ses-range A1 A1)`
is macro-expanded before any of the above code is executed.

If you don't want that, you need to use a function instead.


        Stefan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]