[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add user-init option to include a custom init snippet (not replacin
From: |
reinhold . kainhofer |
Subject: |
Re: Add user-init option to include a custom init snippet (not replacing the whole init file) (issue1901042) |
Date: |
Wed, 28 Jul 2010 00:43:08 +0000 |
Reviewers: Neil Puttock,
http://codereview.appspot.com/1901042/diff/2001/3001
File ly/init.ly (right):
http://codereview.appspot.com/1901042/diff/2001/3001#newcode26
ly/init.ly:26: #(if (ly:get-option 'user-init)
On 2010/07/27 20:16:58, Neil Puttock wrote:
user-include ?
Hmm, actually, I don't like either user-init (indicates it's part of the
init sequence and has similar uses as the --init command line option;
also it sounds too technical) nor user-include (to me that sounds like
setting an include path)...
How about custom-definitions or user-definitions (no, sounds too much
like it defines users)?
http://codereview.appspot.com/1901042/diff/2001/3001#newcode27
ly/init.ly:27: (begin
On 2010/07/27 20:16:58, Neil Puttock wrote:
remove
Oops, right. I had a debug statement there, too, which I removed in the
second revision, so the begin is not necessary any more
Description:
Add user-init option to include a custom init snippet (not replacing the
whole init file)
This allows the user to apply the same set of options/definitions to
different files. In particular,
lilypond -duser-include=myinclude.ily file.ly
will compile file.ly, but read and execut 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
user-include 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 copy all
of lilypond's init.ly), while -duser-include will only add some
definitions to the normal init sequence in init.ly (i.e. the file is
included using scheme in init.ly).
Please review this at http://codereview.appspot.com/1901042/show
Affected files:
M ly/init.ly
M scm/lily.scm
Index: ly/init.ly
diff --git a/ly/init.ly b/ly/init.ly
index
20416624c2f54c73ab03b9ef4246d42571f3d914..cda58c1ea243d600f24879dd7d706997a9983b39
100644
--- a/ly/init.ly
+++ b/ly/init.ly
@@ -22,6 +22,13 @@
#(define book-filename #f)
#(define book-output-suffix #f)
#(use-modules (scm clip-region))
+
+#(if (ly:get-option 'user-init)
+ (begin
+ (ly:parser-include-string parser
+ (format "\\include \"~a\"" (ly:get-option 'user-init)))
+))
+
\maininput
%% there is a problem at the end of the input file
Index: scm/lily.scm
diff --git a/scm/lily.scm b/scm/lily.scm
index
332f816b9030665775312557be792a822708eb11..247f7daab4b2a47fd95e6dc6afe071e708ff8b31
100644
--- a/scm/lily.scm
+++ b/scm/lily.scm
@@ -169,6 +169,8 @@ second. Dump results to `FILE.stacks' and
`FILE.graph'.")
(trace-scheme-coverage #f
"Record coverage of Scheme files in `FILE.cov'.")
+ (user-init #f
+"Global settings file, included before the score is processed.")
(verbose ,(ly:command-line-verbose?)
"Value of the --verbose flag (read-only).")
(warning-as-error #f
- Re: Add user-init option to include a custom init snippet (not replacing the whole init file) (issue1901042),
reinhold . kainhofer <=