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        )))