Hi all,
I hit the problem described in
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg127317.html - I
couldn't see that anyone else had fixed it so I had a go.
The problem is that, unusually, ob-lilypond has some conditional logic on
its header-args. Its solution is to set the header-args internally when
required, which overrides any user-specified value.
The quickest way I could see to preserve the conditional logic was to add a
new variable to hold the user configuration, which I called
ob-lilypond-header-args. Now the conditional logic sets
org-babel-header-args:lilypond to the new variable's value when appropriate.
Another way would be to create a context which sets the variable when
needed and then resets it. I opted against this as I'm not sure it would
have the same behaviour in all cases. Happy to have a go if it would be
preferable, though.
Cheers,
Jamie
From f413a36ac9b7ca7c990ee1ab6456cc237ebccf3d Mon Sep 17 00:00:00 2001
From: Jamie Bayne
Date: Sat, 2 Jan 2021 02:18:37 +
Subject: [PATCH] Allow user to set ob-lilypond header arguments
* ob-lilypond.el (org-babel-lilypond-set-header-args): Replace
hard-coded settings with user-configurable variable.
(org-babel-header-args:lilypond): Modify documentation.
(ob-lilypond-header-args): New variable.
TINYCHANGE
---
lisp/ob-lilypond.el | 14 +++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el
index fbdd905a5..11ae9ae88 100644
--- a/lisp/ob-lilypond.el
+++ b/lisp/ob-lilypond.el
@@ -43,6 +43,15 @@
(defvar org-babel-default-header-args:lilypond '()
"Default header arguments for lilypond code blocks.
NOTE: The arguments are determined at lilypond compile time.
+See `org-babel-lilypond-set-header-args'
+To configure, see `ob-lilypond-header-args'
+.")
+
+(defvar ob-lilypond-header-args
+ '((:results . "file") (:exports . "results"))
+ "User-configurable header arguments for lilypond code blocks.
+NOTE: The final value used by org-babel is computed at compile-time
+and stored in `org-babel-default-header-args:lilypond'
See `org-babel-lilypond-set-header-args'.")
(defvar org-babel-lilypond-compile-post-tangle t
@@ -403,9 +412,8 @@ These depend upon whether we are in Arrange mode i.e. MODE is t."
(:results . "silent")
(:cache . "yes")
(:comments . "yes")))
-(t
- '((:results . "file")
- (:exports . "results")
+(t
+ ob-lilypond-header-args)))
(defun org-babel-lilypond-set-header-args (mode)
"Set org-babel-default-header-args:lilypond
--
2.29.2