]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/devel/programming-work.itexi
lilypond-book robustness: ensure EOL at the end of @verbatim
[lilypond.git] / Documentation / devel / programming-work.itexi
1 @c -*- coding: us-ascii; mode: texinfo; -*-
2 @node Programming work
3 @chapter Programming work
4
5 @menu
6 * Overview of LilyPond architecture::
7 * LilyPond programming languages::
8 * Programming without compiling::
9 * Finding functions::
10 * Code style::
11 * Debugging LilyPond::
12 * Adding or modifying features::
13 @end menu
14
15 @node Overview of LilyPond architecture
16 @section Overview of LilyPond architecture
17
18 LilyPond processes the input file into graphical and musical output in a
19 number of stages.  This process, along with the types of routines that
20 accomplish the various stages of the process, is described in this section.  A
21 more complete description of the LilyPond architecture and internal program
22 execution is found in Erik Sandberg's
23 @uref{http://lilypond.org/web/images/thesis-erik-sandberg.pdf, master's
24 thesis}.
25
26
27 The first stage of LilyPond processing is @emph{parsing}.  In the parsing
28 process, music expressions in LilyPond input format are converted to music
29 expressions in Scheme format.  In Scheme format, a music expression is a list
30 in tree form, with nodes that indicate the relationships between various music
31 events.  The LilyPond parser is written in Bison.
32
33 The second stage of LilyPond processing is @emph{iterating}.  Iterating
34 assigns each music event to a context, which is the environment in which the
35 music will be finally engraved.  The context is responsible for all further
36 processing of the music.  It is during the iteration stage that contexts are
37 created as necessary to ensure that every note has a Voice type context (e.g.
38 Voice, TabVoice, DrumVoice, CueVoice, MensuralVoice, VaticanaVoice,
39 GregorianTranscriptionVoice), that the Voice type contexts exist in
40 appropriate Staff type contexts, and that parallel Staff type contexts exist
41 in StaffGroup type contexts.  In addition, during the iteration stage each
42 music event is assigned a moment, or a time in the music when the event
43 begins.
44
45 Each type of music event has an associated iterator.  Iterators are defined in
46 *-iterator.cc. During iteration, an
47 event's iterator is called to deliver that music event to the appropriate
48 context(s).
49
50 The final stage of LilyPond processing is @emph{translation}.  During
51 translation, music events are prepared for graphical or midi output.  The
52 translation step is accomplished by translators or engravers (the distinction
53 is unclear).
54
55 Translators are defined in C++ files named *-engraver.cc.  In *-engraver.cc, a
56 C++ class of Engraver type is created.  The Engraver is also declared as a
57 translator.  Much of the work of translating is handled by Scheme functions,
58 which is one of the keys to LilyPond's exceptional flexibility.
59
60
61 @node LilyPond programming languages
62 @section LilyPond programming languages
63
64 Programming in LilyPond is done in a variety of programming languages.  Each
65 language is used for a specific purpose or purposes.  This section describes
66 the languages used and provides links to reference manuals and tutorials for
67 the relevant language.
68
69 @subsection C++
70
71 The core functionality of LilyPond is implemented in C++.
72
73 C++ is so ubiquitous that it is difficult to identify either a reference
74 manual or a tutorial.  Programmers unfamiliar with C++ will need to spend some
75 time to learn the language before attempting to modify the C++ code.
76
77 The C++ code calls Scheme/GUILE through the GUILE interface, which is
78 documented in the
79 @uref{http://www.gnu.org/software/guile/manual/html_node/index.html, GUILE
80   Reference Manual}.
81
82 @subsection GNU Bison
83
84 The LilyPond parser is implemented in Bison, a GNU parser generator.  The
85 Bison homepage is found at @uref{http://www.gnu.org/software/bison/,
86 gnu.org}.  The manual (which includes both a reference and tutorial) is
87 @uref{http://www.gnu.org/software/bison/manual/index.html, available} in a
88 variety of formats.
89
90 @subsection GNU Make
91
92 GNU Make is used to control the compiling process and to build the
93 documentation and the website.  GNU Make documentation is available at
94 @uref{http://www.gnu.org/software/make/manual/, the GNU website}.
95
96 @subsection GUILE or Scheme
97
98 GUILE is the dialect of Scheme that is used as LilyPond's extension language.  Many extensions to LilyPond are written entirely in GUILE.  The
99 @uref{http://www.gnu.org/software/guile/manual/html_node/index.html,
100 GUILE Reference Manual} is available online.
101
102 @uref{http://mitpress.mit.edu/sicp/full-text/book/book.html, Structure and
103 Interpretation of Computer Programs}, a popular textbook used to teach
104 programming in Scheme is available in its entirety online.
105
106 An introduction to Guile/Scheme as used in LilyPond can be found in the
107 Learning Manual, see @rlearning{Scheme tutorial}.
108
109 @subsection MetaFont
110
111 MetaFont is used to create the music fonts used by LilyPond.  A MetaFont
112 tutorial is available at @uref{http://metafont.tutorial.free.fr/, the
113 METAFONT tutorial page}.
114
115 @subsection PostScript
116
117 PostScript is used to generate graphical output.  A brief PostScript tutorial
118 is @uref{http://local.wasp.uwa.edu.au/~pbourke/dataformats/postscript/,
119 available online}.  The
120 @uref{http://www.adobe.com/devnet/postscript/pdfs/PLRM.pdf, PostScript Lanugage
121 Reference} is available online in PDF format.
122
123 @subsection Python
124
125 Python is used for XML2ly and is used for buillding the documentation and the
126 website.
127
128 Python documentation is available at @uref{http://www.python.org/doc/,
129 python.org}.
130
131 @node Programming without compiling
132 @section Programming without compiling
133
134 Much of the development work in LilyPond takes place by changing *.ly or
135 *.scm files.  These changes can be made without compiling LilyPond.  Such
136 changes are described in this section.
137
138
139 @subsection Modifying distribution files
140
141 Much of LilyPond is written in Scheme or LilyPond input files.  These
142 files are interpreted when the program is run, rather than being compiled
143 when the program is built, and are present in all LilyPond distributions.
144 You will find .ly files in the ly/ directory and the Scheme files in the
145 scm/ directory.  Both Scheme files and .ly files can be modified and
146 saved with any text editor.  It's probably wise to make a backup copy of
147 your files before you modify them, although you can reinstall if the
148 files become corrupted.
149
150 Once you've modified the files, you can test the changes just by running
151 LilyPond on some input file.  It's a good idea to create a file that
152 demonstrates the feature you're trying to add.  This file will eventually
153 become a regression test and will be part of the LilyPond distribution.
154
155 @subsection Desired file formatting
156
157 Files that are part of the LilyPond distribution have Unix-style line
158 endings (LF), rather than DOS (CR+LF) or MacOS 9 and earlier (CR).  Make
159 sure you use the necessary tools to ensure that Unix-style line endings are
160 preserved in the patches you create.
161
162 Tab characters should not be included in files for distribution.  All
163 indentation should be done with spaces.  Most editors have settings to
164 allow the setting of tab stops and ensuring that no tab characters are
165 included in the file.
166
167 Scheme files and LilyPond files should be written according to standard
168 style guidelines.  Scheme file guidelines can be found at
169 @uref{http://community.schemewiki.org/?scheme-style}.  Following these
170 guidelines will make your code easier to read.  Both you and others that
171 work on your code will be glad you followed these guidelines.
172
173 For LilyPond files, you should follow the guidelines for LilyPond snippets
174 in the documentation.  You can find these guidelines at
175 @ref{Texinfo introduction and usage policy}.
176
177 @node Finding functions
178 @section Finding functions
179
180 When making changes or fixing bugs in LilyPond, one of the initial
181 challenges is finding out where in the code tree the functions to
182 be modified live.  With nearly 3000 files in the source tree,
183 trial-and-error searching is generally ineffective. This section
184 describes a process for finding interesting code.
185
186 @subsection Using the ROADMAP
187
188 The file ROADMAP is located in the main directory of the lilypond source.
189 ROADMAP lists all of the directories in the LilPond source tree, along
190 with a brief description of the kind of files found in each directory.
191 This can be a very helpful tool for deciding which directories to search
192 when looking for a function.
193
194
195 @subsection Using grep to search
196
197 Having identified a likely subdirectory to search, the grep utility can
198 be used to search for a function name.  The format of the grep command is
199
200 @example
201 grep -i functionName subdirectory/*
202 @end example
203
204 This command will search all the contents of the directory subdirectory/
205 and display every line in any of the files that contains
206 functionName.  The @code{-i} option makes @command{grep} ignore
207 case -- this can be very useful if you are not yet familiar with
208 our capitalization conventions.
209
210 The most likely directories to grep for function names are scm/ for
211 scheme files, ly/ for lilypond input (*.ly) files, and lily/ for C++
212 files.
213
214
215 @subsection Using git grep to search
216
217 If you have used git to obtain the source, you have access to a
218 powerful tool to search for functions.  The command:
219
220 @example
221 git grep functionName
222 @end example
223
224 will search through all of the files that are present in the git
225 repository looking for functionName.  It also presents the results
226 of the search using @code{less}, so the results are displayed one page
227 at a time.
228
229 @subsection Searching on the git repository at Savannah
230
231 You can also use the equivalent of git grep on the Savannah server.
232
233 @itemize
234
235 @item
236 Go to http://git.sv.gnu.org/gitweb/?p=lilypond.git
237
238 @item
239 In the pulldown box that says commit, select grep.
240
241 @item
242 Type functionName in the search box, and hit enter/return
243
244 @end itemize
245
246 This will initiate a search of the remote git repository.
247
248
249 @node Code style
250 @section Code style
251 @c email to wl@gnu.org when I get here.
252
253 @menu
254 @end menu
255
256 @subsection Handling errors
257
258 As a general rule, you should always try to continue computations,
259 even if there is some kind of error.  When the program stops, it
260 is often very hard for a user to pinpoint what part of the input
261 causes an error.  Finding the culprit is much easier if there is
262 some viewable output.
263
264 So functions and methods do not return errorcodes, they never
265 crash, but report a programming_error and try to carry on.
266
267 @subsection Languages
268
269 C++ and Python are preferred.  Python code should use PEP 8.
270
271 @subsection Filenames
272
273 Definitions of classes that are only accessed via pointers (*) or
274 references (&) shall not be included as include files.
275
276 @verbatim
277    filenames
278
279         ".hh"   Include files
280              ".cc"      Implementation files
281              ".icc"     Inline definition files
282              ".tcc"     non inline Template defs
283
284    in emacs:
285
286              (setq auto-mode-alist
287                    (append '(("\\.make$" . makefile-mode)
288                         ("\\.cc$" . c++-mode)
289                         ("\\.icc$" . c++-mode)
290                         ("\\.tcc$" . c++-mode)
291                         ("\\.hh$" . c++-mode)
292                         ("\\.pod$" . text-mode)
293                         )
294                       auto-mode-alist))
295 @end verbatim
296
297 The class Class_name is coded in @q{class-name.*}
298
299 @subsection Indentation
300
301 Standard GNU coding style is used. In emacs:
302
303 @verbatim
304              (add-hook 'c++-mode-hook
305                   '(lambda() (c-set-style "gnu")
306                      ))
307 @end verbatim
308
309 If you like using font-lock, you can also add this to your
310 @q{.emacs}:
311
312 @verbatim
313              (setq font-lock-maximum-decoration t)
314              (setq c++-font-lock-keywords-3
315                    (append
316                     c++-font-lock-keywords-3
317                     '(("\\b\\(a-zA-Z_?+_\\)\\b" 1 font-lock-variable-name-face) ("\\b\\(A-Z?+a-z_?+\\)\\b" 1 font-lock-type-face))
318                     ))
319 @end verbatim
320
321
322 @subsection Classes and Types
323
324 @verbatim
325 This_is_a_class
326 @end verbatim
327
328
329 @subsection Members
330
331 Member variable names end with an underscore:
332
333 @verbatim
334 Type Class::member_
335 @end verbatim
336
337
338 @subsection Macros
339
340 Macro names should be written in uppercase completely.
341
342
343 @subsection Broken code
344
345 Do not write broken code.  This includes hardwired dependencies,
346 hardwired constants, slow algorithms and obvious limitations.  If
347 you can not avoid it, mark the place clearly, and add a comment
348 explaining shortcomings of the code.
349
350 We reject broken-in-advance on principle.
351
352 @subsection Naming
353
354
355 @subsection Messages
356
357 Messages need to follow Localization.
358
359
360 @subsection Localization
361
362 This document provides some guidelines for programmers write user
363 messages.  To help translations, user messages must follow
364 uniform conventions.  Follow these rules when coding for LilyPond.
365 Hopefully, this can be replaced by general GNU guidelines in the
366 future.  Even better would be to have an English (en_BR, en_AM)
367 guide helping programmers writing consistent messages for all GNU
368 programs.
369
370 Non-preferred messages are marked with `+'. By convention,
371 ungrammatical examples are marked with `*'.  However, such ungrammatical
372 examples may still be preferred.
373
374 @itemize
375
376 @item
377 Every message to the user should be localized (and thus be marked
378 for localization). This includes warning and error messages.
379
380 @item
381 Don't localize/gettextify:
382
383 @itemize
384 @item
385 `programming_error ()'s
386
387 @item
388 `programming_warning ()'s
389
390 @item
391 debug strings
392
393 @item
394 output strings (PostScript, TeX, etc.)
395
396 @end itemize
397
398 @item
399 Messages to be localised must be encapsulated in `_ (STRING)' or
400 `_f (FORMAT, ...)'. E.g.:
401
402 @example
403 warning (_ ("need music in a score"));
404 error (_f ("cannot open file: `%s'", file_name));
405 @end example
406
407 In some rare cases you may need to call `gettext ()' by hand. This
408 happens when you pre-define (a list of) string constants for later
409 use. In that case, you'll probably also need to mark these string
410 constants for translation, using `_i (STRING)'. The `_i' macro is
411 a no-op, it only serves as a marker for `xgettext'.
412
413 @example
414 char const* messages[] = @{
415   _i ("enable debugging output"),
416   _i ("ignore lilypond version"),
417   0
418 @};
419
420 void
421 foo (int i)
422 @{
423   puts (gettext (messages i));
424 @}
425 @end example
426
427 See also `flower/getopt-long.cc' and `lily/main.cc'.
428
429 @item
430 Do not use leading or trailing whitespace in messages. If you need
431 whitespace to be printed, prepend or append it to the translated
432 message
433
434 @example
435 message ("Calculating line breaks..." + " ");
436 @end example
437
438 @item
439 Error or warning messages displayed with a file name and line
440 number never start with a capital, eg,
441
442 @example
443 foo.ly: 12: not a duration: 3
444 @end example
445
446 Messages containing a final verb, or a gerund (`-ing'-form) always
447 start with a capital. Other (simpler) messages start with a
448 lowercase letter
449
450 @example
451 Processing foo.ly...
452 `foo': not declared.
453 Not declaring: `foo'.
454 @end example
455
456 @item
457 Avoid abbreviations or short forms, use `cannot' and `do not'
458 rather than `can't' or `don't'
459 To avoid having a number of different messages for the same
460 situation, well will use quoting like this `"message: `%s'"' for all
461 strings. Numbers are not quoted:
462
463 @example
464 _f ("cannot open file: `%s'", name_str)
465 _f ("cannot find character number: %d", i)
466 @end example
467
468 @item
469 Think about translation issues. In a lot of cases, it is better to
470 translate a whole message. The english grammar must not be imposed
471 on the translator. So, instead of
472
473 @example
474 stem at  + moment.str () +  does not fit in beam
475 @end example
476
477 have
478
479 @example
480 _f ("stem at %s does not fit in beam", moment.str ())
481 @end example
482
483 @item
484 Split up multi-sentence messages, whenever possible. Instead of
485
486 @example
487 warning (_f ("out of tune!  Can't find: `%s'", "Key_engraver"));
488 warning (_f ("cannot find font `%s', loading default", font_name));
489 @end example
490
491 rather say:
492
493 @example
494 warning (_ ("out of tune:"));
495 warning (_f ("cannot find: `%s', "Key_engraver"));
496 warning (_f ("cannot find font: `%s', font_name));
497 warning (_f ("Loading default font"));
498 @end example
499
500 @item
501 If you must have multiple-sentence messages, use full punctuation.
502 Use two spaces after end of sentence punctuation. No punctuation
503 (esp. period) is used at the end of simple messages.
504
505 @example
506 _f ("Non-matching braces in text `%s', adding braces", text)
507 _ ("Debug output disabled.  Compiled with NPRINT.")
508 _f ("Huh?  Not a Request: `%s'.  Ignoring.", request)
509 @end example
510
511 @item
512 Do not modularise too much; words frequently cannot be translated
513 without context. It is probably safe to treat most occurences of
514 words like stem, beam, crescendo as separately translatable words.
515
516 @item
517 When translating, it is preferable to put interesting information
518 at the end of the message, rather than embedded in the middle.
519 This especially applies to frequently used messages, even if this
520 would mean sacrificing a bit of eloquency. This holds for original
521 messages too, of course.
522
523 @example
524 en: cannot open: `foo.ly'
525 +   nl: kan `foo.ly' niet openen (1)
526 kan niet openen: `foo.ly'*   (2)
527 niet te openen: `foo.ly'*    (3)
528 @end example
529
530
531 The first nl message, although grammatically and stylistically
532 correct, is not friendly for parsing by humans (even if they speak
533 dutch). I guess we would prefer something like (2) or (3).
534
535 @item
536 Do not run make po/po-update with GNU gettext < 0.10.35
537
538 @end itemize
539
540
541
542 @node Debugging LilyPond
543 @section Debugging LilyPond
544
545 The most commonly used tool for debugging LilyPond is the GNU debugger
546 gdb.  Use of gdb is described in this section.
547
548 @subsection Debugging overview
549
550 Using a debugger simplifies troubleshooting in at least two ways.
551
552 First, breakpoints can be set to pause execution at any desired point.
553 Then, when execution has paused, debugger commands can be issued to
554 explore the values of various variables or to execute functions.
555
556 Second, the debugger allows the display of a stack trace, which shows
557 the sequence in which functions are called and the arguments to the
558 various function calls.
559
560
561 @subsection Compiling with debugging information
562
563 In order to use a debugger with LilyPond, it is necessary to compile
564 LilyPond with debugging information.  This is accomplished by running
565 the following commands in the main LilyPond source directory.
566
567 @example
568 ./configure  --disable-optimising
569
570 make
571 @end example
572
573 This will create a version of LilyPond that contains the debugging
574 information that will allow the debugger to tie the source code
575 to the compiled code.
576
577 You should not do @var{make install} if you want to use a debugger
578 with LilyPond.  @var{make install} will strip the debugging information
579 from the LilyPond binary.
580
581 To set breakpoints in Scheme functions, put
582
583 @example
584 \include "guile-debugger.ly"
585 @end example
586
587 in your input file after any scheme procedures you have defined in
588 that file.  When your input file is processed, a guile prompt
589 will be displayed.  At the guile prompt, you can set breakpoints with
590 the @code{break!} procedure:
591
592 @example
593 guile> (break! my-scheme-procedure)
594 @end example
595
596 Once you have set the desired breakpoints, you exit the guile repl frame
597 by typing:
598
599 @example
600 guile> (quit)
601 @end example
602
603 When one of the scheme routines for which you have set breakpoints is
604 entered, guile will interrupt execution in a debug frame.  At this point,
605 you will have access to guile debugging commands.  For a listing of these
606 commands, type:
607
608 @example
609 debug> help
610 @end example
611
612 @subsection Typical gdb usage
613
614 @subsection Typical .gdbinit files
615
616 The behavior of gdb can be readily customized through the use of
617 @var{.gdbinit} files.  A @var{.gdbinit} file is a file named
618 @var{.gdbinit} (notice the @qq{.} at the beginning of the file name)
619 that is placed in a user's home directory.
620
621 The @var{.gdbinit} file below is from Han-Wen.  It sets breakpoints
622 for all errors and defines functions for displaying scheme objects
623 (ps), grobs (pgrob), and parsed music expressions (pmusic).
624
625 @example
626 file lily/out/lilypond
627 b programming_error
628 b Grob::programming_error
629
630 define ps
631    print ly_display_scm($arg0)
632 end
633 define pgrob
634   print ly_display_scm($arg0->self_scm_)
635   print ly_display_scm($arg0->mutable_property_alist_)
636   print ly_display_scm($arg0->immutable_property_alist_)
637   print ly_display_scm($arg0->object_alist_)
638 end
639 define pmusic
640   print ly_display_scm($arg0->self_scm_)
641   print ly_display_scm($arg0->mutable_property_alist_)
642   print ly_display_scm($arg0->immutable_property_alist_)
643 end
644 @end example
645
646 @subsection Using Guile interactively with LilyPond
647
648 In order to experiment with Scheme programming in the LilyPond
649 environment, it is convenient to have a Guile interpreter that
650 has all the LilyPond modules loaded.  This requires the following
651 steps.
652
653 First, define a Scheme symbol for the active module
654 in the .ly file:
655
656 @example
657 #(module-define! (resolve-module '(guile-user))
658     'lilypond-module (current-module))
659 @end example
660
661 Second, place a Scheme function in the .ly file that gives an interactive Guile
662 prompt:
663
664 @example
665 #(top-repl)
666 @end example
667
668 When the .ly file is compiled, this causes the compilation to be interrupted
669 and an interactive guile prompt to appear.  When the guile prompt appears,
670 the LilyPond active module must be set as the current guile module:
671
672 @example
673 guile> (set-current-module lilypond-module)
674 @end example
675
676 Proper operation of these commands can be demonstrated by typing the name
677 of a LilyPond public scheme function to see if it's properly defined:
678
679 @example
680 guile> fret-diagram-verbose-markup
681 #<procedure fret-diagram-verbose-markup (layout props marking-list)>
682 @end example
683
684 If the LilyPond module has not been correctly loaded, an error
685 message will be generated:
686
687 @example
688 guile> fret-diagram-verbose-markup
689 ERROR: Unbound variable: fret-diagram-verbose-markup
690 ABORT: (unbound-variable)
691 @end example
692
693 Once the module is properly loaded, any valid LilyPond Scheme expression
694 can be entered at the interactive prompt.
695
696 After the investigation is complete, the interactive guile interpreter
697 can be exited:
698
699 @example
700 guile> (quit)
701 @end example
702
703 The compilation of the .ly file will then continue.
704
705 @node Adding or modifying features
706 @section Adding or modifying features
707
708 When a new feature is to be added to LilyPond, it is necessary to
709 ensure that the feature is properly integrated to maintain
710 its long-term support.  This section describes the steps necessary
711 for feature addition.
712
713 @subsection Write the code
714
715 You should create a new git branch for writing the code, as that
716 will separate it from the master branch and allow you to continue
717 to work on small projects related to master.
718
719 Please be sure to follow the rules for programming style discussed
720 earlier in this chapter.
721
722 @subsection Write regression tests
723
724 In order to demonstrate that the code works properly, you will
725 need to write one or more regression tests.  These tests are
726 typically .ly files that are found in input/regression.
727
728 Regression tests should be as brief as possible to demonstrate the
729 functionality of the code.
730
731 Regression tests should generally cover one issue per test.  Several
732 short, single-issue regression tests are preferred to a single, long,
733 multiple-issue regression test.
734
735 Use existing regression tests as templates to demonstrate the type of
736 header information that should be included in a regression test.
737
738 @subsection Write documentation
739
740 Although it is not required, it is helpful if the developer can
741 write relevant material for inclusion in the Notation Reference.
742 If the developer does not feel qualified to write the documentation,
743 a documentation editor will be able to write it from the regression
744 tests.
745
746 If the modification changes the input syntax so that inline snippets in
747 the documentation need to be changed, you will need to change the
748 snippets in both the english version of the documentation and any
749 translated versions.  If you do not change the snippets in all
750 translations, older versions of the snippet may be included
751 when the documentation is built.
752
753 If lsr snippets need to be changed, the snippet should be copied to
754 input/new and modified there.  The portions of the snippet that
755 are added by makelsr.py should be removed.  The changed snippet
756 will then be included in all versions of the documentation.
757
758 If non-snippet text is changed in the english documentation, no
759 corresponding changes should be made in the translated documentation.
760
761 @subsection Write convert-ly rule
762
763 If the modification changes the input syntax, a convert-ly rule
764 should be written to automatically update input files from older
765 versions.
766
767 convert-ly rules are found in python/convertrules.py
768
769 If possible, the convert-ly rule should allow automatic updating
770 of the file.  In some cases, this will not be possible, so the
771 rule will simply point out to the user that the feature needs
772 manual correction.
773
774 @subsection Write NEWS entry
775
776 An entry should be added to the NEWS file to describe the feature
777 changes to be implemented.  This is especially important for changes
778 that change input file syntax.
779
780 Hints for NEWS file entries are given at the top of the NEWS file.
781
782 New entries in NEWS go at the top of the file.
783
784 The NEWS entry should be written to show how the new change
785 improves LilyPond, if possible.
786
787 @subsection Verify regression test
788
789 In order to avoid breaking LilyPond, it is important to verify that
790 the regression tests all succeed.  This process is described in
791 @ref{Regression tests}.
792
793 @subsection Post patch for comments
794
795 For any change other than a minor change, a patch set should be
796 posted on Rietveld for comment.
797
798 The patch set is posted by issuing the following command, after
799 first committing all changes:
800
801 @example
802 git-cl upload <reference SHA1 ID>
803 @end example
804
805 @noindent
806 where <reference SHA1 ID> is the SHA1 ID of the commit to be used
807 as a reference source for the patch (generally, this will be the
808 SHA1 ID of origin/master).
809
810 After prompting for an email and a password, the patch set will be
811 posted to Rietveld.
812
813 An email should then be sent to lilypond-devel, with a subject line
814 starting with PATCH:, asking for comments on the patch.
815
816 As revisions are made in response to comments, successive patch sets
817 for the same issue can be uploaded by reissuing the git-cl command.
818
819 @subsection Push patch
820
821 Once all the comments have been addressed, the patch can be pushed.
822
823 If the author has push privileges, the author will push the patch.
824 Otherwise, a developer with push privileges will push the patch.
825
826 @subsection Closing the issues
827
828 Once the patch has been pushed, all the relevant issues should be
829 closed.
830
831 On Rietveld, the author should log in an close the issue either by
832 using the @q{Edit Issue} link, or by clicking the circled x icon
833 to the left of the issue name.
834
835 If the changes were in response to a feature request on the Google
836 issue tracker for LilyPond, the author should change the status to
837 @q{Fixed_x_y_z} where the patch was fixed in version x.y.z.  If
838 the author does not have privileges to change the status, an email
839 should be sent to bug-lilypond requesting the BugMeister to change
840 the status.