all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Vincent Belaïche" <vincent.b.1@hotmail.fr>
To: "Andrés Ramírez" <rrandresf@hotmail.com>
Cc: emacs-devel <emacs-devel@gnu.org>,
	"boruch_baum@gmx.com" <boruch_baum@gmx.com>
Subject: RE: a ses question
Date: Fri, 3 Nov 2023 22:13:12 +0000	[thread overview]
Message-ID: <PAXP192MB1608862ADB5B989D43FB26B784A5A@PAXP192MB1608.EURP192.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <PAXP192MB16082AEA286439C6AA0305F284A5A@PAXP192MB1608.EURP192.PROD.OUTLOOK.COM>

[-- Attachment #1: Type: text/plain, Size: 2627 bytes --]

Dear Andrés,

Please find a tentative fix [https://res.cdn.office.net/assets/mail/file-icon/png/generic_16x16.png] ses.el<https://1drv.ms/u/s!AkDIBBjRAOVwg2_MBM_HJ7xOBFEl> 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


[-- Attachment #2: Type: text/html, Size: 7434 bytes --]

  reply	other threads:[~2023-11-03 22:13 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <SJ1PR12MB6363EAEDEA36DA78E736B9DEA61EA@SJ1PR12MB6363.namprd12.prod.outlook.com>
2023-10-29 16:43 ` a ses question Vincent Belaïche
2023-10-29 21:25   ` Vincent Belaïche
2023-10-30  5:43     ` Vincent Belaïche
2023-10-30 19:03       ` andrés ramírez
2023-11-01 19:08         ` Vincent Belaïche
2023-11-01 19:23           ` Vincent Belaïche
2023-11-02 11:20             ` Vincent Belaïche
2023-11-02 11:27               ` Vincent Belaïche
2023-11-02 11:31                 ` Vincent Belaïche
2023-11-02 18:19                 ` Stefan Monnier
2023-11-03 15:54                   ` Vincent Belaïche
2023-11-03 22:13                     ` Vincent Belaïche [this message]
2023-11-04 13:46                       ` andrés ramírez
     [not found]                       ` <SJ1PR12MB636334BD471403C3F936BF25A6A4A@SJ1PR12MB6363.namprd12.prod.outlook.com>
2023-11-05 10:25                         ` using ses programatically (was: a ses question) Vincent Belaïche
2023-11-05 14:58                           ` andrés ramírez
2023-11-05 16:55                             ` Vincent Belaïche
2023-11-05 19:33                               ` andrés ramírez
2023-11-18 22:55                                 ` Vincent Belaïche
2023-11-19 19:24                                   ` andrés ramírez
2023-11-19 23:18                                     ` Vincent Belaïche
2023-11-19 23:24                                       ` Vincent Belaïche
2023-11-20  0:33                                         ` andrés ramírez
2023-12-24 11:51                                           ` Vincent Belaïche
2023-12-24 15:44                                             ` andrés ramírez
2023-12-24 21:13                                               ` Vincent Belaïche
2023-12-27 17:42                                                 ` Vincent Belaïche
2023-11-01 17:07 a ses question Andrés Ramírez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAXP192MB1608862ADB5B989D43FB26B784A5A@PAXP192MB1608.EURP192.PROD.OUTLOOK.COM \
    --to=vincent.b.1@hotmail.fr \
    --cc=boruch_baum@gmx.com \
    --cc=emacs-devel@gnu.org \
    --cc=rrandresf@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.