On 29 Jul 2023, Ihor Radchenko wrote:
Jonathan Gregory <j...@autistici.org> writes:
The basic-mode term is not very helpful. Perhaps
[inline/cropped/embedded]-mode would have been more descriptive
in terms of what it does.
Sounds reasonable. I like "inline-mode", although no strong
opinion.
I like it too.
... Anyway, hard-coding paper settings would simplify things a
bit, but I'm not sure that hard-coding the version is a good
idea and may produce errors with older installations.
Do people have reasons to use older versions even when they
could use the newest?
Probably not.
For example, python2/3 or MathJax4,4- were breaking and some
people were relying on legacy code. So, we had to provide some
extra versions checks and toggles on Org side as well.
We're talking about different things here. Lilypond needs the
\version to upgrade the syntax. IIUC this makes it possible for a
future version to compile input code correctly, even if it was
written in a previous version (which may have used some different
syntax), as long as the \version is included in the main file.
There's even a `convert-ly` command to make upgrades based on the
\version, so I'd suggest moving only \paper settings to the
ob-lilypond file and keeping the \version in the source file.
#+name: test
#+begin_src emacs-lisp
(message "This is test")
#+end_src
#+begin_src emacs-lisp :prologue (org-sbe test)
(+ 1 2)
#+end_src
Correction: `org-sbe' will execute src block. So, my example is
not completely accurate. Getting src block body is still doable,
but a tiny bit more tricky:
#+begin_src emacs-lisp :prologue (org-babel-ref-resolve
"test[]")
(+ 1 2)
#+end_src
It think that it will be logical to add reference resolution to
:prologue/:epilogue. I will see what I can do. (I may need to
look through which header args are resolved and which are not -
there seems to be no consistency)
What do you mean by reference resolution? FWIW :prologue
(org-babel-ref-resolve "test[]") works even if "test" is a
lilypond source block. This is good. Again, no need to add
<<test>> to all lilypond blocks.
Interesting. I didn't know about org-sbe. Looks useful. I'll
look into it when I find time. In the meantime, we can use:
#+PROPERTY: header-args:lilypond :noweb yes :exports results
:prologue (org-sbe version-and-paper)
(This will work because ob-org, by accident, produces body as
result of evaluation, with default header args)
--
Jonathan