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
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
* org-babel-lob-ingest -- : Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-649-gb76ed6
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
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
[-- 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 --]
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
> 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
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