* [PATCH] ob-lilypond: allow user configuration of header-args
@ 2021-01-10 14:25 Jamie Bayne
2021-01-12 12:40 ` Jonathan Gregory
2021-04-26 8:27 ` Bastien
0 siblings, 2 replies; 3+ messages in thread
From: Jamie Bayne @ 2021-01-10 14:25 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 888 bytes --]
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
[-- Attachment #1.2: Type: text/html, Size: 1151 bytes --]
[-- Attachment #2: 0001-Allow-user-to-set-ob-lilypond-header-arguments.patch --]
[-- Type: text/x-patch, Size: 1758 bytes --]
From f413a36ac9b7ca7c990ee1ab6456cc237ebccf3d Mon Sep 17 00:00:00 2001
From: Jamie Bayne <jamiebayne@hotmail.com>
Date: Sat, 2 Jan 2021 02:18:37 +0000
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ob-lilypond: allow user configuration of header-args
2021-01-10 14:25 [PATCH] ob-lilypond: allow user configuration of header-args Jamie Bayne
@ 2021-01-12 12:40 ` Jonathan Gregory
2021-04-26 8:27 ` Bastien
1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Gregory @ 2021-01-12 12:40 UTC (permalink / raw)
To: emacs-orgmode
Hi Jamie
On 10 Jan 2021, Jamie Bayne wrote:
> 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
I'm not sure I understand the second proposal. Either way, the
solution looks reasonable.
Thanks for your help
--
Jonathan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ob-lilypond: allow user configuration of header-args
2021-01-10 14:25 [PATCH] ob-lilypond: allow user configuration of header-args Jamie Bayne
2021-01-12 12:40 ` Jonathan Gregory
@ 2021-04-26 8:27 ` Bastien
1 sibling, 0 replies; 3+ messages in thread
From: Bastien @ 2021-04-26 8:27 UTC (permalink / raw)
To: Jamie Bayne; +Cc: emacs-orgmode
Hi Jamie,
thanks for the patch, I applied it as ea8f7610c.
ob-lilypond.el does not have a maintainer, would you be willing
to volunteer?
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-26 8:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-10 14:25 [PATCH] ob-lilypond: allow user configuration of header-args Jamie Bayne
2021-01-12 12:40 ` Jonathan Gregory
2021-04-26 8:27 ` Bastien
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).