* org-sbe and code blocks in a different files
@ 2020-07-07 18:43 Michael Welle
2020-07-08 14:10 ` Eric S Fraga
2020-07-08 14:11 ` Eric S Fraga
0 siblings, 2 replies; 9+ messages in thread
From: Michael Welle @ 2020-07-07 18:43 UTC (permalink / raw)
To: emacs-orgmode
Hello,
I can execute code blocks in different (separate?) files like this:
#+call: ../lob.org:convert-time-range-to-days(range="<2020-02-19
Wed>--<2020-02-21 Fri>")
That is great. Can I call the same function from a table function?
org-sbe doesn't support the above notation extended with an Org file
name, I think.
Second, I try to concentrate useful reusable code blocks in one file,
lob.org in my case. That works. But I feel that I need some of the elisp
based code blocks as code blocks, that I can execute, as well as
separate elisp forms that I can eval from elisp code. How to deal
with that?
Ideas:
Having two code blocks per function: one with the actual elisp code that
can be tangled and a second one that just evals the form and can be used
as a, well, code block usable with #+call?
Or should I give them names like func and func_code (that's the one with
actual elisp code) and write an elisp form that grabs all code blocks
named *_code and evals them at start-up to bring the forms into the
environment?
Other ideas are also welcome.
Regards
hmw
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-sbe and code blocks in a different files
2020-07-07 18:43 org-sbe and code blocks in a different files Michael Welle
@ 2020-07-08 14:10 ` Eric S Fraga
2020-07-08 14:11 ` Eric S Fraga
1 sibling, 0 replies; 9+ messages in thread
From: Eric S Fraga @ 2020-07-08 14:10 UTC (permalink / raw)
To: Michael Welle; +Cc: emacs-orgmode
On Tuesday, 7 Jul 2020 at 20:43, Michael Welle wrote:
> That is great. Can I call the same function from a table function?
> org-sbe doesn't support the above notation extended with an Org file
> name, I think.
Does org-sbe work if you have invoked org-babel-log-ingest first?
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-649-gb76ed6
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-sbe and code blocks in a different files
2020-07-07 18:43 org-sbe and code blocks in a different files Michael Welle
2020-07-08 14:10 ` Eric S Fraga
@ 2020-07-08 14:11 ` Eric S Fraga
2020-07-08 14:59 ` Michael Welle
1 sibling, 1 reply; 9+ messages in thread
From: Eric S Fraga @ 2020-07-08 14:11 UTC (permalink / raw)
To: Michael Welle; +Cc: emacs-orgmode
* org-babel-lob-ingest
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-649-gb76ed6
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-sbe and code blocks in a different files
2020-07-08 14:11 ` Eric S Fraga
@ 2020-07-08 14:59 ` Michael Welle
2020-07-08 15:07 ` Eric S Fraga
0 siblings, 1 reply; 9+ messages in thread
From: Michael Welle @ 2020-07-08 14:59 UTC (permalink / raw)
To: emacs-orgmode
Hi Eric,
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> * org-babel-lob-ingest
ah, I learned something new here. Unfortunately, it seems like org-sbe
doesn't look into the list spit out by org-babel-lob-ingest.
Regards
hmw
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-sbe and code blocks in a different files
2020-07-08 14:59 ` Michael Welle
@ 2020-07-08 15:07 ` Eric S Fraga
0 siblings, 0 replies; 9+ messages in thread
From: Eric S Fraga @ 2020-07-08 15:07 UTC (permalink / raw)
To: Michael Welle; +Cc: emacs-orgmode
On Wednesday, 8 Jul 2020 at 16:59, Michael Welle wrote:
>> * org-babel-lob-ingest
> ah, I learned something new here. Unfortunately, it seems like org-sbe
> doesn't look into the list spit out by org-babel-lob-ingest.
Pity, and strange in that #+call: works on ingested babel blocks without
having to specify a file name.
--
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-649-gb76ed6
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-sbe and code blocks in a different files
@ 2020-07-08 20:29 Douglas Perrin
2020-07-09 7:09 ` Michael Welle
0 siblings, 1 reply; 9+ messages in thread
From: Douglas Perrin @ 2020-07-08 20:29 UTC (permalink / raw)
To: emacs-orgmode; +Cc: mwe012008
[-- Attachment #1: Type: text/plain, Size: 933 bytes --]
Hi Michael,
Maybe I am not understanding what you want to do but I use
org-babel-lob-ingest/org-sbe to execute blocks from other files on
start-up like this:
# Local Variables:
# eval: (org-babel-lob-ingest "Template-Loader.org")
# eval: (org-sbe "Init-Template") ;; the name of a block
in Template-Loader.org file
# End:
I assume this means that org-sbe can see the block names from the other
file. But I haven't tested the behavior with #call just executing elisp.
Doug
Date: Wed, 08 Jul 2020 16:59:32 +0200
From: Michael Welle <mwe012008@gmx.net>
To: emacs-orgmode@gnu.org
Subject: Re: org-sbe and code blocks in a different files
Message-ID: <877dve9hnv.fsf@luisa.c0t0d0s0.de>
Content-Type: text/plain
Hi Eric,
Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> * org-babel-lob-ingest
ah, I learned something new here. Unfortunately, it seems like org-sbe
doesn't look into the list spit out by org-babel-lob-ingest.
Regards
hmw
[-- Attachment #2: Type: text/html, Size: 1566 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-sbe and code blocks in a different files
2020-07-08 20:29 Douglas Perrin
@ 2020-07-09 7:09 ` Michael Welle
2020-07-09 16:43 ` Berry, Charles via General discussions about Org-mode.
0 siblings, 1 reply; 9+ messages in thread
From: Michael Welle @ 2020-07-09 7:09 UTC (permalink / raw)
To: emacs-orgmode
Hi Douglas,
Douglas Perrin <doug2024@gmail.com> writes:
> Hi Michael,
> Maybe I am not understanding what you want to do but I use
> org-babel-lob-ingest/org-sbe to execute blocks from other files on
> start-up like this:
> # Local Variables:
> # eval: (org-babel-lob-ingest "Template-Loader.org")
> # eval: (org-sbe "Init-Template") ;; the name of a block
> in Template-Loader.org file
> # End:
>
> I assume this means that org-sbe can see the block names from the other
> file. But I haven't tested the behavior with #call just executing elisp.
> Doug
thanks for bringing that up again. Your example works, of course. After
further inspection I think that variables kill my example:
This code block comes from a file I processed with org-babel-lob-ingest.
o-b-l-i returns the correct number of code blocks in that file and org-bab
#+name: boing
#+begin_src elisp :var range=42
(message "Hello, crude world: %s" range)
#+end_src
This comes from the file where I want to use the code block:
|------------------------------------+--------|
| <2020-02-19 Wed>--<2020-02-21 Fri> | #ERROR |
#+TBLFM: $2='(org-sbe "boing" (range 23))
That fails. After removing the variable from the code block and from
org-sbe it works as expected. It works as well if I copy the code block
including the variable into the file with the table. Might be a bug or
my own stupidity?
Regards
hmw
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-sbe and code blocks in a different files
2020-07-09 7:09 ` Michael Welle
@ 2020-07-09 16:43 ` Berry, Charles via General discussions about Org-mode.
2020-07-09 17:17 ` Michael Welle
0 siblings, 1 reply; 9+ messages in thread
From: Berry, Charles via General discussions about Org-mode. @ 2020-07-09 16:43 UTC (permalink / raw)
To: Michael Welle; +Cc: emacs-orgmode@gnu.org
> On Jul 9, 2020, at 12:09 AM, Michael Welle <mwe012008@gmx.net> wrote:
>
> Hi Douglas,
>
> Douglas Perrin <doug2024@gmail.com> writes:
>
>> Hi Michael,
>> Maybe I am not understanding what you want to do but I use
>> org-babel-lob-ingest/org-sbe to execute blocks from other files on
>> start-up like this:
>> # Local Variables:
>> # eval: (org-babel-lob-ingest "Template-Loader.org")
>> # eval: (org-sbe "Init-Template") ;; the name of a block
>> in Template-Loader.org file
>> # End:
>>
>> I assume this means that org-sbe can see the block names from the other
>> file. But I haven't tested the behavior with #call just executing elisp.
>> Doug
> thanks for bringing that up again. Your example works, of course. After
> further inspection I think that variables kill my example:
>
> This code block comes from a file I processed with org-babel-lob-ingest.
> o-b-l-i returns the correct number of code blocks in that file and org-bab
>
> #+name: boing
> #+begin_src elisp :var range=42
> (message "Hello, crude world: %s" range)
> #+end_src
>
> This comes from the file where I want to use the code block:
>
> |------------------------------------+--------|
> | <2020-02-19 Wed>--<2020-02-21 Fri> | #ERROR |
> #+TBLFM: $2='(org-sbe "boing" (range 23))
>
> That fails. After removing the variable from the code block and from
> org-sbe it works as expected. It works as well if I copy the code block
> including the variable into the file with the table. Might be a bug or
> my own stupidity?
>
Not stupidity. AFAICS there is no call in org-sbe to org-babel-lob-get-info, so the params are not updated. I supposed this counts as a bug.
As a workaround
#+TBLFM: $2='(org-babel-ref-resolve "boing(range=23)")
should do.
HTH,
Chuck
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: org-sbe and code blocks in a different files
2020-07-09 16:43 ` Berry, Charles via General discussions about Org-mode.
@ 2020-07-09 17:17 ` Michael Welle
0 siblings, 0 replies; 9+ messages in thread
From: Michael Welle @ 2020-07-09 17:17 UTC (permalink / raw)
To: emacs-orgmode
Hi Charles,
"Berry, Charles" via "General discussions about Org-mode."
<emacs-orgmode@gnu.org> writes:
>> On Jul 9, 2020, at 12:09 AM, Michael Welle <mwe012008@gmx.net> wrote:
[...]
> Not stupidity. AFAICS there is no call in org-sbe to
> org-babel-lob-get-info, so the params are not updated. I supposed this
> counts as a bug.
>
> As a workaround
>
> #+TBLFM: $2='(org-babel-ref-resolve "boing(range=23)")
finally I came up with this for my real use case:
#+TBLFM: $2='(org-babel-ref-resolve (format
"convert-time-range-to-days(range=\"%s\")" $1))
Thanks everyone.
Regards
hmw
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-07-09 17:20 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-07 18:43 org-sbe and code blocks in a different files Michael Welle
2020-07-08 14:10 ` Eric S Fraga
2020-07-08 14:11 ` Eric S Fraga
2020-07-08 14:59 ` Michael Welle
2020-07-08 15:07 ` Eric S Fraga
-- strict thread matches above, loose matches on Subject: below --
2020-07-08 20:29 Douglas Perrin
2020-07-09 7:09 ` Michael Welle
2020-07-09 16:43 ` Berry, Charles via General discussions about Org-mode.
2020-07-09 17:17 ` Michael Welle
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).