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: Wed, 1 Nov 2023 19:23:39 +0000 [thread overview]
Message-ID: <PAXP192MB1608C1416E7F7D05ADA8392A84A7A@PAXP192MB1608.EURP192.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <PAXP192MB160835964EA2273C0C2DF31E84A7A@PAXP192MB1608.EURP192.PROD.OUTLOOK.COM>
[-- Attachment #1: Type: text/plain, Size: 4272 bytes --]
I see, I usually use this kind of snippet with some eval-region and the code where ses-range is found is in some buffer region, and in this case the macro expansion is delayed as Emacs does need to slurp the buffer region in the first place. I do this through some preprocessor of mine that allows to embed some Elisp code in comments in a file with another language.
This is why I was not aware the snippet would fail, anyway, I should have tested it before sending.
V.
________________________________
De : Vincent Belaïche <vincent.b.1@hotmail.fr>
Envoyé : mercredi 1 novembre 2023 20:08
À : Andrés Ramírez <rrandresf@hotmail.com>
Cc : emacs-devel <emacs-devel@gnu.org>; boruch_baum@gmx.com <boruch_baum@gmx.com>
Objet : RE: a ses question
Hello,
Yes, I reproduced it, you can write the expression as follows :
(eval '(ses-range A1 C3 *2 >v))
to delay the macro expansion. I think that this kind of snippet used to work, I need to investigate why it does not work any longer.
V.
________________________________
De : andrés ramírez <rrandresf@hotmail.com>
Envoyé : lundi 30 octobre 2023 20:03
À : 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: a ses question
Hi. Vincent.
I just yanked the elisp snippet You shared (without any modification) I
just did M-x eval-defun, and It gave me this error:
--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (error "Eager macro-expansion failure: (void-variable ses-...")
signal(error ("Eager macro-expansion failure: (void-variable ses-..."))
error("Eager macro-expansion failure: %S" (void-variable ses--cells))
internal-macroexpand-for-load((setq elisp--eval-defun-result (let ((print-level nil) (print-length nil)) (defalias 'smeter/further-processing #'(lambda nil "process input on as spreadsheet using ses formulae..." (interactive) (let (... ... ... ... ... ... myyyyymm mysesoutput chunk bigchunk) (goto-char ...) (setq beg ...) (setq workbook-filename ...) (forward-line 1) (setq beg ...) (forward-line 4) (setq prevmeasu ...) (setq beg ...) (setq waterbill ...) (forward-line 1) (setq beg ...) (forward-line 4) (setq measu ...) (setq beg ...) (setq myyyyymm ...) (if ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...)))))) t)
eval-region(162 5110 t #f(compiled-function (ignore) #<bytecode -0x5bb31d1b5fed60e>)) ; Reading at buffer position 2635
elisp--eval-defun()
eval-defun(nil)
funcall-interactively(eval-defun nil)
call-interactively(eval-defun record nil)
command-execute(eval-defun record)
execute-extended-command(nil "eval-defun" "eval-defun")
funcall-interactively(execute-extended-command nil "eval-defun" "eval-defun")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
--8<---------------cut here---------------end--------------->8---
Best Regards
Andrés Ramírez
>>>>> "Vincent" == Vincent Belaïche <vincent.b.1@hotmail.fr> writes:
Vincent> Just reading again the code which I sent in my
Vincent> previous email, I found a problem, there would be one trailing column separator « & »
Vincent> too many. Probably the following would be better:
Vincent> (let ((range (with-current-buffer the-ses-buffer (ses-range A1 C3 ; adapt to your case
Vincent> *2 '>v ; use 'v> to read columnwsise
Vincent> )))) (dolist (row (cdr range)) ; cdr to
Vincent> remove 'vec (pop row) ; remove 'vec (while (progn (insert (format "%f" (pop
Vincent> row))) ; assuming all cells are floating point numbers (when row (insert
Vincent> "&" ; if & is the column separator ) t ; loop again )))
Vincent> (insert "\\\\\n"; if \\ is the row separator )))
[-- Attachment #2: Type: text/html, Size: 9021 bytes --]
next prev parent reply other threads:[~2023-11-01 19:23 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 [this message]
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
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=PAXP192MB1608C1416E7F7D05ADA8392A84A7A@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.