Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / ly / init.ly
blob20416624c2f54c73ab03b9ef4246d42571f3d914
1 %% Toplevel initialisation file.
3 %% switch on debugging.
4 #(if (and #t (defined? 'set-debug-cell-accesses!))
5 (set-debug-cell-accesses! 5000))
7 \version "2.12.0"
9 \include "declarations-init.ly"
12 #(ly:set-option 'old-relative #f)
13 #(define toplevel-scores (list))
14 #(define toplevel-bookparts (list))
15 #(define $defaultheader #f)
16 #(define $current-book #f)
17 #(define $current-bookpart #f)
18 #(define version-seen #f)
19 #(define expect-error #f)
20 #(define output-empty-score-list #f)
21 #(define output-suffix #f)
22 #(define book-filename #f)
23 #(define book-output-suffix #f)
24 #(use-modules (scm clip-region))
25 \maininput
26 %% there is a problem at the end of the input file
29 %% Above and below comments compensate for the parser's look-ahead.
32 #(if (and (ly:get-option 'old-relative)
33 (defined? 'input-file-name)
34 (not (ly:get-option 'old-relative-used)))
35 (old-relative-not-used-message input-file-name))%% there is a problem at the end of the input file
37 #(if (and (not version-seen)
38 (defined? 'input-file-name))
39 (version-not-seen-message input-file-name))
41 #(ly:set-option 'protected-scheme-parsing #f)
43 #(let ((book-handler (if (defined? 'default-toplevel-book-handler)
44 default-toplevel-book-handler
45 toplevel-book-handler)))
46 (cond ((pair? toplevel-bookparts)
47 (let ((book (ly:make-book $defaultpaper $defaultheader)))
48 (map (lambda (part)
49 (ly:book-add-bookpart! book part))
50 (reverse! toplevel-bookparts))
51 (set! toplevel-bookparts (list))
52 ;; if scores have been defined after the last explicit \bookpart:
53 (if (pair? toplevel-scores)
54 (map (lambda (score)
55 (ly:book-add-score! book score))
56 (reverse! toplevel-scores)))
57 (set! toplevel-scores (list))
58 (book-handler parser book)))
59 ((or (pair? toplevel-scores) output-empty-score-list)
60 (let ((book (apply ly:make-book $defaultpaper
61 $defaultheader toplevel-scores)))
62 (set! toplevel-scores (list))
63 (book-handler parser book)))))
65 #(if (eq? expect-error (ly:parser-has-error? parser))
66 (ly:parser-clear-error parser)
67 (if expect-error
68 (ly:parser-error parser (_ "expected error, but none found"))))