]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add include-settings cmd line option to include a custom settings
authorReinhold Kainhofer <reinhold@kainhofer.com>
Mon, 26 Jul 2010 12:09:18 +0000 (14:09 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 21 Aug 2010 22:13:01 +0000 (00:13 +0200)
This allows the user to apply the same set of options
to different files, or to apply different settings to
the same score without modifying the score itself.
In particular,
  lilypond -dinclude-settings=myinclude.ily file.ly
will compile file.ly, but read and execute myinclude.ily
before file.ly is processed. That way, e.g. global paper
changes can be easily done, and a file can be run several
times, each time with a different include-settings file
containing different settings.

This feature is similar to the --init=DATEI feature,
except that --init will replace the whole init sequence
(thus your init file will need to copy all of lilypond's
init.ly), while -dinclude-settings will only add some
definitions to the normal init sequence in init.ly (i.e.
the file is included in init.ly, so the normal init sequence
takes place).

Unfortunately, it is not possible to add lilypond variable
definitions for use in the score... This is probably due
to the way the init sequence works.

Documentation/changes.tely
ly/init.ly
scm/lily.scm

index 76ba8b56d1678b37db6048ab093314fa79bc14eb..7941e85c2762acbd7328ebca349e1a357c75572f 100644 (file)
@@ -66,6 +66,14 @@ which scares away people.
 
 @end ignore
 
+@item
+New option @code{-dinclude-settings=INCLUDEFILE.ly}, which causes lilypond
+to include the given file before the score is processed. This allows the
+user to change global settings without the need to change the score itself.
+That way, several different editions/version (e.g. different page sizes)
+can be generated from a file without having to modify the score for each 
+version.
+
 @item
 The autobeaming settings syntax has been changed.  beatLength,
 beatGrouping, beamSettings, and measureGrouping have all been eliminated.
index 20416624c2f54c73ab03b9ef4246d42571f3d914..fa1dbe5993eba6d25504d600865e1c5f91d85617 100644 (file)
 #(define book-filename #f)
 #(define book-output-suffix #f)
 #(use-modules (scm clip-region))
+
+#(if (ly:get-option 'include-settings)
+  (ly:parser-include-string parser
+    (format "\\include \"~a\"" (ly:get-option 'include-settings))))
+
 \maininput
 %% there is a problem at the end of the input file
 
index 515ff2e02c333ce28a510458a8b826cd3a28277d..4a00ab66e4e73730284336cd6eb74b8c6a2dd2a6 100644 (file)
@@ -104,6 +104,8 @@ a log file.")
 "Include book titles in preview images.")
     (include-eps-fonts #t
 "Include fonts in separate-system EPS files.")
+    (include-settings #f
+"Include file for global settings, included before the score is processed.")
     (job-count #f
 "Process in parallel, using the given number of
 jobs.")