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 fileline at the end, so that definitions in the included file get into the current parser.


... yes it does:

--snip--
#(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)))
          (locpos (cadr (ly:input-file-line-char-column location))))
(if (or (string=? outname locname)(string-suffix? outname locname))
             (begin
(ly:parser-include-string parser (format "\\sourcefilename \"~A\" \\sourcefileline 0\n" (ly:find-file file)))
               (ly:parser-include-string parser (ly:gulp-file file))
(ly:parser-include-string parser (format " \\sourcefilename \"~A\" \\sourcefileline ~A\n" locname locpos))))
         (make-music 'SequentialMusic 'void #t))))
--snip--

... but if I include a file in an included file, it will not parse. I will investigate that for more info.

Cheers,
Jan-Peter


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to