Re: "include" music-function

2012-01-09 Thread Jan-Peter Voigt
tDef (define-music-function (parser location sym file)(symbol? string?) (if (not (defined? sym)) (ly:parser-include-string parser (format "\\include \"~A\"\n" file))) (make-music 'SequentialMusic 'void #t))) \includeIfNotDef #'defs "d

Re: "include" music-function

2012-01-07 Thread Jan-Peter Voigt
Ah, yes ... I will rewrite this, when I'm in my machine again Cheers, Jan-Peter Am 07.01.2012 um 09:42 schrieb David Kastrup : > Jan-Peter Voigt writes: > >> Am 06.01.2012 10:17, schrieb Jan-Peter Voigt: >>> Am 06.01.2012 09:35, schrieb Jan-Peter Voigt: Hello David, the \sour

Re: "include" music-function

2012-01-07 Thread David Kastrup
Jan-Peter Voigt writes: > Am 06.01.2012 10:17, schrieb Jan-Peter Voigt: >> Am 06.01.2012 09:35, schrieb Jan-Peter Voigt: >>> Hello David, >>> >>> the \sourcefilename hint is helpful! Thank you! >>> If I use this in my function and do a ly:parser-clone, the location >>> is up to date: >>> ... >>>

Re: "include" music-function

2012-01-07 Thread Jan-Peter Voigt
Hello Carl, Hello David, thanks for your replies! I will read through those threads next week. This might help me understand what is happening under the hood. The basic include is working as expected. But I think it would be a nice feature if one could search for files to include using scheme.

Re: "include" music-function

2012-01-06 Thread Carl Sorensen
On 1/6/12 7:28 AM, "David Kastrup" wrote: > >Now I don't want to repeat old mistakes, but I don't really have the >time for an extended investigation. So if somebody gives me all the >data in a manner that does not require all too much thinking on my side, >I might try putting that kind of funct

Re: "include" music-function

2012-01-06 Thread David Kastrup
Jan-Peter Voigt writes: > Here are the two functions I implemented ... still a bit clumsy, but > it works for now ... if you are interested *how* and *why* to use > them, don't hesitate to mail me! If anybody is game for digging up the old discussion: I don't think it makes sense to require a us

Re: "include" music-function

2012-01-06 Thread Jan-Peter Voigt
Am 06.01.2012 10:17, schrieb Jan-Peter Voigt: Am 06.01.2012 09:35, schrieb Jan-Peter Voigt: Hello David, the \sourcefilename hint is helpful! Thank you! If I use this in my function and do a ly:parser-clone, the location is up to date: ... Now I will look, if this is working also with ly:par

Re: "include" music-function

2012-01-06 Thread Jan-Peter Voigt
Am 06.01.2012 09:35, schrieb Jan-Peter Voigt: Hello David, the \sourcefilename hint is helpful! Thank you! If I use this in my function and do a ly:parser-clone, the location is up to date: ... Now I will look, if this is working also with ly:parser-include-string while resetting filename and

Re: "include" music-function

2012-01-06 Thread Jan-Peter Voigt
with the location name and only includes the file if they match. (This should not work, if you have set some output-suffix!) This is a usable solution to me. But I would like to have the correct location info available, while parsing the included file. Is it possible to create an arbitrary "in

Re: "include" music-function

2012-01-05 Thread David Kastrup
e, while parsing the included file. > Is it possible to create an arbitrary "include"-music-function? This > would make it possible, to (for example) include all files in a > directory or matching a specific pattern. You can start your string with \sourcefilename and \sourcefi

Re: "include" music-function

2012-01-05 Thread David Kastrup
Jan-Peter Voigt writes: > This does not work ... the var "music" is not known in the file > included with ly:parse-file. > There has been a function ly:parser-parse-file in 2.12 - and if my > memory doesn't trick me, there has been discussion on devel why and > how to remove it. > This might or m

Re: "include" music-function

2012-01-05 Thread Jan-Peter Voigt
Hello David, Am 05.01.2012 13:50, schrieb David Kastrup: Ah yes. ly:parse-file does not help either? yes it does, thanks ... but ... --snip-- #(define-public includeLoc (define-music-function (parser location file)(string?) (let ((outname (format "~A.ly" (ly:parser-output-name parser)

Re: "include" music-function

2012-01-05 Thread David Kastrup
Jan-Peter Voigt writes: > Hello David, >> Any reason you don't just do #{ \include #file #} here? >> > yes there is: > --snip-- > \version "2.15.21" > > #(define-public includeLocal (define-music-function (parser location > file)(string?) > (let ((outname (format "~A.ly" (ly:parser-output-nam

Re: "include" music-function

2012-01-05 Thread Jan-Peter Voigt
Hello David, Any reason you don't just do #{ \include #file #} here? yes there is: --snip-- \version "2.15.21" #(define-public includeLocal (define-music-function (parser location file)(string?) (let ((outname (format "~A.ly" (ly:parser-output-name parser))) (locname (car (ly:i

Re: "include" music-function

2012-01-05 Thread David Kastrup
uld like to have the correct > location info available, while parsing the included file. > Is it possible to create an arbitrary "include"-music-function? This > would make it possible, to (for example) include all files in a > director

"include" music-function

2012-01-05 Thread Jan-Peter Voigt
o me. But I would like to have the correct location info available, while parsing the included file. Is it possible to create an arbitrary "include"-music-function? This would make it possible, to (for example) include all files in a directory or matching