[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "include" music-function
From: |
David Kastrup |
Subject: |
Re: "include" music-function |
Date: |
Thu, 05 Jan 2012 17:14:15 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Jan-Peter Voigt <address@hidden> writes:
> #(define-public includeLocal (define-music-function (parser location
> file)(string?)
> (let ((outname (format "~A.ly" (ly:parser-output-name parser)))
> (locname (car (ly:input-file-line-char-column location))))
> (if (or (string=? outname locname)(string-suffix? outname
> locname))
> (let ((content (ly:gulp-file file)))
> (ly:parser-include-string parser content)))
> (make-music 'SequentialMusic 'void #t))))
>
> \includeLocal "test.ly"
> --snip--
> This function first compares the outname 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 "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 \sourcefileline.
ly:parser-parse-expression has optional arguments for that purpose. If
you would consider this helpful, I might try fudging this into
parser-include-string as well.
I have not followed the reasons why we would not have
parser-include-file.
--
David Kastrup
Re: "include" music-function,
David Kastrup <=
- Re: "include" music-function, Jan-Peter Voigt, 2012/01/06
- Re: "include" music-function, Jan-Peter Voigt, 2012/01/06
- Re: "include" music-function, Jan-Peter Voigt, 2012/01/06
- Re: "include" music-function, David Kastrup, 2012/01/06
- Re: "include" music-function, Carl Sorensen, 2012/01/06
- Re: "include" music-function, Jan-Peter Voigt, 2012/01/07
Re: "include" music-function, David Kastrup, 2012/01/07
Re: "include" music-function, Jan-Peter Voigt, 2012/01/07
Re: "include" music-function, Jan-Peter Voigt, 2012/01/09