From: Jamie Bayne <firstname.lastname@example.org> To: email@example.com Subject: [PATCH] ob-lilypond: allow user configuration of header-args Date: Sun, 10 Jan 2021 14:25:40 +0000 [thread overview] Message-ID: <CANwLyLNCUDEqrtLe9DxB+xZg9T-DWfmfHzrPMuqcUZLZW347Tg@mail.gmail.com> (raw) [-- Attachment #1.1: Type: text/plain, Size: 888 bytes --] Hi all, I hit the problem described in https://firstname.lastname@example.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 <email@example.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
next reply other threads:[~2021-01-10 14:49 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-10 14:25 Jamie Bayne [this message] 2021-01-12 12:40 ` Jonathan Gregory 2021-04-26 8:27 ` Bastien
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CANwLyLNCUDEqrtLe9DxB+xZg9T-DWfmfHzrPMuqcUZLZW347Tg@mail.gmail.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH] ob-lilypond: allow user configuration of header-args' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this 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).