"Fr. Samuel Springuel" <[email protected]> writes:
> Before I start writing a script to do this, is there an existing tool
> which will identify all the `\include` files that a LilyPond file
> depends on? Even better, one that will work in a recursive fashion?
You can use a file like
%% Toplevel initialisation file.
\version "2.19.22"
#(if (guile-v2)
(begin
(use-modules (ice-9 curried-definitions))
(setlocale LC_ALL "")
(setlocale LC_NUMERIC "C")))
#(session-initialize
(lambda ()
;; we can't use ly:parser-include-string here since that does not
;; actually do any parsing but merely switches inputs, so the
;; session saved by the session initializer after calling this
;; function has not actually started. A parser clone, in contrast,
;; can run and complete synchronously and shares the module with
;; the current parser.
(ly:parser-parse-string (ly:parser-clone)
"\\include \"declarations-init.ly\"")))
#(define (do-nothing . x) #f)
#(define toplevel-book-handler do-nothing)
#(define toplevel-bookpart-handler do-nothing)
#(define toplevel-music-handler do-nothing)
#(define toplevel-score-handler do-nothing)
#(define toplevel-text-handler do-nothing)
#(define book-bookpart-handler do-nothing)
#(define book-music-handler do-nothing)
#(define book-score-handler do-nothing)
#(define book-text-handler do-nothing)
#(define bookpart-score-handler do-nothing)
#(define bookpart-text-handler do-nothing)
#(define bookpart-music-handler do-nothing)
#(define output-def-music-handler do-nothing)
#(define context-mod-music-handler do-nothing)
#(note-names-language default-language)
#(define toplevel-scores (list))
#(define toplevel-bookparts (list))
#(define $defaultheader #f)
#(define $current-book #f)
#(define $current-bookpart #f)
#(define version-seen #f)
#(define expect-error #f)
#(define output-empty-score-list #f)
#(define output-suffix #f)
#(use-modules (scm clip-region))
#(use-modules (srfi srfi-1))
#(use-modules (ice-9 pretty-print))
\maininput
#(format #t "~{~a\n~^~}" (ly:source-files))
and call it with
lilypond --init parse-only.ly actual-file-name.ly 2> /dev/null
and it should be pretty fast. Of course the file list includes
parse-only.ly...
--
David Kastrup