Hi Mark
The only rule I disagree with is
* Use `\clef treble' instead of `\clef "treble"', etc.
The quotes are required for G_8 so should be present
on all for consistency and to avoid confusion.
Also need to specify default indenting is 2 spaces.
Trevor
----- Original Message -----
From: "Mark Polesky" <markpole...@yahoo.com>
To: "lilypond-devel" <lilypond-devel@gnu.org>
Sent: Sunday, May 02, 2010 11:45 AM
Subject: [PATCH] Doc: LM: Reformat ly code.
So I guess I'm working towards a more formal standard for
LilyPond code formatting. I combed through the LM
attempting to improve the ly code that's already there. In
the process I gleaned what I think are some reasonable
standards (some of which are already in CG 4.3.4 -- see
below).
If anyone is up to it, I'd like someone to look over the
patch to see if I've made anything worse. I made very
slight changes to a few of the examples for convenience's
sake, but these should all be trivial. For example,
LM 4.1.4 Tweaking methods, first example.
was:
c d
\override NoteHead #'color = #red
e f g
\override NoteHead #'color = #green
a b c
changed it to:
c4 d
\override NoteHead #'color = #red
e4 f
\override NoteHead #'color = #green
g4 a b c
Anyway, the patch is at
http://codereview.appspot.com/1056041.
Thanks.
- Mark
* * * * * * * * * *
Doc: LM: Reformat ly code.
* Except for Scheme code, add exactly two spaces (never
tabs) for each additional level of indentation.
* Do not exceed one measure per line of code.
* Specify durations for the first note of every line.
* Specify durations after every `{' or `}'.
* Otherwise, specify durations only when they change.
* In \markup blocks, keep individual expressions on
their own lines.
* Keep these commands on their own lines
(and in this order):
\clef
\key
\time
\partial
* Use `\clef treble' instead of `\clef "treble"', etc.
* Use bar-checks (`|') only when barring is unclear.
* Do not put two `{'s on the same line unless the first
`{' closes with a `}' before the second `{'
* Put a newline after `{' (and indent) if its '}' is not
on the same line.
* Put a newline before `}' (and unindent) if its `{' is
not on the same line.
* Put a single space before and after `{' and `}' unless
it begins or ends a line.
* Put an empty line after the last \include.
* Surround with empty lines things like:
#(set-global-staff-size x)
#(ly:set-option x y)
* Put an empty line before and after multiline variable
definitions or multiline blocks that start in the
first column.
* For music function definitions:
- put `functionName =' alone on the first line.
- put `#(define-music-function' alone on the second.
- indent `(parser location ...)' with 5 spaces.
- indent `(type? ...)' with 5 spaces.
- indent `#{' and `#}' with 3 spaces.
- indent the contents of `#{ ... #}' with 5 spaces.
* For multiline variable definitions:
- if `=' is immediately followed by `{', put a newline
after `{'.
- otherwise put a newline after `='.
* Always use curly braces with \markup.
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel