Re: [O] Orgmode Latex Export with Babel/LilyPond
On 20 Apr 2019, Jakob Schöttl wrote: > Hi, > > I'm trying (second attempt), to setup orgmode to export PDFs with > images generated by Babel/LilyPond. > > I followed the setup instructions here: > > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html > > I have > > a recent emacs (Arch Linux), > > ~/.emacs file with > > (org-babel-do-load-languages > 'org-babel-load-languages > '((lilypond t))) > > (although I saw many other snippets where there is a "." between the > (lilypond t)). I tried both variants. > > I tried also tried (require 'lilypond) instead > org-babel-do-load-languages which caused an error. > > I pressed C-c C-e l p -> "PDF file produced." > > But no images are generated and no images appear in the PDF. Only > plain source code. > > Any ideas? > Thank you! > > - Jakob I tried the first example with emacs -Q using Org versions 9.1.9 and 9.3.1, and there were a few things I had to change to generate the image correctly after C-c C-e l p: - Add `:results file :exports results` to the header, - change \relative c’ to \relative c', and - add the missing the #+end_src part. The configuration I used: (add-to-list 'load-path "/usr/share/emacs/site-lisp") (require 'lilypond-mode) (org-babel-do-load-languages 'org-babel-load-languages '((lilypond . t))) -- Jonathan
Re: [O] Orgmode Latex Export with Babel/LilyPond
On 11 Jan 2020, adam wrote: > Still no success in tangling the examples modal-cycle.org modal-cycle2.org > shown here, > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html > > My current problem is Emacs rejecting the addition of either Lilypond or > lilypond, in the org-babel-do-load-languages > >(org-babel-do-load-languages > 'org-babel-load-languages > '( >(emacs-lisp . t) >(shell . t) >(org . t) >(Lilypond . t) >)) > > including either in the last line causes an error at Emacs startup, reported > as, > >Warning (initialization): An error occurred while loading > ‘/home/user/.emacs’: >Symbol's value as variable is void: > > Earlier in my .emacs init file, I had hopefully defined lilypond, thus > >(setq ly-nix-ly-path "lilypond") > >(add-to-list 'load-path "/usr/share/emacs/site-lisp/") > >(autoload 'LilyPond-mode "lilypond-mode") > >(setq auto-mode-alist > (cons '("\\.ly$" . LilyPond-mode) auto-mode-alist)) > >(add-hook 'LilyPond-mode-hook (lambda () (turn-on-font-lock))) > > > In /usr/share/emacs/site-lisp/ many lilypond related .el files > are located, > >lilypond-font-lock.el >lilypond-indent.el >lilypond-init.el >lilypond-mode.el >lilypond-song.el >lilypond-what-beat.el >lilypond-words.el >ltx-help.el >ob-lilypond.el >ob-Lilypond.el >ob-lisp.el >org-tests.el > > > $ which lilypond is unhelpful, > >/usr/bin/lilypond > > > The lilypond installation is at, > >/usr/share/lilypond/2.18.2/ > > > Any advice or suggestions would be most welcome. Version 9.1.9 comes with ob-lilypond.el. There's no ob-babel-lilypond.el AFAIK. Also, where is ly-nix-ly-path and other ly-* variables defined? I don't see these variables. -- Jonathan
Re: [O] Orgmode Latex Export with Babel/LilyPond
Hello On 12 Jan 2020, adam wrote: > On Sun, 2020-01-12 at 10:43 +1300, adam wrote: >> On Sun, 2020-01-12 at 09:04 +1300, adam wrote: >> > >> > On Sat, 2020-01-11 at 12:30 -0300, Jonathan Gregory wrote: >> > > >> > > >> > > >> > > On 11 Jan 2020, adam wrote: >> > > >> > > > >> > > > >> > > > >> > > > Still no success in tangling the examples modal-cycle.org >> > > > modal-cycle2.org >> > > > shown here, >> > > > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html >> > > > >> > > > >> > > > My current problem is Emacs rejecting the addition of either Lilypond >> > > > or >> > > > lilypond, in the org-babel-do-load-languages >> > > > >> > > >(org-babel-do-load-languages >> > > > 'org-babel-load-languages >> > > > '( >> > > >(emacs-lisp . t) >> > > >(shell . t) >> > > >(org . t) >> > > >(Lilypond . t) >> > > >)) >> > > > >> > > > including either in the last line causes an error at Emacs startup, >> > > > reported as, >> > > > >> > > >Warning (initialization): An error occurred while loading >> > > > ‘/home/user/.emacs’: >> > > >Symbol's value as variable is void: > > > > >> > > > >> > > > Earlier in my .emacs init file, I had hopefully defined lilypond, thus >> > > > >> > > >(setq ly-nix-ly-path "lilypond") >> > > > >> > > >(add-to-list 'load-path "/usr/share/emacs/site-lisp/") >> > > > >> > > >(autoload 'LilyPond-mode "lilypond-mode") >> > > > >> > > >(setq auto-mode-alist >> > > > (cons '("\\.ly$" . LilyPond-mode) auto-mode-alist)) >> > > > >> > > >(add-hook 'LilyPond-mode-hook (lambda () (turn-on-font-lock))) >> > > > >> > > > >> > > > In /usr/share/emacs/site-lisp/ many lilypond related .el files >> > > > are located, >> > > > >> > > >lilypond-font-lock.el >> > > >lilypond-indent.el >> > > >lilypond-init.el >> > > >lilypond-mode.el >> > > >lilypond-song.el >> > > >lilypond-what-beat.el >> > > >lilypond-words.el >> > > >ltx-help.el >> > > >ob-lilypond.el >> > > >ob-Lilypond.el >> > > >ob-lisp.el >> > > >org-tests.el >> > > > >> > > > >> > > > $ which lilypond is unhelpful, >> > > > >> > > >/usr/bin/lilypond >> > > > >> > > > >> > > > The lilypond installation is at, >> > > > >> > > >/usr/share/lilypond/2.18.2/ >> > > > >> > > > >> > > > Any advice or suggestions would be most welcome. >> > > Version 9.1.9 comes with ob-lilypond.el. There's no ob-babel-lilypond.el >> > > AFAIK. >> > > Also, >> > > where is ly-nix-ly-path and other ly-* variables defined? I don't see >> > > these >> > > variables. >> > > >> > Thank you. I'll look inside ob-lilypond.el for clues, variables to be >> > defined. >> > >> > >> > Org-mode version 9.1.9 (release_9.1.9-65 ...) @ >> > /usr/share/emacs/26.3/lisp/org >> > on Ubuntu 18.04 >> > >> > $ find / -name "ob*.el" locates only the ob-lilypond.el I downloaded >> > from github >> > >> > >> > Maybe I need a (require 'lilypond) somewhere, I was thinking. >> > >> > >> > Its a new system here. Emacs was installed with Ubuntu's software manager, >> > lilypond >> > was installed with $ sudo apt install lilypond Neither were built from >> > source. >> > >> >> OK, my bad. When I look inside ob-lilypond.el I find I pulled a page of >> markup >> stuff. >> Will grab a proper ob-lilypond.elThat will improve matters. > > > Improvement with correct ob-lilypond.el Now the > (org-babel-do-load-languages ..) > doesn't cause Emacs to report error at Emacs start-up. > > Presently, with examples modal-cycle.org modal-cycle-2.org > modes-in-key-of-C.org > I can C-c C-e l p export to PDF, but there's no music symbols. > > Also I have no M-x ly-* commands available. > > Org Customize Option, babel, lilypond, for org-babel-lilypond-commands is > set to nil That page was published 9 years ago by Martyn Jago. Some of the code in it no longer works with recent versions of Org and LilyPond. Also, the source files used in the examples reside in the author's github page (not editable in worg), so if you want to try them out you may have to make the adjustments yourself prior to running the code. In any case, I pushed a few edits which I think makes the tutorial easier to follow. -- Jonathan
Re: Org-babel-lilypond always renders full pages
Hi On 29 Mar 2020, Oliver Heck wrote: > Hi, > > I am trying to use org-babel-lilypond and basically got it running. > But somehow I always get full lilypond pages back instead of a small > snippet. > This is what I have in my org-file: > > #+NAME: Lilypond > #+BEGIN_SRC lilypond :file test.png > \relative c'' { c d e f } > #+END_SRC > > > I read through the documentation on > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html > but cannot find a clue. > > Any idea what I am doing wrong here? > > Cheers, > Oliver The lilypond manual suggests using \paper variables to reduce the white space around the score. In particular, you should set oddFooterMarkup and oddHeaderMarkup to false. \paper{ indent=0\mm line-width=120\mm oddFooterMarkup=##f oddHeaderMarkup=##f bookTitleMarkup = ##f scoreTitleMarkup = ##f } http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs -- Jonathan
Re: Org-babel-lilypond always renders full pages
Hi Oliver On 30 Mar 2020, Oliver Heck wrote: > Hi Jonathan, > > that works fine. Thank you! > > Can I set this as default header somewhere in the org file or will I > have to include it to every snippet (I will have a lot of them). > > Oliver You can use the Noweb Reference Syntax[1] #+name: paper #+begin_src text :exports none \paper{ oddFooterMarkup=##f } #+end_src #+name: Lilypond #+begin_src lilypond :file test.png <> \relative c'' { c d e f } #+end_src You can also append the extra header to the org-babel-default-header-args:lilypond variable: (advice-add 'org-babel-lilypond-set-header-args :filter-return (lambda (_mode) (setq org-babel-default-header-args:lilypond (append org-babel-default-header-args:lilypond '((:epilogue . "\\paper{ oddFooterMarkup=##f }")) > On 30.03.20 01:58, Jonathan Gregory wrote: >> Hi >> >> On 29 Mar 2020, Oliver Heck wrote: >> >>> Hi, >>> >>> I am trying to use org-babel-lilypond and basically got it running. >>> But somehow I always get full lilypond pages back instead of a small >>> snippet. >>> This is what I have in my org-file: >>> >>> #+NAME: Lilypond >>> #+BEGIN_SRC lilypond :file test.png >>>\relative c'' { c d e f } >>> #+END_SRC >>> >>> >>> I read through the documentation on >>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html >>> but cannot find a clue. >>> >>> Any idea what I am doing wrong here? >>> >>> Cheers, >>> Oliver >> >> The lilypond manual suggests using \paper variables to reduce the white >> space around the score. In particular, you should set oddFooterMarkup >> and oddHeaderMarkup to false. >> >> \paper{ >>indent=0\mm >>line-width=120\mm >>oddFooterMarkup=##f >>oddHeaderMarkup=##f >>bookTitleMarkup = ##f >>scoreTitleMarkup = ##f >> } >> >> http://lilypond.org/doc/v2.18/Documentation/usage/lilypond-output-in-other-programs >> >> -- >> Jonathan >> > > -- -- Jonathan Footnotes: [1] https://orgmode.org/manual/Noweb-Reference-Syntax.html
Re: Org-babel-lilypond always renders full pages
Hi On 30 Mar 2020, stardiviner wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > > stardiviner writes: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA256 >> >> >> You might want to try this: >> >> #+begin_src emacs-lisp >> (add-to-list 'org-babel-default-header-args:lilypond >> '((:prologue . "\paper{ >> indent=0\mm >> line-width=120\mm >> oddFooterMarkup=##f >> oddHeaderMarkup=##f >> bookTitleMarkup = ##f >> scoreTitleMarkup = ##f >> }"))) >> #+end_src >> > > I found this custom setting lilypond header arguments will not work. Because > this code function: > > #+begin_src emacs-lisp > (defun org-babel-lilypond-get-header-args (mode) > "Default arguments to use when evaluating a lilypond source block. > These depend upon whether we are in Arrange mode i.e. MODE is t." > (cond (mode > '((:tangle . "yes") >(:noweb . "yes") >(:results . "silent") >(:cache . "yes") >(:comments . "yes"))) > (t > '((:results . "file") >(:exports . "results") > > (defun org-babel-lilypond-set-header-args (mode) > "Set org-babel-default-header-args:lilypond > dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE." > (setq org-babel-default-header-args:lilypond > (org-babel-lilypond-get-header-args mode))) > #+end_src > > It always reset and return one result of two conditions. > > I think this is a bug. So are all org-babel-default-header-args:LANG custom variables? In the ob-lilypond.el library the headers are hard-coded. [...] -- Jonathan
Re: Org-babel-lilypond always renders full pages
Hi On 02 Apr 2020, stardiviner wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > > Jonathan Gregory writes: > >> Hi >> >> On 30 Mar 2020, stardiviner wrote: >> >>> -BEGIN PGP SIGNED MESSAGE- >>> Hash: SHA256 >>> >>> >>> stardiviner writes: >>> >>>> -BEGIN PGP SIGNED MESSAGE- >>>> Hash: SHA256 >>>> >>>> >>>> You might want to try this: >>>> >>>> #+begin_src emacs-lisp >>>> (add-to-list 'org-babel-default-header-args:lilypond >>>> '((:prologue . "\paper{ >>>> indent=0\mm >>>> line-width=120\mm >>>> oddFooterMarkup=##f >>>> oddHeaderMarkup=##f >>>> bookTitleMarkup = ##f >>>> scoreTitleMarkup = ##f >>>> }"))) >>>> #+end_src >>>> >>> >>> I found this custom setting lilypond header arguments will not work. >>> Because this code function: >>> >>> #+begin_src emacs-lisp >>> (defun org-babel-lilypond-get-header-args (mode) >>> "Default arguments to use when evaluating a lilypond source block. >>> These depend upon whether we are in Arrange mode i.e. MODE is t." >>> (cond (mode >>> '((:tangle . "yes") >>>(:noweb . "yes") >>>(:results . "silent") >>>(:cache . "yes") >>>(:comments . "yes"))) >>> (t >>> '((:results . "file") >>>(:exports . "results") >>> >>> (defun org-babel-lilypond-set-header-args (mode) >>> "Set org-babel-default-header-args:lilypond >>> dependent on ORG-BABEL-LILYPOND-ARRANGE-MODE." >>> (setq org-babel-default-header-args:lilypond >>> (org-babel-lilypond-get-header-args mode))) >>> #+end_src >>> >>> It always reset and return one result of two conditions. >>> >>> I think this is a bug. >> >> So are all org-babel-default-header-args:LANG custom variables? In the >> ob-lilypond.el library the headers are hard-coded. >> >> [...] > > Yes, it's hard-coded in that function definition. So setting that header > arguments variable will not work at all. OK, I had a closer look and none of the other libraries set org-babel-default-header-args:LANG in the file itself. IOW ob-lilypond is the only one that does this, and it does this to allow toggling between two modes (basic and arrange) and setting the header args relative to the mode used. But there's a cost to resetting org-babel-default-header-args:lilypond which is it prevents users from making modifications to it. I'm not sure how to deal with this. Maybe others can chime in. -- Jonathan
Re: ob-lilypond.el doesn't generate midi files
Hi Ihor, On 01 Nov 2022, Ihor Radchenko wrote: Jonathan Gregory writes: Yep, that's it. Modified ob-lilypond.el and recompiled it. Timidity works as helper, couldn't get vlc to work. Maybe the file ending should be modifiable via org-babel-lilypond-commands as well, or make ob-lilypond.el look for *.mid or *.midi. I'm pretty confident *.mid is the default setting for lilypond on win, and not my doing. I attached a patch to use a different suffix on Windows. Thanks for your help. Can someone with Windows check if this issue with lilypond using different extension is still present? If so, we can merge the patch. This is done. The patch was merged in e4c0281d2. -- Jonathan
Re: [HELP] Translate/extend `org-clock-clocktable-language-setup' for Spanish/Dutch/more languages
Hi On 27 Nov 2022, Ihor Radchenko wrote: Contributions for other languages are also welcome. For Portuguese, I'd use the following: ("pt" "Arquivo" "N" "Data e hora" "Título" "Hora" "TODOS" "Hora total" "Hora do arquivo" "Resumo das horas em") -- Jonathan
Re: [HELP] Translate/extend `org-clock-clocktable-language-setup' for Spanish/Dutch/more languages
On 04 Dec 2022, Ihor Radchenko wrote: Jonathan Gregory writes: Contributions for other languages are also welcome. For Portuguese, I'd use the following: ("pt" "Arquivo" "N" "Data e hora" "Título" "Hora" "TODOS" "Hora total" "Hora do arquivo" "Resumo das horas em") Thanks! Would you mind making a patch? (I am asking because I can see that you did it in the past) Sure, patch attached. BTW there are some small differences between pt and pt-BR (Brazilian Portuguese). I speak the latter, so that's what I used. -- Jonathan >From b9844c021366a5470f05f6638cd0b7d61b683434 Mon Sep 17 00:00:00 2001 From: Jonathan Gregory Date: Sun, 4 Dec 2022 14:41:31 -0300 Subject: [PATCH] org-clock-clocktable-language-setup: Add Portuguese translation * lisp/org-clock.el (org-clock-clocktable-language-setup): Do it. TINYCHANGE --- lisp/org-clock.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 871687687..169b380f5 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -350,8 +350,8 @@ For more information, see `org-clocktable-write-default'." ("es" "Archivo" "N" "Fecha y hora" "Tarea" "Tiempo" "TODO" "Tiempo total" "Tiempo archivo" "Clock summary at") ("fr" "Fichier" "N" "Horodatage" "En-tête" "Durée" "TOUT" "Durée totale" "Durée fichier" "Horodatage sommaire à") ("nl" "Bestand" "N" "Tijdstip" "Rubriek" "Duur" "ALLES" "Totale duur" "Bestandstijd" "Klok overzicht op") -("de" "Datei""E" "Zeitstempel" "Kopfzeile" "Dauer" "GESAMT" - "Gesamtdauer" "Dateizeit" "Erstellt am")) +("de" "Datei""E" "Zeitstempel" "Kopfzeile" "Dauer" "GESAMT" "Gesamtdauer" "Dateizeit" "Erstellt am") +("pt-BR" "Arquivo" "N" "Data e hora" "Título" "Hora" "TODOS" "Hora total" "Hora do arquivo" "Resumo das horas em")) "Terms used in clocktable, translated to different languages." :group 'org-clocktable :version "24.1" -- 2.25.1
Re: [RFC] If you use Org 9.6, please share the output of M-x org-element-cache-hash-show-statistics
Hi, On 09 Feb 2023, Ihor Radchenko wrote: Hi, I would like to assess the efficiency of one of search optimizations used in org-element.el [1] The statistics about efficiency is collected by Org, but obviously not shared without your consent. If you are ok with sharing the statistics, and you are running Emacs session for at least few hours (using Org mode, obviously), please reply sharing the output of M-x org-element-cache-hash-show-statistics 18.64% of cache searches hashed, 7.90% non-hashable. M-x emacs-uptime 8 days, 9 hours, 14 minutes, 34 seconds [1] Pugh [Information Processing Letters] (1990) Slow optimally balanced search strategies vs. cached fast uniformly balanced search strategies. http://dx.doi.org/10.1016/0020-0190(90)90130-P -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
Hi Ihor On 12 Jul 2023, Ihor Radchenko wrote: [...] I have recently seen https://masto.ai/@rfc1149/110674961710491363 that revealed a problem with example from https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html#org29a742f Instead of lilypond fragments, full pages are inserted when exporting to pdf. Upon further investigation, it looks like something changed in how Lilypond defines page layout. Can you check if adding: \version "2.24.1" #(ly:set-option 'use-paper-size-for-page #f) #(ly:set-option 'tall-page-formats 'pdf) to the version-and-paper block fixes the issue. Also, I believe tagline = "" is now the only variable needed. -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
Hi On 13 Jul 2023, Ihor Radchenko wrote: Jonathan Gregory writes: Can you check if adding: \version "2.24.1" #(ly:set-option 'use-paper-size-for-page #f) #(ly:set-option 'tall-page-formats 'pdf) to the version-and-paper block fixes the issue. Yes, except that I have lilypond 2.24.0, which failed until I changed the version to fit my lilypond version. Do you happen to know the minimal required version needed for your change to work? And do we need that \version line at all? I'd keep the version in sync with the stable release, but I guess that's up to the maintainer. The documentation says that "Every LilyPond file should contain a version statement": The version statement is important for at least two reasons. First, it allows automatic updating of the input file as LilyPond syntax changes. Second, it describes the version of LilyPond needed to compile the file. If the version statement is omitted from an input file, LilyPond prints a warning during the compilation of the file. -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
Hi On 13 Jul 2023, Ihor Radchenko wrote: Jonathan Gregory writes: Can you check if adding: \version "2.24.1" #(ly:set-option 'use-paper-size-for-page #f) #(ly:set-option 'tall-page-formats 'pdf) to the version-and-paper block fixes the issue. Yes, except that I have lilypond 2.24.0, which failed until I changed the version to fit my lilypond version. Do you happen to know the minimal required version needed for your change to work? And do we need that \version line at all? Also, I believe tagline = "" is now the only variable needed. Looks like this on my side as well. Given the feedback, I went ahead and changed the lilypond.org file: https://git.sr.ht/~bzg/worg/commit/6f69d212f41bc372426dc9b4df286638fe8f2a92 -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
Hi Ihor, On 14 Jul 2023, Ihor Radchenko wrote: Jonathan Gregory writes: Looks like this on my side as well. Given the feedback, I went ahead and changed the lilypond.org file: https://git.sr.ht/~bzg/worg/commit/6f69d212f41bc372426dc9b4df286638fe8f2a92 Thanks! It would be even nicer if we allowed https://packages.debian.org/buster/lilypond (2.19.81) or at least https://packages.ubuntu.com/focal/lilypond (2.20.0). I also checked what will happen with future versions, and it looks like \version "2.24.1" actually means >=. That's good to know. I know version 2.20.0 works without the update, so perhaps we could set those variables conditionally, WDYT? \version "2.20" #(if (ly:get-option 'use-paper-size-for-page) (begin (ly:set-option 'use-paper-size-for-page #f) (ly:set-option 'tall-page-formats 'pdf))) -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 18 Jul 2023, Ihor Radchenko wrote: Jonathan Gregory writes: I also checked what will happen with future versions, and it looks like \version "2.24.1" actually means >=. That's good to know. I know version 2.20.0 works without the update, so perhaps we could set those variables conditionally, WDYT? \version "2.20" #(if (ly:get-option 'use-paper-size-for-page) (begin (ly:set-option 'use-paper-size-for-page #f) (ly:set-option 'tall-page-formats 'pdf))) I do not mind. But remember that we are talking just about an example file. What you are suggesting appears to be closer to what we might do in ob-lilypond itself, when calculating default layout. That would be even better, I agree. Can you test my patch? Command-line options are normally added to `org-babel-lilypond-ly-command`, but since we're trying to set variables conditionally to accommodate different versions, I don't see how we can do this without using scheme. WDYT? Side note: ob-lilypond even has `org-babel-lilypond-toggle-midi-play' that plays sound corresponding to the lilypond source. Pretty cool, especially in the context of the discussion about non-textual output types in babel. https://list.orgmode.org/orgmode/87ttu95xst.fsf@localhost/ Sure, I'll think about adding a MIDI example as well. -- Jonathan diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el index 9693b89e2..3cbdd2b27 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -183,6 +183,12 @@ specific arguments to =org-babel-tangle=." (in-file (org-babel-temp-file "lilypond-"))) (with-temp-file in-file + ;; To create music fragments suitable for mixing music and text, + ;; newer versions of lilypond require setting at least the + ;; following two variables introduced in version 2.22. + (insert "#(if (ly:get-option 'use-paper-size-for-page) +(begin (ly:set-option 'use-paper-size-for-page #f) +(ly:set-option 'tall-page-formats 'pdf)))\n") (insert (org-babel-expand-body:generic body params))) (org-babel-eval (concat @@ -199,7 +205,9 @@ specific arguments to =org-babel-tangle=." (file-name-sans-extension out-file) " " cmdline - in-file) "")) nil) + in-file) + "")) + nil) (defun org-babel-prep-session:lilypond (_session _params) "Return an error because LilyPond exporter does not support sessions."
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 20 Jul 2023, Ihor Radchenko wrote: With your patch, I cannot produce png output. The file is just not created: [...] You're right. Thanks for the feedback. I've made some changes and was able to produce the correct results using pdf, eps, and png (tested with 2.20.0 and 2.24.1). I think this gets us closer to the old behaviour, assuming there are no other issues, of course. -- Jonathan diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el index 9693b89e2..8533cd8c7 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -178,28 +178,39 @@ specific arguments to =org-babel-tangle=." (defun org-babel-lilypond-process-basic (body params) "Execute a lilypond block in basic mode." (let* ((out-file (cdr (assq :file params))) + (file-type (file-name-extension out-file)) (cmdline (or (cdr (assq :cmdline params)) "")) (in-file (org-babel-temp-file "lilypond-"))) (with-temp-file in-file - (insert (org-babel-expand-body:generic body params))) + ;; To create music fragments suitable for mixing music and text, + ;; newer versions of lilypond require setting at least the + ;; following two variables introduced in version 2.22. See: + ;; https://lilypond.org/doc/v2.24/Documentation/usage/other-programs + (insert + (format "#(if (ly:get-option 'use-paper-size-for-page) + (begin (ly:set-option 'use-paper-size-for-page #f) +(ly:set-option 'tall-page-formats '%s)))\n" + file-type) + (org-babel-expand-body:generic body params))) (org-babel-eval (concat org-babel-lilypond-ly-command " -dbackend=eps " "-dno-gs-load-fonts " "-dinclude-eps-fonts " - (or (cdr (assoc (file-name-extension out-file) - '(("pdf" . "--pdf ") - ("ps" . "--ps ") - ("png" . "--png " + (or (assoc-default file-type + '(("pdf" . "--pdf ") + ("eps" . "--eps "))) "--png ") "--output=" (file-name-sans-extension out-file) " " cmdline - in-file) "")) nil) + in-file) + "")) + nil) (defun org-babel-prep-session:lilypond (_session _params) "Return an error because LilyPond exporter does not support sessions."
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 21 Jul 2023, Ihor Radchenko wrote: The png is still a full page on my side. That's not what I get. You're probably missing the paper settings: #+begin_src lilypond :exports none \version "2.20" \paper { indent=0\mm tagline="" line-width=170\mm oddFooterMarkup=##f oddHeaderMarkup=##f bookTitleMarkup=##f scoreTitleMarkup=##f } #+end_src Also, I am getting Processing `/tmp/babel-xQweBZ/lilypond-WGdEvi' Parsing... /tmp/babel-xQweBZ/lilypond-WGdEvi:1: warning: no \version statement found, please add \version "2.24.0" for future compatibility Interpreting music...[8] Preprocessing graphical objects... Finding the ideal number of pages... Fitting music on 1 page... Drawing systems... Layout output to `ionian2.eps'... Converting to PNG... Success: compilation successfully completed [ Babel evaluation exited with code 0 ] which does not look necessary. What is not necessary? The warning is expected. Other than that everything looks fine. -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
Hi Henrik, On 25 Jul 2023, Henrik Frisk wrote: Den tis 25 juli 2023 kl 18:16 skrev Henrik Frisk : My bad, putting :file ionian.cropped.png only results in ionian.cropped.cropped.png (as expected). Unclear why it worked the first couple of times. /Henrik No need to crop the output. If you need png, you should use: #(ly:set-option 'tall-page-formats 'png) -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 22 Jul 2023, Ihor Radchenko wrote: I guess I do not fully understand what your patch is trying to achieve. I thought that the patch would make it not necessary to write some extra boilerplate code, like \version or specifying the page size. The purpose of the patch was to fix the problem described in https://masto.ai/@rfc1149/110674961710491363. I wasn't trying to introduce anything new. Anyway, I can add version and paper settings as well, but those are user settings and I'm not sure that hard-coding them is a good idea. What I don't like is having to repeat <> everywhere. Is there a way of telling org-mode to insert a noweb reference from the header? Something like: #+PROPERTY: header-args:lilypond :prepend <> -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 26 Jul 2023, Ihor Radchenko wrote: Ok. That fix has been already installed. https://git.sr.ht/~bzg/worg/commit/6f69d212f41bc372426dc9b4df286638fe8f2a92 To the extent of the lilypond.org file, yes, but only if the output is a PDF. My suggestion is to revert that commit and incorporate the changes into ob-lilypond. The other patch for ob-lilypond itself does not appear to be necessary. I though that you are trying to extend ob-lilypond in that patch. If not, I still do not understand its purpose. I assume that it should be ignored. No, the ob-lilypond patch is needed. It allows users to generate music fragments (as opposed to a full page) in basic mode using pdf, eps, and png. Anyway, I can add version and paper settings as well, but those are user settings and I'm not sure that hard-coding them is a good idea. What I don't like is having to repeat <> everywhere. Is there a way of telling org-mode to insert a noweb reference from the header? Something like: #+PROPERTY: header-args:lilypond :prepend <> There is :prologue standard header argument. However, it is currently not supported by ob-lilypond. (which is a bug) Can you show me how that's done in elisp? I would expect the last block to output "foobar". #+begin_src elisp :noweb-ref test (setq x "foo" y "bar") #+end_src #+begin_src elisp :prologue <> :noweb yes (concat x y) #+end_src -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 27 Jul 2023, Ihor Radchenko wrote: Jonathan Gregory writes: Ok. That fix has been already installed. https://git.sr.ht/~bzg/worg/commit/6f69d212f41bc372426dc9b4df286638fe8f2a92 To the extent of the lilypond.org file, yes, but only if the output is a PDF. My suggestion is to revert that commit and incorporate the changes into ob-lilypond. Then, may you elaborate what purpose the changes are going to serve? Automatic page sizing? Automatic page settings? Bug fix. The purpose of the patch was to fix the problem described in https://masto.ai/@rfc1149/110674961710491363. I wasn't trying to introduce anything new. If we want to add boilerplate code to ob-lilypond, it does sound like introducing something new. Again, I feel confused. Please, explain in more details what you want to archive in terms of functionality. No, the patch is a bug fix. There are no changes for the user. Prior to the bug, we were able generate a "cropped" image when running: #+begin_src lilypond :file myfile.pdf \version "2.20" \paper { tagline="" } { c' e' g' e' } #+end_src This is no longer the case, hence the patch. No, the ob-lilypond patch is needed. It allows users to generate music fragments (as opposed to a full page) in basic mode using pdf, eps, and png. May your please explain what is "basic mode". Basic mode is explained in https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html. In summary: With basic-mode you can embed LilyPond snippets into an Org-mode file, compile and export them using typical Org-mode commands (such as C-c C-e l p for PDF export). This is useful if you want to mix blocks of LilyPond-generated score with text, and perhaps other images to export to LaTeX, Docbook, PDF, or HTML. And what about users who do want a full page? In that case the user would use "arrange mode", which is also explained in the ob-doc-lilypond.html page. Try running the source block example above with arrange-mode enabled using M-x org-babel-lilypond-toggle-arrange-mode. To quote from that page: With arrange-mode you can develop complete pieces of score whilst organizing sections of the piece using typical literate programming techniques. This allows you to assemble scores programatically by using tables to store information among other methods. Noweb and babel references are not allowed in header args. And ob-emacs-lisp also does not support :prologue. I see, so there's no built-in way to auto-insert a boilerplate without using the <<>> reference *inside* source blocks. Anyway, let's not worry about this for now. -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 28 Jul 2023, Ihor Radchenko wrote: I am slightly confused because there seems to be a need to define some page settings manually to get "embedded" images. In the examples in https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html#org2c29903, there is no mention that we need to define page geometry. Yet, the section is claiming that base mode "can embed LilyPond snippets into an Org-mode file". It is confusing, I agree, and I'm still learning as we move forward. I guess the question is should basic mode *always* generate cropped images? If the answer is yes, and it looks like it is, then maybe we should include paper settings in the ob-lilypond file. The basic-mode term is not very helpful. Perhaps [inline/cropped/embedded]-mode would have been more descriptive in terms of what it does. 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. Noweb and babel references are not allowed in header args. And ob-emacs-lisp also does not support :prologue. I see, so there's no built-in way to auto-insert a boilerplate without using the <<>> reference *inside* source blocks. Anyway, let's not worry about this for now. There is, but you will have to use direct Elisp to get :prologue string: #+name: test #+begin_src emacs-lisp (message "This is test") #+end_src #+begin_src emacs-lisp :prologue (org-sbe test) (+ 1 2) #+end_src 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) if we replace "lilypond" with "org" in the version-and-paper block. Prologue is useful also for those of us who keep their settings in a separate file: #+PROPERTY: header-args:lilypond :exports results :prologue "\\include \"settings.ly\"" Thanks! -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 29 Jul 2023, Ihor Radchenko wrote: Jonathan Gregory 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 <> 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
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 31 Jul 2023, Ihor Radchenko wrote: May it be possible to mix multiple \version commands? So that we declare \version for \paper and user can declare other \version for the code block body. Probably not. Wouldn't that confuse the compiler? In any case, the \version number is relative to the lilypond version for which the input file was written, so it's up to the user to provide that information. -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
Hi Ihor, On 08 Aug 2023, Ihor Radchenko wrote: Jonathan, do you think that your original patch is still what you want to get merged? Yes, the one I sent on 20 Jul 2023. I haven't had any issues with it so far. -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
Hi Ihor, On 11 Aug 2023, Ihor Radchenko wrote: Ok. Would you mind adding a commit message, as described in https://orgmode.org/worg/org-contribute.html#first-patch? Patch attached. I also attached a test file. And do I understand correctly that no changes in https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html are needed? Probably not, but I'll check. -- Jonathan commit 8916c9ebbefb1b1d448e0e39998f9b9a3b054680 Author: Jonathan Gregory Date: Wed Aug 16 09:47:09 2023 -0300 lisp/ob-lilypond.el: Prevent full page results in basic-mode * ob-lilypond.el (org-babel-lilypond-paper-settings): New variable. Link: https://list.orgmode.org/87a5w15jur.fsf@localhost/ TINYCHANGE diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el index 9693b89e2..ad8371c5f 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -175,31 +175,51 @@ specific arguments to =org-babel-tangle=." (if (org-babel-tangle nil "yes" "lilypond") (org-babel-lilypond-execute-tangled-ly) nil)) +;; https://lilypond.org/doc/v2.24/Documentation/usage/other-programs +(defvar org-babel-lilypond-paper-settings + "#(if (ly:get-option 'use-paper-size-for-page) +(begin (ly:set-option 'use-paper-size-for-page #f) + (ly:set-option 'tall-page-formats '%s))) +\\paper { + indent=0\\mm + tagline=\"\" + oddFooterMarkup=##f + oddHeaderMarkup=##f + bookTitleMarkup=##f + scoreTitleMarkup=##f +}\n" + "The paper settings required to generate music fragments. +They are needed for mixing music and text in basic-mode.") + (defun org-babel-lilypond-process-basic (body params) "Execute a lilypond block in basic mode." (let* ((out-file (cdr (assq :file params))) + (file-type (file-name-extension out-file)) (cmdline (or (cdr (assq :cmdline params)) "")) (in-file (org-babel-temp-file "lilypond-"))) (with-temp-file in-file - (insert (org-babel-expand-body:generic body params))) + (insert + (format org-babel-lilypond-paper-settings file-type) + (org-babel-expand-body:generic body params))) (org-babel-eval (concat org-babel-lilypond-ly-command " -dbackend=eps " "-dno-gs-load-fonts " "-dinclude-eps-fonts " - (or (cdr (assoc (file-name-extension out-file) - '(("pdf" . "--pdf ") - ("ps" . "--ps ") - ("png" . "--png " + (or (assoc-default file-type + '(("pdf" . "--pdf ") + ("eps" . "--eps "))) "--png ") "--output=" (file-name-sans-extension out-file) " " cmdline - in-file) "")) nil) + in-file) + "")) + nil) (defun org-babel-prep-session:lilypond (_session _params) "Return an error because LilyPond exporter does not support sessions." #+title: Test #+PROPERTY: header-args:lilypond :noweb yes :exports results #+PROPERTY: header-args:lilypond :prologue (org-babel-ref-resolve "settings[]") Some text. #+begin_src lilypond :file myfile.pdf \score { \new Staff \relative c' { \tempo 4 = 160 c4 e g b c4 b d c \tempo 4 = 96 d,4 fis a cis d4 cis e d } \layout { } \midi { } } #+end_src #+results: [[file:myfile.pdf]] Click [[file:myfile.midi][here]] to listen to the MIDI output. #+name: settings #+begin_src lilypond :exports none \version "2.24.1" % More lilypond settings here... #+end_src
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 11 Aug 2023, Ihor Radchenko wrote: And do I understand correctly that no changes in https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html are needed? ob-doc-lilypond.html looks good, but I changed lilypond.org in: https://git.sr.ht/~bzg/worg/commit/6b9da77c8078be183971575fdc79d402bf6184c2 -- Jonathan
Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)
On 20 Aug 2023, Ihor Radchenko wrote: Jonathan Gregory writes: ob-doc-lilypond.html looks good, but I changed lilypond.org in: https://git.sr.ht/~bzg/worg/commit/6b9da77c8078be183971575fdc79d402bf6184c2 - b c d e + b4 c d e Is there any specific reason for this change? This is to ensure that the notes use the correct duration in arrange-mode. 4 is the default duration and is carried over until a new value is added, in this case c1. 1 is then carried over making all subsequent "e"s have a value of 1, which is incorrect. #+begin_src lilypond { b c c c c1 } #+end_src #+begin_src lilypond { e e e e f1 } #+end_src In basic-mode it makes no difference, but that's assuming the default value never changes. BTW I prefer inline-mode over basic-mode, but I'll leave that for a future time. -- Jonathan
Re: Cant expand a heading with tab : Subtree (no children)
On 27 Apr 2024, Alexandros Prekates wrote: It happens daily , not initially , but after some hour(s) of using an org file to try to expand a heading ,that i know that it has subheadings , and it wont expand and see in the echo area the message : SUBTREE (NO CHILDREN). I see this too. The only way to access the subtree again is to kill the buffer and reopen the file. Org mode version 9.6.15 (release_9.6.15 @ /snap/emacs/current/usr/share/emacs/30.0.50/lisp/org/) -- Jonathan
Re: [PATCH] ob-lilypond: allow user configuration of header-args
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
Re: Get list of top-level headings
Hello Florian On 19 May 2021, Florian Lindner wrote: Hello, I, an Emacs Lisp newbie, want to get a list of all top-level headings of the current buffer. My approach so far is: (defun test-org-map() (interactive) (setq headings '()) (org-map-entries (lambda () (setq current-header-item (org-element-property : title (org-element-at-point)) (message "Header: %s" current-header-item) (message "Is String: %s" (stringp (org-element-property :title (org-element-at-point (setq headings (append current-header-item headings)) ) "LEVEL=1" ) (dolist (heading headings) (message "Header Item: %s" heading) ) ) This gives the otput: Header: AAA Is String: t Header: BBB Is String: t Header Item: 66 [3 times] Header Item: 65 [3 times] so basically the (org-element-property :title (org-element-at-point) does exactly what I want, but building the list does not what I want. I suppose that comes from a fundamental misunderstanding of how strings work in elisp. I would appreciate a short explanation (or pointers) why this does not work. And of course, I am very open to completely different, likely better, approches to that simply problem! Thanks, Florian The org-map-entries function calls FUNC at each headline, so you have to (1) find the headline/title and (2) add it to your list. One way to do this is with the push macro. --8<---cut here---start->8--- (defun test-org-map () (interactive) (let (headlines) (org-map-entries (lambda () (let* ((element (org-element-at-point)) (headline (org-element-property :title element))) (push headline headlines))) "LEVEL=1") (print (nreverse headlines --8<---cut here---end--->8--- Or by searching the buffer: --8<---cut here---start->8--- (defun test-org-map () (interactive) (let (headlines) (save-excursion (goto-char (point-max)) (while (re-search-backward org-complex-heading-regexp nil t) (let ((headline (match-string-no-properties 4))) (when (= (org-current-level) 1) (push headline headlines (print headlines --8<---cut here---end--->8--- BTW you're missing a closing parenthesis in: (setq current-header-item (org-element-property :title (org-element-at-point))) Maybe that's why you're getting errors. -- Jonathan
Re: Get list of top-level headings
Hi On 19 May 2021, John Kitchin wrote: I think this is all you need to get a list of titles of level 1 headings as strings (org-map-entries (lambda () (fifth (org-heading-components))) "LEVEL=1") this also works for me: #+BEGIN_SRC emacs-lisp (org-map-entries (lambda () (org-element-property :title (org-element-at-point)) ) "LEVEL=1") #+END_SRC This is a better approach indeed. No need to create a new list, although I get faster results using: (while (re-search-backward org-complex-heading-regexp nil t) -- Jonathan
Re: ob-lilypond.el doesn't generate midi files
Hi On 26 Aug 2021, Michael Maurer wrote: I've installed lilypond and customized ob-lilypond to use the appropriate helper programs, but although it generates & shows pdfs just fine, generating a midi file it does not. I execute tangle on the codeblock, and all I get is "No midi file generated so can't play!". org-version 9.4.6 emacs 27.2 Win 10 Can you also send a MWE of the code you're using to generate the score? -- Jonathan
Re: ob-lilypond.el doesn't generate midi files
Hi Michael On 28 Aug 2021, Michael Maurer wrote: So out of curiosity I changed the entry for midi-player to random gibberish, and the same message pops up, "no midi file generated so can't play". Toggling arrange-mode has no effect. I can play the generated midi-file from the command line using vlc just fine. What variable are you using to change the midi command? It should be org-babel-lilypond-commands. You may also have to restart emacs after you've made the changes. BTW I'm using timidity and it works fine. -- Jonathan
Re: ob-lilypond.el doesn't generate midi files
Hi On 29 Aug 2021, Michael Maurer wrote: Yep, that's it. Modified ob-lilypond.el and recompiled it. Timidity works as helper, couldn't get vlc to work. Maybe the file ending should be modifiable via org-babel-lilypond-commands as well, or make ob-lilypond.el look for *.mid or *.midi. I'm pretty confident *.mid is the default setting for lilypond on win, and not my doing. I attached a patch to use a different suffix on Windows. Thanks for your help. -- Jonathan >From 1929b8082b9cff2a4bd99c573b2a2bd50b76b184 Mon Sep 17 00:00:00 2001 From: Jonathan Gregory Date: Mon, 30 Aug 2021 13:49:48 -0300 Subject: [PATCH] Set the MIDI file extension conditionally * lisp/ob-lilypond.el (org-babel-lilypond-attempt-to-play-midi): By default, LilyPond outputs .mid files for Windows and .midi for everything else. See: <https://lists.gnu.org/r/emacs-orgmode/2021-08/msg00379.html> TINYCHANGE --- lisp/ob-lilypond.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el index eae1779ce..e197ea7a6 100644 --- a/lisp/ob-lilypond.el +++ b/lisp/ob-lilypond.el @@ -337,7 +337,9 @@ If TEST is non-nil, the shell command is returned and is not run." FILE-NAME is full path to lilypond file. If TEST is non-nil, the shell command is returned and is not run." (when org-babel-lilypond-play-midi-post-tangle -(let ((midi-file (org-babel-lilypond-switch-extension file-name ".midi"))) +(let* ((ext (if (eq system-type 'windows-nt) +".mid" ".midi")) + (midi-file (org-babel-lilypond-switch-extension file-name ext))) (if (file-exists-p midi-file) (let ((cmd-string (concat org-babel-lilypond-midi-command " " midi-file))) -- 2.25.1