Re: try except in lilypond

2016-11-20 Thread Noeck
Hi Timothy, thanks again! That's my solution now: includeoptional = #(define-scheme-function (fname) (string?) (if (ly:find-file fname) (ly:parser-include-string (format "\\include \"~a\"" fname)) (display (format "File ~a could not be included" fname >From a quick test, this

Re: try except in lilypond

2016-11-20 Thread Urs Liska
Am 20. November 2016 16:44:07 MEZ, schrieb Noeck : >Hi > >Am 20.11.2016 um 01:00 schrieb Urs Liska: >> However, I'm not sure how you can determine if a font is installed on >> your system. > >That's exactly the point where I was thinking about try except. > That won't help

Re: try except in lilypond

2016-11-20 Thread Timothy Lanfear
Can I look for files in the included directories with scheme? Or can I get the includepath names to search there myself? _Function:_ *ly:find-file*/name/ Return the absolute file name of name, or |#f| if not found. -- Timothy Lanfear, Bristol, UK.

Re: try except in lilypond

2016-11-20 Thread Noeck
Hi Timothy, > (if (access? "somepath.ily" R_OK) >(ly:parser-include-string "\\include \"somepath.ily\"")) Thanks a lot! That works. One follow-up problem is, that the include path is found via the -I command line option. So somepath.ily does not exist (relative to where I execute

Re: try except in lilypond

2016-11-20 Thread Timothy Lanfear
On 20/11/16 15:44, Noeck wrote: Hi I tried this now as a top level scheme construct, #(if (file-exists? "somepath.ily") (#{ \include "somepath.ily" #})) But lilypond does not like it. Do I need a scheme function (even without arguments)? Is including inside scheme possible? I fear

Re: try except in lilypond

2016-11-20 Thread Noeck
Hi Am 20.11.2016 um 01:00 schrieb Urs Liska: > However, I'm not sure how you can determine if a font is installed on > your system. That's exactly the point where I was thinking about try except. I tried this now as a top level scheme construct, #(if (file-exists? "somepath.ily") (#{

Re: try except in lilypond

2016-11-19 Thread Urs Liska
Am 19.11.2016 um 23:50 schrieb Noeck: > Hi Mike, Andrew and David, > > thanks for your suggestions and help. My question was driven by the > intention to write a score in one file that can be shared and compiled > standalone and can optionally include my custom settings and fonts. > > This way,

Re: try except in lilypond

2016-11-19 Thread Noeck
Hi Mike, Andrew and David, thanks for your suggestions and help. My question was driven by the intention to write a score in one file that can be shared and compiled standalone and can optionally include my custom settings and fonts. This way, I could share it and it would probably look best

RE: try except in lilypond

2016-11-19 Thread Andrew Bernard
Hi David, -Original Message- From: David Kastrup [mailto:d...@gnu.org] Sent: Saturday, 19 November 2016 9:58 PM To: Andrew Bernard <andrew.bern...@gmail.com> Cc: lilypond-user Mailinglist <lilypond-user@gnu.org> Subject: Re: try except in lilypond Andrew Bernard

Re: try except in lilypond

2016-11-19 Thread David Kastrup
Andrew Bernard writes: > Joram, > > Exceptions are not built in to Scheme but you can implement them in a > library yourself with continuations if you are keen. Oh come on. This is the

Re: try except in lilypond

2016-11-19 Thread Andrew Bernard
Hi Mike and Joram, On 19 November 2016 at 21:06, Mike Solomon wrote: > One thing I've used in the past for this sort of thing are Scheme > functions, specifically file-exists? . > > https://www.gnu.org/software/mit-scheme/documentation/mit- >

RE: try except in lilypond

2016-11-19 Thread Mike Solomon
One thing I've used in the past for this sort of thing are Scheme functions, specifically file-exists? . https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/File-Manipulation.html Another solution is to use some sort of top-level compilation script in bash or python, which is