all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-sbe recent changes?
@ 2022-10-30 18:07 alan.schmitt
  2022-10-30 19:26 ` Alan Schmitt
  2022-10-31  1:24 ` Ihor Radchenko
  0 siblings, 2 replies; 6+ messages in thread
From: alan.schmitt @ 2022-10-30 18:07 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

I’ve been using ledger and an org-mode table to track my finances for a
long time, and today it broke: when I evaluate a table macro, I get an
#ERROR instead of the computed value.

The code I’m using is still the one from here:
https://alan.petitepomme.net/tips/ledger_and_org.html

Basically I define a function like this (I added the message part for debugging):

#+name: call_ledger
#+begin_src emacs-lisp :var lcmd="bal" :var bucket="Quotidien" :var prefix="Expenses:" :var period=()
  (let* ((name (org-trim bucket))
         (bname (concat "'^" prefix name "'"))
         (ledger "ledger -f ~/Documents/Org/mescomptes.ledger")
         (parg (when period (concat " -p '" period "'")))
         (cutcmd "tail -1 | cut -d ' ' -f 2")
         (cmd
          (concat ledger " -J " parg " " lcmd " " bname " | " cutcmd))
         (res (org-trim (shell-command-to-string cmd))))
    (message res)
    (if (equal res "") 0 res))
#+end_src

Then I call it in a table that looks like this (removing a lot of stuff
for privacy reasons):

| Bucket                         | Planned | Remaining |
|--------------------------------+---------+-----------+
| Achat Maison                   |    1000 | #ERROR    |
|--------------------------------+---------+-----------+
| Total                          |    1000 | #ERROR    |
#+TBLFM: @2$3..@>>$3='(org-sbe call_ledger (bucket $$1) (prefix "\"Bucket:Expenses:\""))

It used to work, but now I get an #ERROR. The strange thing is that the
correct value is printed with the message call. Did something change
recently regarding org-sbe and table? How can I find out what the
value is causing the #ERROR to be printed?

Thanks,

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-sbe recent changes?
  2022-10-30 18:07 org-sbe recent changes? alan.schmitt
@ 2022-10-30 19:26 ` Alan Schmitt
  2022-10-31  1:24 ` Ihor Radchenko
  1 sibling, 0 replies; 6+ messages in thread
From: Alan Schmitt @ 2022-10-30 19:26 UTC (permalink / raw)
  To: emacs-orgmode

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

If it matters, everything works with org version 9.5.5, but it break
with org 9.6.

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-sbe recent changes?
  2022-10-30 18:07 org-sbe recent changes? alan.schmitt
  2022-10-30 19:26 ` Alan Schmitt
@ 2022-10-31  1:24 ` Ihor Radchenko
  2022-10-31  8:07   ` Alan Schmitt
  1 sibling, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-10-31  1:24 UTC (permalink / raw)
  To: alan.schmitt; +Cc: emacs-orgmode

alan.schmitt@polytechnique.org writes:

> Basically I define a function like this (I added the message part for debugging):
> ...
> #+name: call_ledger
> ...
> Then I call it in a table that looks like this (removing a lot of stuff
> for privacy reasons):
>
> | Bucket                         | Planned | Remaining |
> |--------------------------------+---------+-----------+
> | Achat Maison                   |    1000 | #ERROR    |
> |--------------------------------+---------+-----------+
> | Total                          |    1000 | #ERROR    |
> #+TBLFM: @2$3..@>>$3='(org-sbe call_ledger (bucket $$1) (prefix "\"Bucket:Expenses:\""))

May you simplify your example to demonstrate the problem reproducibly
(not only on your system with your files)?
See https://orgmode.org/manual/Feedback.html#Feedback

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-sbe recent changes?
  2022-10-31  1:24 ` Ihor Radchenko
@ 2022-10-31  8:07   ` Alan Schmitt
  2022-11-01  2:16     ` Ihor Radchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Schmitt @ 2022-10-31  8:07 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Hello,

On 2022-10-31 01:24, Ihor Radchenko <yantar92@posteo.net> writes:

> May you simplify your example to demonstrate the problem reproducibly
> (not only on your system with your files)?
> See https://orgmode.org/manual/Feedback.html#Feedback

Of course, sorry I did not do it. Here is a minimal example:

#+name: foo
#+begin_src emacs-lisp
3
#+end_src

| Name  | Test |
|-------+------|
| Hello |      |
#+TBLFM: @2$2..@>$2='(org-sbe foo)


When I evaluate the formula, I get #ERROR instead of 3 in the cell. This
is with org 9.6. I have another emacs setup with 9.5.5 and there I have
the correct result.

Best,

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-sbe recent changes?
  2022-10-31  8:07   ` Alan Schmitt
@ 2022-11-01  2:16     ` Ihor Radchenko
  2022-11-01  8:40       ` Alan Schmitt
  0 siblings, 1 reply; 6+ messages in thread
From: Ihor Radchenko @ 2022-11-01  2:16 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Of course, sorry I did not do it. Here is a minimal example:
>
> #+name: foo
> #+begin_src emacs-lisp
> 3
> #+end_src
>
> | Name  | Test |
> |-------+------|
> | Hello |      |
> #+TBLFM: @2$2..@>$2='(org-sbe foo)
>
>
> When I evaluate the formula, I get #ERROR instead of 3 in the cell. This
> is with org 9.6. I have another emacs setup with 9.5.5 and there I have
> the correct result.

Thanks!
Fixed on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9987451252fa64af65d0a0a014f41812f4402c02

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: org-sbe recent changes?
  2022-11-01  2:16     ` Ihor Radchenko
@ 2022-11-01  8:40       ` Alan Schmitt
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Schmitt @ 2022-11-01  8:40 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

On 2022-11-01 02:16, Ihor Radchenko <yantar92@posteo.net> writes:

> Fixed on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9987451252fa64af65d0a0a014f41812f4402c02

Thanks a lot!

Alan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 528 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-01  8:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-30 18:07 org-sbe recent changes? alan.schmitt
2022-10-30 19:26 ` Alan Schmitt
2022-10-31  1:24 ` Ihor Radchenko
2022-10-31  8:07   ` Alan Schmitt
2022-11-01  2:16     ` Ihor Radchenko
2022-11-01  8:40       ` Alan Schmitt

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.