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 because fontconfig wil

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 lilypond)

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, I

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 with

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 Cc: lilypond-user Mailinglist Subject: Re: try except in lilypond Andrew Bernard writes: > Joram, > > Exceptions are not built in to Scheme bu

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 Guile-2 manual but the overw

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- > scheme-ref/File-Manipulation.html > > Another solutio

RE: try except in lilypond

2016-11-19 Thread Mike Solomon
ch is how i manage style sheets for large scores (I generate temporary ly files on the fly). Happy hacking!~Mike Sent from my Samsung Galaxy smartphone. Original message From: Noeck Date: 11/19/16 11:50 AM (GMT+02:00) To: lilypond-user Subject: try except in lilypond Hi, is

try except in lilypond

2016-11-19 Thread Noeck
Hi, is there something like try ... except in lilypond. What I want to achieve is some failure tolerance in ly files. I want to load some fonts or include files and if they don't exist, it should just be skipped without stopping the compilation (perhaps a warning could be printed). Is