]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/convert-ly.py
* scripts/convert-ly.py: In the conversion to version 1.9.0,
[lilypond.git] / scripts / convert-ly.py
index e78e5c71a7eed662ac8321761f3a4a94fe603790..4119d0f8f196b2471bcf46d0bfd4c5d94ce515b8 100644 (file)
@@ -4,17 +4,9 @@
 #
 # source file of the GNU LilyPond music typesetter
 #
-# (c) 1998--2004  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+# (c) 1998--2005  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 #                 Jan Nieuwenhuizen <janneke@gnu.org>
 
-
-# TODO
-#   use -f and -t for -s output
-
-# NEWS
-# 0.2
-#  - rewrite in python
-
 import os
 import sys
 import __main__
@@ -23,10 +15,24 @@ import  string
 import re
 import time
 
-program_name = sys.argv[0]
+localedir = '@localedir@'
+try:
+       import gettext
+       gettext.bindtextdomain ('lilypond', localedir)
+       gettext.textdomain ('lilypond')
+       _ = gettext.gettext
+except:
+       def _ (s):
+               return s
+underscore = _
 
+program_name = os.path.basename (sys.argv[0])
 version = '@TOPLEVEL_VERSION@'
 
+FROM_TO = _ ( "%s has been replaced by %s")
+NOT_SMART = _ ("Not smart enough to convert %s")
+UPDATE_MANUALLY        = _ ("Please refer to the manual for details, and update manually.")
+
 # Did we ever have \mudela-version?  I doubt it.
 # lilypond_version_re_str = '\\\\version *\"(.*)\"'
 lilypond_version_re_str = '\\\\(mudela-)?version *\"([^"]+)\"'
@@ -41,38 +47,44 @@ def identify ():
        sys.stderr.write (program_id () + '\n')
 
 def usage ():
-       sys.stdout.write (
-               r"""Usage: %s [OPTIONS]... [FILE]...
-Try to convert to newer lilypond-versions.  The version number of the
-input is guessed by default from \version directive.
-
-Options:
-  -h, --help             print this help
+       sys.stdout.write (_ ("Usage: %s [OPTION]... [FILE]..." \
+                            % program_name))
+       sys.stdout.write ('\n\n')
+       sys.stdout.write (_ ("""\
+Update LilyPond input to newer version.  By default, update from the
+version taken from the \\version command, to the current LilyPond version."""))
+       sys.stdout.write ('\n\n')
+       sys.stdout.write (_ ("Options:"))
+       sys.stdout.write ('\n')
+       sys.stdout.write (_ ("""\
   -e, --edit             edit in place
-  -f, --from=VERSION     start from version [default: \version found in file]
-  -s, --show-rules       print all rules
-  -t, --to=VERSION       end at version [default: @TOPLEVEL_VERSION@]
-  -n, --no-version       don't add new version stamp
-      --version          print program version
-
-Report bugs to bugs-gnu-music@gnu.org.
-
-""" % program_name)
-       
-       
+  -f, --from=VERSION     start from VERSION [default: \\version found in file]
+  -h, --help             print this help
+  -n, --no-version       do not add \\version command if missing
+  -s, --show-rules       print rules [default: --from=0, --to=@TOPLEVEL_VERSION@]
+  -t, --to=VERSION       convert to VERSION [default: @TOPLEVEL_VERSION@]
+  -v, --version          print program version"""))
+       sys.stdout.write ('\n\n')
+       sys.stdout.write (_ ('Examples'))
+       sys.stdout.write ('\n')
+       sys.stdout.write ('  convert-ly -e *ly')
+       sys.stdout.write ('\n')
+       sys.stdout.write ('  convert-ly --from=2.4.0 -e $(find . -name "*ly")')
+       sys.stdout.write ('\n\n')
+       sys.stdout.write (_ ("Report bugs to %s.") % "bug-lilypond@gnu.org")
+       sys.stdout.write ('\n')
        sys.exit (0)
 
 def print_version ():
-       
-       sys.stdout.write (r"""%s
-
-This is free software.  It is covered by the GNU General Public
-License, and you are welcome to change it and/or distribute copies of
-it under certain conditions.  invoke as `%s --warranty' for more
+       sys.stdout.write (program_id ())
+       sys.stdout.write ('\n')
+       sys.stdout.write (_ ("""\
+This program is free software.  It is covered by the GNU General Public
+License and you are welcome to change it and/or distribute copies of it
+under certain conditions.  Invoke as `%s --warranty' for more
 information.
+""") % "lilypond")
 
-""" % (program_id (), program_name))
-       
 def str_to_tuple (s):
        return tuple (map (string.atoi, string.split (s, '.')))
 
@@ -105,34 +117,40 @@ def show_rules (file):
                        file.write  ('%s: %s\n' % (tup_to_str (x[0]), x[2]))
 
 ############################
-               
+
 if 1:
        def conv(str):
                if re.search ('\\\\multi', str):
-                       sys.stderr.write ('\nNot smart enough to convert \\multi')
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "\\multi")
+                       sys.stderr.write ('\n')
                return str
-       
+
        conversions.append (((0,1,9), conv, '\\header { key = concat + with + operator }'))
 
-if 1:                                  # need new a namespace
+if 1:
        def conv (str):
                if re.search ('\\\\octave', str):
-                       sys.stderr.write ('\nNot smart enough to convert \\octave')
-               #       raise FatalConversionError()
-               
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "\\octave")
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (UPDATE_MANUALLY)
+                       sys.stderr.write ('\n')
+               #       raise FatalConversionError ()
+
                return str
 
        conversions.append ((
-               ((0,1,19), conv, 'deprecated \\octave; can\'t convert automatically')))
+               ((0,1,19), conv, 'deprecated \\octave; cannot convert automatically')))
 
 
-if 1:                                  # need new a namespace
+if 1:
        def conv (str):
                str = re.sub ('\\\\textstyle([^;]+);',
                                         '\\\\property Lyrics . textstyle = \\1', str)
                # harmful to current .lys
                # str = re.sub ('\\\\key([^;]+);', '\\\\accidentals \\1;', str)
-                       
+
                return str
 
        conversions.append ((
@@ -143,7 +161,7 @@ if 1:
        def conv (str):
                str = re.sub ('\\\\musical_pitch', '\\\\musicalpitch',str)
                str = re.sub ('\\\\meter', '\\\\time',str)
-                       
+
                return str
 
        conversions.append ((
@@ -163,7 +181,7 @@ if 1:
                str = re.sub ('\\\\accidentals', '\\\\keysignature',str)
                str = re.sub ('specialaccidentals *= *1', 'keyoctaviation = 0',str)
                str = re.sub ('specialaccidentals *= *0', 'keyoctaviation = 1',str)
-                       
+
                return str
 
        conversions.append ((
@@ -173,16 +191,18 @@ if 1:
 if 1:
        def conv(str):
                if re.search ('\\\\header', str):
-                       sys.stderr.write ('\nNot smart enough to convert to new \\header format')
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "new \\header format")
+                       sys.stderr.write ('\n')
                return str
-       
+
        conversions.append (((1,0,2), conv, '\\header { key = concat + with + operator }'))
 
 if 1:
        def conv(str):
                str =  re.sub ('\\\\melodic([^a-zA-Z])', '\\\\notes\\1',str)
                return str
-       
+
        conversions.append (((1,0,3), conv, '\\melodic -> \\notes'))
 
 if 1:
@@ -190,34 +210,36 @@ if 1:
                str =  re.sub ('default_paper *=', '',str)
                str =  re.sub ('default_midi *=', '',str)
                return str
-       
+
        conversions.append (((1,0,4), conv, 'default_{paper,midi}'))
 
 if 1:
        def conv(str):
                str =  re.sub ('ChoireStaff', 'ChoirStaff',str)
                str =  re.sub ('\\\\output', 'output = ',str)
-                       
+
                return str
-       
+
        conversions.append (((1,0,5), conv, 'ChoireStaff -> ChoirStaff'))
 
 if 1:
        def conv(str):
                if re.search ('[a-zA-Z]+ = *\\translator',str):
-                       sys.stderr.write ('\nNot smart enough to change \\translator syntax')
-               #       raise FatalConversionError()
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "\\translator syntax")
+                       sys.stderr.write ('\n')
+               #       raise FatalConversionError ()
                return str
-       
+
        conversions.append (((1,0,6), conv, 'foo = \\translator {\\type .. } ->\\translator {\\type ..; foo; }'))
 
 
 if 1:
        def conv(str):
                str =  re.sub ('\\\\lyrics*', '\\\\lyrics',str)
-                       
+
                return str
-       
+
        conversions.append (((1,0,7), conv, '\\lyric -> \\lyrics'))
 
 if 1:
@@ -230,7 +252,7 @@ if 1:
                str =  re.sub ('\\\\\\]', '}',str)
                str =  re.sub ('\\]([0-9/]+)', '] }', str)
                return str
-       
+
        conversions.append (((1,0,10), conv, '[2/3 ]1/1 -> \\times 2/3 '))
 
 if 1:
@@ -241,21 +263,21 @@ if 1:
 
 if 1:
        def conv(str):
-               
-               
+
+
                str =  re.sub ('<([^>~]+)~([^>]*)>','<\\1 \\2> ~', str)
-                       
+
                return str
-       
+
        conversions.append (((1,0,13), conv, '<a ~ b> c -> <a b> ~ c'))
 
 if 1:
        def conv(str):
                str =  re.sub ('<\\[','[<', str)
                str =  re.sub ('\\]>','>]', str)
-                       
+
                return str
-       
+
        conversions.append (((1,0,14), conv, '<[a b> <a b]>c -> [<a b> <a b>]'))
 
 
@@ -266,19 +288,21 @@ if 1:
                str =  re.sub ('\\\\type','\\\\context', str)
                str =  re.sub ('\\\\TYPE','\\\\type', str)
                str =  re.sub ('textstyle','textStyle', str)
-                       
+
                return str
-       
+
        conversions.append (((1,0,16), conv, '\\type -> \\context, textstyle -> textStyle'))
 
 
 if 1:
        def conv(str):
                if re.search ('\\\\repeat',str):
-                       sys.stderr.write ('\nNot smart enough to convert \\repeat')
-               #       raise FatalConversionError()
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "\\repeat")
+                       sys.stderr.write ('\n')
+               #       raise FatalConversionError ()
                return str
-       
+
        conversions.append (((1,0,18), conv,
                 '\\repeat NUM Music Alternative -> \\repeat FOLDSTR Music Alternative'))
 
@@ -286,8 +310,8 @@ if 1:
        def conv(str):
                str =  re.sub ('SkipBars','skipBars', str)
                str =  re.sub ('fontsize','fontSize', str)
-               str =  re.sub ('midi_instrument','midiInstrument', str)                 
-                       
+               str =  re.sub ('midi_instrument','midiInstrument', str)
+
                return str
 
        conversions.append (((1,0,19), conv,
@@ -298,8 +322,8 @@ if 1:
        def conv(str):
                str =  re.sub ('tieydirection','tieVerticalDirection', str)
                str =  re.sub ('slurydirection','slurVerticalDirection', str)
-               str =  re.sub ('ydirection','verticalDirection', str)                   
-                       
+               str =  re.sub ('ydirection','verticalDirection', str)
+
                return str
 
        conversions.append (((1,0,20), conv,
@@ -309,7 +333,7 @@ if 1:
 if 1:
        def conv(str):
                str =  re.sub ('hshift','horizontalNoteShift', str)
-                       
+
                return str
 
        conversions.append (((1,0,21), conv,
@@ -319,7 +343,7 @@ if 1:
 if 1:
        def conv(str):
                str =  re.sub ('\\\\grouping[^;]*;','', str)
-                       
+
                return str
 
        conversions.append (((1,1,52), conv,
@@ -329,7 +353,7 @@ if 1:
 if 1:
        def conv(str):
                str =  re.sub ('\\\\wheel','\\\\coda', str)
-                       
+
                return str
 
        conversions.append (((1,1,55), conv,
@@ -339,7 +363,7 @@ if 1:
        def conv(str):
                str =  re.sub ('keyoctaviation','keyOctaviation', str)
                str =  re.sub ('slurdash','slurDash', str)
-                       
+
                return str
 
        conversions.append (((1,1,65), conv,
@@ -348,7 +372,7 @@ if 1:
 if 1:
        def conv(str):
                str =  re.sub ('\\\\repeat *\"?semi\"?','\\\\repeat "volta"', str)
-                       
+
                return str
 
        conversions.append (((1,1,66), conv,
@@ -358,7 +382,7 @@ if 1:
 if 1:
        def conv(str):
                str =  re.sub ('\"?beamAuto\"? *= *\"?0?\"?','noAutoBeaming = "1"', str)
-                       
+
                return str
 
        conversions.append (((1,1,67), conv,
@@ -367,7 +391,7 @@ if 1:
 if 1:
        def conv(str):
                str =  re.sub ('automaticMelismas', 'automaticMelismata', str)
-                       
+
                return str
 
        conversions.append (((1,2,0), conv,
@@ -376,7 +400,7 @@ if 1:
 if 1:
        def conv(str):
                str =  re.sub ('dynamicDir\\b', 'dynamicDirection', str)
-                       
+
                return str
 
        conversions.append (((1,2,1), conv,
@@ -385,8 +409,8 @@ if 1:
 if 1:
        def conv(str):
                str =  re.sub ('\\\\cadenza *0 *;', '\\\\cadenzaOff', str)
-               str =  re.sub ('\\\\cadenza *1 *;', '\\\\cadenzaOn', str)               
-                       
+               str =  re.sub ('\\\\cadenza *1 *;', '\\\\cadenzaOn', str)
+
                return str
 
        conversions.append (((1,3,4), conv,
@@ -423,10 +447,12 @@ if 1:
 if 1:
        def conv(str):
                if re.search ('\\\\repetitions',str):
-                       sys.stderr.write ('\nNot smart enough to convert \\repetitions')
-               #       raise FatalConversionError()
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "\\repetitions")
+                       sys.stderr.write ('\n')
+               #       raise FatalConversionError ()
                return str
-       
+
        conversions.append (((1,3,23), conv,
                 '\\\\repetitions feature dropped'))
 
@@ -450,7 +476,9 @@ if 1:
                str = re.sub ("\\\\musicalpitch *{([0-9 -]+)}",
                              "\\\\musicalpitch #'(\\1)", str)
                if re.search ('\\\\notenames',str):
-                       sys.stderr.write ('\nNot smart enough to convert to new \\notenames format')
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "new \\notenames format")
+                       sys.stderr.write ('\n')
                return str
 
        conversions.append (((1,3,38), conv, '\musicalpitch { a b c } -> #\'(a b c)'))
@@ -459,16 +487,18 @@ if 1:
        def conv (str):
                def replace (match):
                        return '\\key %s;' % string.lower (match.group (1))
-               
+
                str = re.sub ("\\\\key ([^;]+);",  replace, str)
                return str
-       
+
        conversions.append (((1,3,39), conv, '\\key A ;  ->\\key a;'))
 
 if 1:
        def conv (str):
                if re.search ('\\[:',str):
-                       sys.stderr.write ('\nNot smart enough to convert to new tremolo format')
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "new tremolo format")
+                       sys.stderr.write ('\n')
                return str
 
        conversions.append (((1,3,41), conv,
@@ -493,7 +523,9 @@ if 1:
 if 1:
        def conv (str):
                if re.search ('\\\\keysignature', str):
-                       sys.stderr.write ('\nNot smart enough to convert to new tremolo format')
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "new tremolo format")
+                       sys.stderr.write ('\n')
                return str
 
 
@@ -534,7 +566,7 @@ if 1:
 
                str = re.sub ('Repeat_engraver' ,'Volta_engraver', str)
                return str
-       
+
        conversions.append (((1,3,92), conv, 'basicXXXProperties -> XXX, Repeat_engraver -> Volta_engraver'))
 
 if 1:
@@ -544,13 +576,13 @@ if 1:
                str = re.sub ('\\\\stemup', '\\\\stemUp', str)
                str = re.sub ('\\\\stemdown', '\\\\stemDown', str)
                str = re.sub ('\\\\stemboth', '\\\\stemBoth', str)
-               
+
                str = re.sub ('\\\\slurup', '\\\\slurUp', str)
                str = re.sub ('\\\\slurboth', '\\\\slurBoth', str)
                str = re.sub ('\\\\slurdown', '\\\\slurDown', str)
                str = re.sub ('\\\\slurdotted', '\\\\slurDotted', str)
-               str = re.sub ('\\\\slurnormal', '\\\\slurNoDots', str)          
-               
+               str = re.sub ('\\\\slurnormal', '\\\\slurNoDots', str)
+
                str = re.sub ('\\\\shiftoff', '\\\\shiftOff', str)
                str = re.sub ('\\\\shifton', '\\\\shiftOn', str)
                str = re.sub ('\\\\shiftonn', '\\\\shiftOnn', str)
@@ -571,7 +603,7 @@ if 1:
                str = re.sub ('verticalDirection[^=]*= *#?"?(1|(\\\\up))"?', 'Stem \\\\override #\'direction = #0\nSlur \\\\override #\'direction = #0\n Tie \\\\override #\'direction = #1', str)
                str = re.sub ('verticalDirection[^=]*= *#?"?((-1)|(\\\\down))"?', 'Stem \\\\override #\'direction = #0\nSlur \\\\override #\'direction = #0\n Tie \\\\override #\'direction = #-1', str)
                str = re.sub ('verticalDirection[^=]*= *#?"?(0|(\\\\center))"?', 'Stem \\\\override #\'direction = #0\nSlur \\\\override #\'direction = #0\n Tie \\\\override #\'direction = #0', str)
-               
+
                str = re.sub ('\\\\property *[^ .]*[.]?([a-z]+)VerticalDirection[^=]*= *#?"?(1|(\\\\up))"?', '\\\\\\1Up', str)
                str = re.sub ('\\\\property *[^ .]*[.]?([a-z]+)VerticalDirection[^=]*= *#?"?((-1)|(\\\\down))"?', '\\\\\\1Down', str)
                str = re.sub ('\\\\property *[^ .]*[.]?([a-z]+)VerticalDirection[^=]*= *#?"?(0|(\\\\center))"?', '\\\\\\1Both', str)
@@ -595,7 +627,7 @@ if 1:
 
 
                return str
-       
+
        conversions.append (((1,3,93), conv,
                 'property definiton case (eg. onevoice -> oneVoice)'))
 
@@ -604,17 +636,19 @@ if 1:
        def conv (str):
                str = re.sub ('ChordNames*', 'ChordNames', str)
                if re.search ('\\\\textscript "[^"]* *"[^"]*"', str):
-                       sys.stderr.write ('\nNot smart enough to convert to new \\textscript markup text')
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "new \\textscript markup text")
+                       sys.stderr.write ('\n')
 
                str = re.sub ('\\textscript +("[^"]*")', '\\textscript #\\1', str)
 
                return str
-       
+
        conversions.append (((1,3,97), conv, 'ChordName -> ChordNames'))
 
 
 # TODO: add lots of these
-       
+
 if 1:
        def conv (str):
                str = re.sub ('\\\\property *"?Voice"? *[.] *"?textStyle"? *= *"([^"]*)"', '\\\\property Voice.TextScript \\\\set #\'font-style = #\'\\1', str)
@@ -623,19 +657,19 @@ if 1:
                str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?timeSignatureStyle"? *= *"([^"]*)"', '\\\\property \\1.TimeSignature \\\\override #\'style = #\'\\2', str)
 
                str = re.sub ('"?timeSignatureStyle"? *= *#?""', 'TimeSignature \\\\override #\'style = ##f', str)
-               
+
                str = re.sub ('"?timeSignatureStyle"? *= *#?"([^"]*)"', 'TimeSignature \\\\override #\'style = #\'\\1', str)
-               
+
                str = re.sub ('#\'style *= #*"([^"])"', '#\'style = #\'\\1', str)
-               
+
                str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?horizontalNoteShift"? *= *"?#?([-0-9]+)"?', '\\\\property \\1.NoteColumn \\\\override #\'horizontal-shift = #\\2', str)
 
                # ugh
                str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?flagStyle"? *= *""', '\\\\property \\1.Stem \\\\override #\'flag-style = ##f', str)
-               
+
                str = re.sub ('\\\\property *"?([^.]+)"? *[.] *"?flagStyle"? *= *"([^"]*)"', '\\\\property \\1.Stem \\\\override #\'flag-style = #\'\\2', str)
                return str
-       
+
        conversions.append (((1,3,98), conv, 'CONTEXT.textStyle -> GROB.#font-style '))
 
 if 1:
@@ -647,7 +681,7 @@ if 1:
 
 
                return str
-       
+
        conversions.append (((1,3,102), conv, 'beamAutoEnd -> autoBeamSettings \\push (end * * * *)'))
 
 
@@ -657,7 +691,7 @@ if 1:
                str = re.sub ('\\\\pop', '\\\\revert', str)
 
                return str
-       
+
        conversions.append (((1,3,111), conv, '\\push -> \\override, \\pop -> \\revert'))
 
 if 1:
@@ -667,7 +701,7 @@ if 1:
                str = re.sub ('Chord[Nn]ames*.Chord[Nn]ames*', 'ChordNames.ChordName', str)
                str = re.sub ('Chord[Nn]ames([ \t\n]+\\\\override)', 'ChordName\\1', str)
                return str
-       
+
        conversions.append (((1,3,113), conv, 'LyricVoice -> LyricsVoice'))
 
 def regularize_id (str):
@@ -689,7 +723,7 @@ def regularize_id (str):
 
 if 1:
        def conv (str):
-               
+
                def regularize_dollar_reference (match):
                        return regularize_id (match.group (1))
                def regularize_assignment (match):
@@ -697,7 +731,7 @@ if 1:
                str = re.sub ('\$([^\t\n ]+)', regularize_dollar_reference, str)
                str = re.sub ('\n([^ \t\n]+)[ \t]*= *', regularize_assignment, str)
                return str
-       
+
        conversions.append (((1,3,117), conv, 'identifier names: $!foo_bar_123 -> xfooBarABC'))
 
 
@@ -705,7 +739,7 @@ if 1:
        def conv (str):
                def regularize_paper (match):
                        return regularize_id (match.group (1))
-               
+
                str = re.sub ('(paper_[a-z]+)', regularize_paper, str)
                str = re.sub ('sustainup', 'sustainUp', str)
                str = re.sub ('nobreak', 'noBreak', str)
@@ -714,9 +748,9 @@ if 1:
                str = re.sub ('sostenutodown', 'sostenutoDown', str)
                str = re.sub ('unachorda', 'unaChorda', str)
                str = re.sub ('trechorde', 'treChorde', str)
-       
+
                return str
-       
+
        conversions.append (((1,3,120), conv, 'paper_xxx -> paperXxxx, pedalup -> pedalUp.'))
 
 if 1:
@@ -724,21 +758,21 @@ if 1:
                str = re.sub ('drarnChords', 'chordChanges', str)
                str = re.sub ('\\musicalpitch', '\\pitch', str)
                return str
-       
+
        conversions.append (((1,3,122), conv, 'drarnChords -> chordChanges, \\musicalpitch -> \\pitch'))
 
 if 1:
        def conv (str):
                str = re.sub ('ly-([sg])et-elt-property', 'ly-\\1et-grob-property', str)
                return str
-       
+
        conversions.append (((1,3,136), conv, 'ly-X-elt-property -> ly-X-grob-property'))
 
 if 1:
        def conv (str):
                str = re.sub ('point-and-click +#t', 'point-and-click line-column-location', str)
                return str
-       
+
        conversions.append (((1,3,138), conv, 'point-and-click argument changed to procedure.'))
 
 if 1:
@@ -747,28 +781,28 @@ if 1:
                str = re.sub ('Thread.FollowThread', 'Voice.VoiceFollower', str)
                str = re.sub ('FollowThread', 'VoiceFollower', str)
                return str
-       
+
        conversions.append (((1,3,138), conv, 'followThread -> followVoice.'))
 
 if 1:
        def conv (str):
                str = re.sub ('font-point-size', 'font-design-size', str)
                return str
-       
+
        conversions.append (((1,3,139), conv, 'font-point-size -> font-design-size.'))
 
 if 1:
        def conv (str):
                str = re.sub ('([a-zA-Z]*)NoDots', '\\1Solid', str)
                return str
-       
+
        conversions.append (((1,3,141), conv, 'xNoDots -> xSolid'))
 
 if 1:
        def conv (str):
                str = re.sub ('([Cc])hord([ea])', '\\1ord\\2', str)
                return str
-       
+
        conversions.append (((1,3,144), conv, 'Chorda -> Corda'))
 
 
@@ -778,7 +812,7 @@ if 1:
                str = re.sub ('([A-Za-z]+)ExtraVerticalExtent', 'ExtraV@rticalExtent', str)
                str = re.sub ('([A-Za-z]+)VerticalExtent', 'VerticalExtent', str)
                str = re.sub ('ExtraV@rticalExtent', 'ExtraVerticalExtent', str)
-               str = re.sub ('MinimumV@rticalExtent', 'MinimumVerticalExtent', str)            
+               str = re.sub ('MinimumV@rticalExtent', 'MinimumVerticalExtent', str)
                return str
 
        conversions.append (((1,3,145), conv,
@@ -792,7 +826,7 @@ if 1:
                # Make sure groups of more than one ; have space before
                # them, so that non of them gets removed by next rule
                str = re.sub ("([^ \n\t;]);(;+)", "\\1 ;\\2", str)
-               
+
                # Only remove ; that are not after spaces, # or ;
                # Otherwise  we interfere with Scheme comments,
                # which is badbadbad.
@@ -824,15 +858,15 @@ if 1:
 if 1:
        def conv (str):
                str = re.sub ('arithmetic-multiplier', 'spacing-increment', str)
-               str = re.sub ('arithmetic-basicspace', 'shortest-duration-space', str)          
+               str = re.sub ('arithmetic-basicspace', 'shortest-duration-space', str)
                return str
-       
+
        conversions.append (((1,5,38), conv, 'SystemStartDelimiter -> systemStartDelimiter'))
 
 
 if 1:
        def conv (str):
-       
+
                def func(match):
                        break_dict = {
                        "Instrument_name": "instrument-name",
@@ -856,22 +890,22 @@ if 1:
 
        # 40 ?
        conversions.append (((1,5,40), conv, 'breakAlignOrder property names'))
-       
+
 
 if 1:
        def conv (str):
                str = re.sub ('noAutoBeaming *= *##f', 'autoBeaming = ##t', str)
                str = re.sub ('noAutoBeaming *= *##t', 'autoBeaming = ##f', str)
                return str
-       
+
        conversions.append (((1,5,49), conv, 'noAutoBeaming -> autoBeaming'))
 
 if 1:
        def conv (str):
                str = re.sub ('tuplet-bracket-visibility', 'bracket-visibility', str)
-               str = re.sub ('tuplet-number-visibility', 'number-visibility', str)             
+               str = re.sub ('tuplet-number-visibility', 'number-visibility', str)
                return str
-       
+
        conversions.append (((1,5,52), conv, 'tuplet-X-visibility -> X-visibility'))
 
 if 1:
@@ -879,7 +913,7 @@ if 1:
                str = re.sub ('Pitch::transpose', 'ly-transpose-pitch', str)
 
                return str
-       
+
        conversions.append (((1,5,56), conv, 'Pitch::transpose -> ly-transpose-pitch'))
 
 if 1:
@@ -887,19 +921,19 @@ if 1:
                str = re.sub ('textNonEmpty *= *##t', "TextScript \\set #'no-spacing-rods = ##f", str)
                str = re.sub ('textNonEmpty *= *##f', "TextScript \\set #'no-spacing-rods = ##t", str)
                return str
-       
+
        conversions.append (((1,5,58), conv, 'deprecate textNonEmpty'))
 
 
 if 1:
        def conv (str):
                str = re.sub ('MinimumVerticalExtent', 'minimumV@rticalExtent', str)
-               str = re.sub ('minimumVerticalExtent', 'minimumV@rticalExtent', str)            
+               str = re.sub ('minimumVerticalExtent', 'minimumV@rticalExtent', str)
                str = re.sub ('ExtraVerticalExtent', 'extraV@rticalExtent', str)
-               str = re.sub ('extraVerticalExtent', 'extraV@rticalExtent', str)                
+               str = re.sub ('extraVerticalExtent', 'extraV@rticalExtent', str)
                str = re.sub ('VerticalExtent', 'verticalExtent', str)
                str = re.sub ('extraV@rticalExtent', 'extraVerticalExtent', str)
-               str = re.sub ('minimumV@rticalExtent', 'minimumVerticalExtent', str)            
+               str = re.sub ('minimumV@rticalExtent', 'minimumVerticalExtent', str)
                return str
 
        conversions.append (((1,5,59), conv,
@@ -912,14 +946,16 @@ if 1:
 
        conversions.append (((1,5,62), conv,
        'visibility-lambda -> break-visibility'))
-       
+
 
 if 1:
        def conv (str):
                if re.search (r'\addlyrics',str) \
                       and re.search ('automaticMelismata', str)  == None:
-                       sys.stderr.write  ('automaticMelismata is turned on by default since 1.5.67. Please fix this by hand.')
-                       raise FatalConversionError()
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "automaticMelismata; turned on by default since 1.5.67.")
+                       sys.stderr.write ('\n')
+                       raise FatalConversionError ()
                return str
 
        conversions.append (((1,5,67), conv,
@@ -928,17 +964,17 @@ if 1:
 if 1:
        def conv (str):
                str = re.sub ('ly-set-grob-property([^!])', 'ly-set-grob-property!\1', str)
-               str = re.sub ('ly-set-mus-property([^!])', 'ly-set-mus-property!\1', str)               
+               str = re.sub ('ly-set-mus-property([^!])', 'ly-set-mus-property!\1', str)
                return str
-       
+
        conversions.append (((1,5,68), conv, 'ly-set-X-property -> ly-set-X-property!'))
 
 if 1:
        def conv (str):
                str = re.sub ('extent-X', 'X-extent', str)
-               str = re.sub ('extent-Y', 'Y-extent', str)              
+               str = re.sub ('extent-Y', 'Y-extent', str)
                return str
-       
+
        conversions.append (((1,5,71), conv, 'extent-[XY] -> [XY]-extent'))
 
 
@@ -951,7 +987,7 @@ if 1:
                str = re.sub ('#\(set! +point-and-click +#f\)',
                              '#(set-point-and-click! \'none)', str)
                return str
-       
+
        conversions.append (((1,5,72), conv, 'set! point-and-click -> set-point-and-click!'))
 
 
@@ -961,7 +997,7 @@ if 1:
                str = re.sub (r"""Stem([ ]+)\\override #'style""", r"""Stem \\override #'flag-style""", str);
                str = re.sub (r"""Stem([ ]+)\\set([ ]+)#'style""", r"""Stem \\set #'flag-style""", str);
                return str
-       
+
        conversions.append (((1,6,5), conv, 'Stems: flag-style -> stroke-style; style -> flag-style'))
 
 
@@ -973,7 +1009,7 @@ if 1:
                str = re.sub ('\\(ly-make-music *\"([A-Z][a-z_]+)_req\"\\)', subst_req_name, str)
                str = re.sub ('Request_chord', 'EventChord', str)
                return str
-       
+
        conversions.append (((1,7,1), conv, 'ly-make-music foo_bar_req -> make-music-by-name FooBarEvent'))
 
 
@@ -1004,7 +1040,7 @@ if 1:
                return ' = #(make-event-chord (list %s))' % subst_ev_name (match)
        def subst_csp_inline (match):
                return '#(ly-export (make-event-chord (list %s)))' % subst_ev_name (match)
-               
+
        def conv (str):
                str = re.sub (r' *= *\\spanrequest *([^ ]+) *"([^"]+)"', subst_definition_ev_name, str)
                str = re.sub (r'\\spanrequest *([^ ]+) *"([^"]+)"', subst_inline_ev_name, str)
@@ -1053,23 +1089,23 @@ if 1:
                        ]
 
                origre = r'\b(%s)' % string.join (changed, '|')
-               
+
                str = re.sub (origre, r'ly:\1',str)
                str = re.sub ('set-point-and-click!', 'set-point-and-click', str)
-               
+
                return str
-       
+
        conversions.append (((1,7,3), conv, 'ly- -> ly:'))
 
 if 1:
        def conv(str):
                if re.search ('new-chords-done',str):
                        return str
-               
+
                str = re.sub (r'<<', '< <', str)
                str = re.sub (r'>>', '> >', str)
                return str
-       
+
        conversions.append (((1,7,4), conv, '<< >> -> < <  > >'))
 
 if 1:
@@ -1109,13 +1145,13 @@ if 1:
                              r"", str)
                return str
        conversions.append (((1,7,10), conv, "\property ChordName #'style -> #(set-chord-name-style 'style)"))
-       
+
 
 
 if 1:
        def conv(str):
                str = re.sub (r"ly:transpose-pitch", "ly:pitch-transpose", str)
-               
+
                return str
        conversions.append (((1,7,11), conv, "transpose-pitch -> pitch-transpose"))
 
@@ -1126,17 +1162,17 @@ if 1:
                str = re.sub (r"ly:add-molecule", "ly:molecule-add", str)
                str = re.sub (r"ly:combine-molecule-at-edge", "ly:molecule-combine-at-edge", str)
                str = re.sub (r"ly:align-to!", "ly:molecule-align-to!", str)
-               
+
                return str
-       
-       conversions.append (((1,7,13), conv, "ly:XX-molecule-YY -> ly:molecule-XX-YY")) 
+
+       conversions.append (((1,7,13), conv, "ly:XX-molecule-YY -> ly:molecule-XX-YY"))
 
 if 1:
        def conv(str):
                str = re.sub (r"linewidth *= *-[0-9.]+ *(\\mm|\\cm|\\in|\\pt)?", 'raggedright = ##t', str )
                return str
-       
-       conversions.append (((1,7,15), conv, "linewidth = -1 -> raggedright = ##t"))    
+
+       conversions.append (((1,7,15), conv, "linewidth = -1 -> raggedright = ##t"))
 
 if 1:
        def conv(str):
@@ -1147,7 +1183,7 @@ if 1:
                str = re.sub ("divisiomaxima",
                              "divisioMaxima", str)
                return str
-       
+
        conversions.append (((1,7,16), conv, "divisiomaior -> divisioMaior"))
 
 if 1:
@@ -1155,7 +1191,7 @@ if 1:
                str = re.sub ("Skip_req_swallow_translator",
                              "Skip_event_swallow_translator", str)
                return str
-       
+
        conversions.append (((1,7,17), conv, "Skip_req  -> Skip_event"))
 
 if 1:
@@ -1168,7 +1204,7 @@ if 1:
                              "#'enclose-bounds", str)
 
                return str
-       
+
        conversions.append (((1,7,18), conv,
                             """groupOpen/Close  -> start/stopGroup,
                             #'outer  -> #'enclose-bounds
@@ -1177,13 +1213,18 @@ if 1:
 if 1:
        def conv(str):
                if re.search( r'\\GraceContext', str):
-                       sys.stderr.write ("GraceContext has been removed")
-                       sys.stderr.write ("please use #(add-to-grace-init .. )")
-                       raise FatalConversionError()
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "GraceContext")
+                       sys.stderr.write (FROM_TO \
+                                         % ("GraceContext", "#(add-to-grace-init .. )"))
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (UPDATE_MANUALLY)
+                       sys.stderr.write ('\n')
+                       raise FatalConversionError ()
 
                str = re.sub ('HaraKiriStaffContext', 'RemoveEmptyStaffContext', str)
                return str
-       
+
        conversions.append (((1,7,19), conv,"remove GraceContext"))
 
 
@@ -1195,7 +1236,7 @@ if 1:
                        r"\1 #'style",
                        str)
                return str
-       
+
        conversions.append (((1,7,22), conv,"#'type -> #'style"))
 
 if 1:
@@ -1209,21 +1250,23 @@ if 1:
                        "automaticBars = ##t",
                        str)
                return str
-       
+
        conversions.append (((1,7,23), conv,"barNonAuto -> automaticBars"))
-       
+
 
 if 1:
        def conv(str):
                if re.search( r'-(start|stop)Cluster', str):
-                       sys.stderr.write ("""Cluster syntax has been changed.
-Please refer to the manual for details, and convert manually.
-""")
-                       
-                       raise FatalConversionError()
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "Cluster syntax")
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (UPDATE_MANUALLY)
+                       sys.stderr.write ('\n')
+
+                       raise FatalConversionError ()
 
                return str
-       
+
        conversions.append (((1,7,24), conv,"cluster syntax"))
 
 if 1:
@@ -1232,7 +1275,7 @@ if 1:
                                r"\property Staff.pedal\1Style ", str)
                str = re.sub (r"\\property *Staff\.(Sustain|Sostenuto|UnaCorda)Pedal *\\revert *#'pedal-type", '', str)
                return str
-       
+
        conversions.append (((1,7,28), conv,"new Pedal style syntax"))
 
 
@@ -1279,7 +1322,7 @@ if 1:
                                if tr not in slur_strs:
                                        slur_strs.append (tr)
                                return  m.group (1)
-                       
+
                        str = re.sub (r"([a-z]+[',!? ]*)(:[0-9]+)",
                                      sub_tremolos, str)
 
@@ -1292,19 +1335,19 @@ if 1:
                                if '-)' not in slur_strs:
                                        slur_strs.append (')')
                                return m.group(1)
-                       
+
                        def sub_p_slurs(m, slur_strs = slur_strs):
                                if '-\)' not in slur_strs:
                                        slur_strs.append ('\)')
                                return m.group(1)
-                       
+
                        str = re.sub (r"\)[ ]*([a-z]+)", sub_slurs, str)
                        str = re.sub (r"\\\)[ ]*([a-z]+)", sub_p_slurs, str)
                        def sub_begin_slurs(m, slur_strs = slur_strs):
                                if '-(' not in slur_strs:
                                        slur_strs.append ('(')
                                return m.group(1)
-                       
+
                        str = re.sub (r"([a-z]+[,'!?0-9 ]*)\(",
                                      sub_begin_slurs, str)
                        def sub_begin_p_slurs(m, slur_strs = slur_strs):
@@ -1369,7 +1412,7 @@ if 1:
                        return str
                str = re.sub ('<<', '@STARTCHORD@', str)
                str = re.sub ('>>', '@ENDCHORD@', str)
-               
+
                str = re.sub (r'\\<', '@STARTCRESC@', str)
                str = re.sub (r'\\>', '@STARTDECRESC@', str)
                str = re.sub (r'([_^-])>', r'\1@ACCENT@', str)
@@ -1382,7 +1425,7 @@ if 1:
                              r'\1-[', str)
                str = re.sub (r'\\! *(@STARTCHORD@[^@]+@ENDCHORD@[0-9.]*)',
                              r'\1-\\!', str)
-               
+
                str = re.sub (r'<([^?])', r'%s\1' % simstart, str)
                str = re.sub (r'>([^?])', r'%s\1' % simend,  str)
                str = re.sub ('@STARTCRESC@', r'\\<', str)
@@ -1394,19 +1437,50 @@ if 1:
                str = re.sub (r'@ACCENT@', '>', str)
                return str
 
+       markup_start = re.compile(r"([-^_]|\\mark)\s*(#\s*'\s*)\(")
+       musicglyph = re.compile(r"\(\s*music\b")
+       columns = re.compile(r"\(\s*columns\b")
+       submarkup_start = re.compile(r"\(\s*([a-zA-Z]+)")
+       leftpar = re.compile(r"\(")
+       rightpar = re.compile(r"\)")
+
        def text_markup (str):
-               str = re.sub (r"""([-_^]) *# *' *\( *music *(\"[^"]*\") *\)""",
-                               r"\1\\markup { \\musicglyph #\2 }", str)
-               str = re.sub (r"""([-_^]) *# *' *\( *([a-z]+) *([^()]*)\)""",
-                               r"\1\\markup { \\\2 \3 }", str)
-               str = re.sub (r"""\\mark *# *' *\( *music *(\"[^"]*\") *\)""",
-                               r"\\mark \\markup { \\musicglyph #\1 }", str)
-               str = re.sub (r"""\\mark *# *' *\( *([a-z]+) *([^()]*)\)""",
-                               r"\\mark \\markup { \\\1 \2 }", str)
-               return str      
+               result = ''
+               # Find the beginning of each markup:
+               match = markup_start.search (str)
+               while match:
+                       result = result + str[:match.end (1)] + " \markup"
+                       str = str[match.end( 2):]
+                       # Count matching parentheses to find the end of the 
+                       # current markup:
+                       nesting_level = 0
+                       pars = re.finditer(r"[()]",str)
+                       for par in pars:
+                               if par.group () == '(':
+                                       nesting_level = nesting_level + 1
+                               else:
+                                       nesting_level = nesting_level - 1
+                               if nesting_level == 0:
+                                       markup_end = par.end ()
+                                       break
+                       # The full markup in old syntax:
+                       markup = str[:markup_end]
+                       # Modify to new syntax:
+                       markup = musicglyph.sub (r"{\\musicglyph", markup)
+                       markup = columns.sub (r"{", markup)
+                       markup = submarkup_start.sub (r"{\\\1", markup)
+                       markup = leftpar.sub ("{", markup)
+                       markup = rightpar.sub ("}", markup)
+       
+                       result = result + markup
+                       # Find next markup
+                       str = str[markup_end:]
+                       match = markup_start.search(str)
+               result = result + str
+               return result
 
        def articulation_substitute (str):
-               str = re.sub (r"""([^-])\[ *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
+               str = re.sub (r"""([^-])\[ *(\\?\)?[a-z]+[,']*[!?]?[0-9:]*\.*)""",
                              r"\1 \2[", str)
                str = re.sub (r"""([^-])\\\) *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
                              r"\1 \2\\)", str)
@@ -1415,33 +1489,76 @@ if 1:
                str = re.sub (r"""([^-])\\! *([a-z]+[,']*[!?]?[0-9:]*\.*)""",
                              r"\1 \2\\!", str)
                return str
-       
+
+       string_or_scheme = re.compile ('("(?:[^"\\\\]|\\\\.)*")|(#\\s*\'?\\s*\\()')
+
+       # Only apply articulation_substitute () outside strings and 
+       # Scheme expressions:
+       def smarter_articulation_subst (str):
+               result = ''
+               # Find the beginning of next string or Scheme expr.:
+               match = string_or_scheme.search (str)
+               while match:
+                       # Convert the preceding LilyPond code:
+                       previous_chunk = str[:match.start()]
+                       result = result + articulation_substitute (previous_chunk)
+                       if match.group (1): # Found a string
+                               # Copy the string to output:
+                               result = result + match.group (1)
+                               str = str[match.end(1):]
+                       else: # Found a Scheme expression. Count 
+                               # matching parentheses to find its end
+                               str = str[match.start ():]
+                               nesting_level = 0
+                               pars = re.finditer(r"[()]",str)
+                               for par in pars:
+                                       if par.group () == '(':
+                                               nesting_level = nesting_level + 1
+                                       else:
+                                               nesting_level = nesting_level - 1
+                                       if nesting_level == 0:
+                                               scheme_end = par.end ()
+                                               break
+                               # Copy the Scheme expression to output:
+                               result = result + str[:scheme_end]
+                               str = str[scheme_end:]
+                       # Find next string or Scheme expression:
+                       match = string_or_scheme.search (str)
+               # Convert the remainder of the file
+               result = result + articulation_substitute (str)
+               return result
+
        def conv_relative(str):
                if re.search (r"\\relative", str):
                        str= "#(ly:set-option 'old-relative)\n" + str
 
                return str
-       
+
        def conv (str):
                str = re.sub (r"#'\(\)", "@SCM_EOL@", str)
                str =  conv_relative (str)
                str = sub_chords (str)
 
                str = text_markup (str)
-               str = articulation_substitute (str)
+               str = smarter_articulation_subst (str)
                str = re.sub ("@SCM_EOL@", "#'()", str)
-               
+
                return str
-       
+
        conversions.append (((1,9,0), conv, """New relative mode,
 Postfix articulations, new text markup syntax, new chord syntax."""))
 
 if 1:
        def conv (str):
                if re.search ("font-style",str):
-                       sys.stderr.write ("font-style is deprecated. Please remove.")
-                       raise FatalConversionError()
-                       
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "font-sytle")
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (UPDATE_MANUALLY)
+                       sys.stderr.write ('\n')
+
+                       raise FatalConversionError ()
+
                str = re.sub (r'-\\markup', r'@\\markup', str)
                str = re.sub (r'-\\', r'\\', str)
                str = re.sub (r'-\)', ')', str)
@@ -1466,9 +1583,9 @@ if 1:
   \1
   \\property Voice.Stem \\revert #'stroke-style }
 """, str)
-               
+
                return str
-       
+
        conversions.append (((1,9,2), conv, """\\newcontext -> \\new"""))
 
 if 1:
@@ -1477,17 +1594,21 @@ if 1:
                              'acciaccatura', str)
 
                if re.search ("context-spec-music", str):
-                       sys.stderr.write ("context-spec-music takes a symbol for the context now. Update by hand.")
-                                       
-                       raise FatalConversionError()
-               
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (NOT_SMART % "context-spec-music")
+                       sys.stderr.write ('\n')
+                       sys.stderr.write (UPDATE_MANUALLY)
+                       sys.stderr.write ('\n')
+
+                       raise FatalConversionError ()
+
                str = re.sub ('fingerHorizontalDirection *= *#(LEFT|-1)',
                              "fingeringOrientations = #'(up down left)", str)
                str = re.sub ('fingerHorizontalDirection *= *#(RIGHT|1)',
                              "fingeringOrientations = #'(up down right)", str)
 
                return str
-       
+
        conversions.append (((1,9,3), conv,
                             """\\acciaccatura misspelling, fingerHorizontalDirection -> fingeringOrientations"""))
 
@@ -1495,14 +1616,14 @@ if 1:
 def conv (str):
        if re.search ('\\figures', str):
                sys.stderr.write ("Warning: attempting automatic \\figures conversion.  Check results!");
-               
-       
+
+
        def figures_replace (m):
                s = m.group (1)
                s = re.sub ('<', '@FIGOPEN@',s)
                s = re.sub ('>', '@FIGCLOSE@',s)
                return '\\figures { %s }' % s
-       
+
        str = re.sub (r'\\figures[ \t\n]*{([^}]+)}', figures_replace, str)
        str = re.sub (r'\\<', '@STARTCRESC@', str)
        str = re.sub (r'\\>', '@STARTDECRESC@', str)
@@ -1535,20 +1656,27 @@ conversions.append (((1,9,5), conv, 'HaraKiriVerticalGroup -> RemoveEmptyVertica
 
 def conv (str):
        if re.search ("ly:get-font", str) :
-               sys.stderr.write (r"(ly:get-font foo ..)  has been replaced by" + \
-                                 " (ly:paper-get-font (ly:grob-get-paper foo) .. ).\n" +\
-                                 "please update manually.")
-               
-               raise FatalConversionError()
-       
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "(ly:-get-font")
+               sys.stderr.write ('\n')
+               sys.stderr.write (FROM_TO \
+                                 % ("(ly:paper-get-font (ly:grob-get-paper foo) .. )",
+                                    "(ly:paper-get-font (ly:grob-get-paper foo) .. )"))
+               sys.stderr.write (UPDATE_MANUALLY)
+               sys.stderr.write ('\n')
+               raise FatalConversionError ()
+
        if re.search ("\\pitch *#", str) :
-               sys.stderr.write (r"\\pitch has been deprecated. " +\
-                                 " Use Scheme code to construct arbitrary note events.")
-               
-               raise FatalConversionError()
-       
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "\\pitch")
+               sys.stderr.write ('\n')
+               sys.stderr.write ("Use Scheme code to construct arbitrary note events.")
+               sys.stderr.write ('\n')
+
+               raise FatalConversionError ()
+
        return str
-               
+
 
 conversions.append (((1,9,6), conv, 'ly:get-font deprecated.'))
 
@@ -1562,10 +1690,10 @@ def conv (str):
                        '1': 'SHARP',
                        '2': 'DOUBLE-SHARP',
                        }[alt]
-               
+
                return '(ly:make-pitch %s %s %s)' % (m.group(1), m.group (2),
                                                     alt)
-       
+
        str =re.sub ("\\(ly:make-pitch *([0-9-]+) *([0-9-]+) *([0-9-]+) *\\)",
                     sub_alteration, str)
 
@@ -1585,15 +1713,18 @@ as a substitution text.""" % (m.group (1), m.group (2)) )
 
        if re.search ("ly:(make-pitch|pitch-alteration)", str) \
               or re.search ("keySignature", str):
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "pitches")
+               sys.stderr.write ('\n')
                sys.stderr.write (
 """The alteration field of Scheme pitches was multiplied by 2
-to support quarter tone accidentals. You have to edit the following constructs by hand:
+to support quarter tone accidentals.  You must update the following constructs by manually:
 
-* calls of  ly:make-pitch and ly:pitch-alteration
+* calls of ly:make-pitch and ly:pitch-alteration
 * keySignature settings made with \property
 """)
                raise FatalConversionError ()
-       
+
        return str
 conversions.append (((1,9,7), conv,
                     '''use symbolic constants for alterations,
@@ -1602,8 +1733,14 @@ remove \\outputproperty, move ly:verbose into ly:get-option'''))
 
 def conv (str):
        if re.search ("dash-length",str):
-               sys.stderr.write ("""dash-length has been removed. Use dash-fraction instead.""")
-               raise FatalConversionError()
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "dash-length")
+               sys.stderr.write ('\n')
+               sys.stderr.write (FROM_TO % ("dash-length", "dash-fraction"))
+               sys.stderr.write ('\n')
+               sys.stderr.write (UPDATE_MANUALLY)
+               sys.stderr.write ('\n')
+               raise FatalConversionError ()
        return str
 
 conversions.append (((1,9,8), conv, """dash-length -> dash-fraction"""))
@@ -1611,12 +1748,12 @@ conversions.append (((1,9,8), conv, """dash-length -> dash-fraction"""))
 
 def conv (str):
        def func(match):
-               return "#'font-size = #%d" % (2*string.atoi (match.group (1))) 
-               
+               return "#'font-size = #%d" % (2*string.atoi (match.group (1)))
+
        str =re.sub (r"#'font-relative-size\s*=\s*#\+?([0-9-]+)", func, str)
        str =re.sub (r"#'font-family\s*=\s*#'ancient",
                     r"#'font-family = #'music", str)
-       
+
        return str
 
 conversions.append (((2,1,1), conv, """font-relative-size -> font-size"""))
@@ -1637,7 +1774,7 @@ def conv (str):
        def func (match):
                c = match.group (1)
                b = match.group (2)
-               
+
                if b == 't':
                        if c == 'Score':
                                return ''
@@ -1645,8 +1782,8 @@ def conv (str):
                                return r" \property %s.melismaBusyProperties \unset"  % c
                elif b == 'f':
                        return r"\property %s.melismaBusyProperties = #'(melismaBusy)"  % c
-               
-       str =re.sub (r"\\property ([a-zA-Z]+)\s*\.\s*automaticMelismata\s*=\s*##([ft])", func, str)
+
+       str = re.sub (r"\\property ([a-zA-Z]+)\s*\.\s*automaticMelismata\s*=\s*##([ft])", func, str)
        return str
 
 conversions.append (((2,1,4), conv, """removal of automaticMelismata; use melismaBusyProperties instead."""))
@@ -1673,7 +1810,7 @@ def conv (str):
                dur = ''
                log = string.atoi (match.group (1))
                dots = string.atoi (match.group (2))
-               
+
                if log >= 0:
                        dur = '%d' % (1 << log)
                else:
@@ -1682,9 +1819,9 @@ def conv (str):
                                -3 : 'maxima'}[log]
 
                dur += ('.' * dots)
-               
+
                return r'\note #"%s" #%s' % (dur, match.group (3))
-       
+
        str = re.sub (r'\\note\s+#([0-9-]+)\s+#([0-9]+)\s+#([0-9.-]+)',
                      sub_note, str)
        return str
@@ -1717,7 +1854,7 @@ conversions.append (((2,1,14), conv, """style = dotted -> dash-fraction = 0"""))
 def conv (str):
        str =re.sub (r'LyricsVoice\s*\.\s*instrument\s*=\s*("[^"]*")',
                     r'LyricsVoice . vocalName = \1', str)
-       
+
        str =re.sub (r'LyricsVoice\s*\.\s*instr\s*=\s*("[^"]*")',
                     r'LyricsVoice . vocNam = \1', str)
        return str
@@ -1737,7 +1874,7 @@ def conv (str):
                '-3': 'threeqflat',
                '-4': 'doubleflat'}
                return '\\%s' %  d[m.group (1)]
-                    
+
        str = re.sub (r'\\musicglyph\s*#"accidentals-([0-9-]+)"',
                      sub_acc, str)
        return str
@@ -1748,18 +1885,20 @@ conversions.append (((2,1,16), conv, """\\musicglyph #"accidentals-NUM" -> \\sha
 def conv (str):
 
        if re.search (r'\\partcombine', str):
-               sys.stderr.write ('Warning: \\partcombine has been changed. '
-                                 +'Check conversion manually!')
-
-               raise FatalConversionError()
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "\\partcombine")
+               sys.stderr.write ('\n')
+               sys.stderr.write (UPDATE_MANUALLY)
+               sys.stderr.write ('\n')
+               raise FatalConversionError ()
 
        # this rule doesn't really work,
        # too lazy to figure out why.
        str = re.sub (r'\\context\s+Voice\s*=\s*one\s*\\partcombine\s+Voice\s*\\context\s+Thread\s*=\s*one(.*)\s*'
                      + r'\\context\s+Thread\s*=\s*two',
                      '\\\\newpartcombine\n\\1\n', str)
-       
-       
+
+
        return str
 
 conversions.append (((2,1,17), conv, """\\partcombine syntax change to \\newpartcombine"""))
@@ -1783,11 +1922,11 @@ def conv (str):
        str = re.sub (r'\\chordmodifiers ','chordmodifiers = ', str)
        str = re.sub (r'\bdrums\b\s*=','drumContents = ', str)
        str = re.sub (r'\\drums\b','\\drumContents ', str)
-       
+
 
        if re.search ('drums->paper', str):
                sys.stderr.write ("\nDrum notation found. Check file manually!")
-               
+
        str = re.sub (r"""\\apply\s+#\(drums->paper\s+'([a-z]+)\)""",
                      r"""\property DrumStaff.drumStyleTable = #\1-style""",
                      str)
@@ -1797,7 +1936,7 @@ def conv (str):
 
        str = re.sub (r"""(\\once\s*)?\\property\s+Thread\s*\.\s*NoteHead\s*"""
                      + r"""\\(set|override)\s*#'style\s*=\s*#'harmonic"""
-                     + r"""\s+([a-z]+[,'=]*)([0-9]*\.*)"""                   
+                     + r"""\s+([a-z]+[,'=]*)([0-9]*\.*)"""
                      ,r"""<\3\\harmonic>\4""", str)
 
        str = re.sub (r"""\\new Thread""", """\context Voice""", str)
@@ -1810,8 +1949,8 @@ def conv (str):
        str = re.sub (r"""\bLyrics\b""", r"""LyricsVoice""", str)
        str = re.sub (r"""LyricsContext""", r"""LyricsVoiceContext""", str)
        str = re.sub (r"""L@ricsVoice""", r"""LyricsVoice""",str)
-       
-       
+
+
        return str
 
 conversions.append (((2,1,19), conv, """Drum notation changes, Removing \\chordmodifiers, \\notenames.
@@ -1848,6 +1987,8 @@ Grob::preset_extent removed.
 
 
 def conv (str):
+       str = re.sub (r'(\\property[^=]+)=\s*([-0-9]+)',
+                     r'\1= #\2', str)
        str = re.sub (r'\\property\s+([^. ]+)\s*\.\s*([^\\=]+)\s*\\(set|override)',
                      r"\\overrid@ \1.\2 ", str)
        str = re.sub (r'\\property\s+([^. ]+)\s*\.\s*([^\\= ]+)\s*=\s*',
@@ -1860,7 +2001,7 @@ def conv (str):
        str = re.sub (r'Voice\.', '', str)
        str = re.sub (r'Lyrics\.', '', str)
        str = re.sub (r'ChordNames\.', '', str)
-       
+
        str = re.sub ('rev@rt', 'revert',str)
        str = re.sub ('s@t', 'set',str)
        str = re.sub ('overrid@', 'override',str)
@@ -1888,28 +2029,28 @@ def conv (str):
        str = re.sub (r'\\(translator|with)\s*{[^}]+}',  subst_in_trans, str)
 
        def sub_abs (m):
-               
+
                context = m.group ('context')
                d = m.groupdict ()
                if context:
-                       context = " '%s" % context[:-1] # -1: remove . 
+                       context = " '%s" % context[:-1] # -1: remove .
                else:
                        context = ''
 
                d['context'] = context
-               
+
                return r"""#(override-auto-beam-setting %(prop)s %(num)s %(den)s%(context)s)""" % d
 
        str = re.sub (r"""\\override\s*(?P<context>[a-zA-Z]+\s*\.\s*)?autoBeamSettings"""
                      +r"""\s*#(?P<prop>[^=]+)\s*=\s*#\(ly:make-moment\s+(?P<num>\d+)\s+(?P<den>\d)\s*\)""",
                      sub_abs, str)
-       
+
        return str
-       
+
 conversions.append (((2,1,23), conv, """Property setting syntax in \\translator{ }"""))
 def conv (str):
        str = re.sub (r'music-list\?', 'ly:music-list?', str)
-       str = re.sub (r'\|\s*~', '~ |', str)   
+       str = re.sub (r'\|\s*~', '~ |', str)
        return str
 
 conversions.append (((2,1,24), conv, """music-list? -> ly:music-list?"""))
@@ -1923,8 +2064,12 @@ def conv (str):
        str = re.sub (r'ly:get-broken-into', 'ly:spanner-broken-into', str)
        str = re.sub (r'Melisma_engraver', 'Melisma_translator', str)
        if re.search ("ly:get-paper-variable", str):
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "ly:paper-get-variable")
+               sys.stderr.write ('\n')
                sys.stderr.write ('use (ly:paper-lookup (ly:grob-paper ))')
-               raise FatalConversionError()
+               sys.stderr.write ('\n')
+               raise FatalConversionError ()
 
        str = re.sub (r'\\defaultAccidentals', "#(set-accidental-style 'default)", str)
        str = re.sub (r'\\voiceAccidentals', "#(set-accidental-style 'voice)", str)
@@ -1936,7 +2081,7 @@ def conv (str):
        str = re.sub (r'\\pianoCautionaries', "#(set-accidental-style 'piano-cautionary)", str)
        str = re.sub (r'\\forgetAccidentals', "#(set-accidental-style 'forget)", str)
        str = re.sub (r'\\noResetKey', "#(set-accidental-style 'no-reset)", str)
-       
+
        return str
 
 conversions.append (((2,1,25), conv, """Scheme grob function renaming"""))
@@ -1944,12 +2089,12 @@ conversions.append (((2,1,25), conv, """Scheme grob function renaming"""))
 
 def conv (str):
        str = re.sub ('ly:set-grob-property!', 'ly:grob-set-property!',str)
-       str = re.sub ('ly:set-mus-property!', 'ly:music-set-property!',str)     
-       str = re.sub ('ly:set-context-property!', 'ly:context-set-property!', str)      
+       str = re.sub ('ly:set-mus-property!', 'ly:music-set-property!',str)
+       str = re.sub ('ly:set-context-property!', 'ly:context-set-property!', str)
        str = re.sub ('ly:get-grob-property', 'ly:grob-property',str)
        str = re.sub ('ly:get-mus-property', 'ly:music-property',str)
        str = re.sub ('ly:get-context-property', 'ly:context-property',str)
-       
+
        return str
 
 conversions.append (((2,1,26), conv, """More Scheme function renaming"""))
@@ -1965,21 +2110,21 @@ def conv (str):
 
 
                lower_pitches = filter (lambda x : x <= g, [0, 2, 4, 5, 7, 9, 11, 12])
-               s = len (lower_pitches) -1 
+               s = len (lower_pitches) -1
                a = g - lower_pitches [-1]
 
 
-               print s , lower_pitches, g, a, s 
+               print s , lower_pitches, g, a, s
                str = 'cdefgab' [s]
                str += ['eses', 'es', '', 'is', 'isis'][a + 2]
                if o < 0:
                        str += ',' * (-o - 1)
                elif o >= 0:
                        str += "'" * (o + 1)
-                       
+
                return '\\transposition %s ' % str
 
-       
+
        str = re.sub (r"\\set ([A-Za-z]+\s*\.\s*)?transposing\s*=\s*#([-0-9]+)",
                      subst, str)
        return str
@@ -2012,7 +2157,7 @@ def conv (str):
                      'ly:context-find', str)
        str = re.sub ('ly:unset-context-property','ly:context-unset-property',
                      str)
-                    
+
        str = re.sub (r'ly:get-mutable-properties',
                      'ly:mutable-music-properties',str)
        str = re.sub (r'centralCPosition',
@@ -2040,7 +2185,7 @@ def conv (str):
        str = re.sub (r"(\\set\s+)?(?P<context>(Score\.)?)breakAlignOrder\s*=\s*#'(?P<list>[^\)]+)",
                      r"\n\\override \g<context>BreakAlignment #'break-align-orders = "
                      + "#(make-vector 3 '\g<list>)", str)
-                     
+
        return str
 
 conversions.append (((2,1,33), conv,
@@ -2078,8 +2223,15 @@ conversions.append (((2, 3, 1), conv,
 
 def conv (str):
        if re.search ('textheight', str):
-               sys.stderr.write("\nWarning: tuning of page layout has changed. See reference manual.\n")
-               
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "textheight")
+               sys.stderr.write ('\n')
+               sys.stderr.write (UPDATE_MANUALLY)
+               sys.stderr.write ('\n')
+               sys.stderr.write (
+"""Page layout has been changed, using paper size and margins.
+textheight is no longer used.
+""")
        str = re.sub (r'\\OrchestralScoreContext', '\\Score', str)
        def func(m):
                if m.group(1) not in ['RemoveEmptyStaff',
@@ -2088,10 +2240,9 @@ def conv (str):
                        return '\\' + m.group (1)
                else:
                        return m.group (0)
-               
-               
-       str = re.sub (r'\\([a-zA-Z]+)Context\b', func, str)
 
+
+       str = re.sub (r'\\([a-zA-Z]+)Context\b', func, str)
        str = re.sub ('ly:paper-lookup', 'ly:output-def-lookup', str)
        return str
 
@@ -2100,7 +2251,7 @@ conversions.append (((2, 3, 2), conv,
 
 def conv (str):
        str = re.sub (r'\\notes\b', '', str)
-       
+
        return str
 
 conversions.append (((2, 3, 4), conv,
@@ -2140,7 +2291,7 @@ def conv (str):
        str = re.sub (r'\\addlyrics', r'\\oldaddlyrics', str)
        str = re.sub (r'\\newlyrics', r'\\addlyrics', str)
        if re.search (r"\\override\s*TextSpanner", str):
-               sys.stderr.write ("\nWarning: TextSpanner has been split into DynamicTextSpanner and TextSpanner\n") 
+               sys.stderr.write ("\nWarning: TextSpanner has been split into DynamicTextSpanner and TextSpanner\n")
        return str
 
 conversions.append (((2, 3, 10), conv,
@@ -2172,7 +2323,7 @@ def conv (str):
        str = re.sub (r'\\applymusic\s*#notes-to-clusters',
                      '\\makeClusters', str)
 
-       str = re.sub (r'pagenumber\s*=', 'firstpagenumber', str)
+       str = re.sub (r'pagenumber\s*=', 'firstpagenumber = ', str)
        return str
 
 conversions.append (((2, 3, 12), conv,
@@ -2229,8 +2380,8 @@ with
   #(set-global-staff-size <STAFF-HEIGHT-IN-POINT>)
 
 ''')
-               
-               
+
+
        str = re.sub (r'#\(paper-set-staff-size', '%Use set-global-staff-size at toplevel\n% #(layout-set-staff-size', str)
        return str
 
@@ -2250,6 +2401,17 @@ conversions.append (((2, 3, 23),
                     conv,
                     '''\context Foo = NOTENAME -> \context Foo = "NOTENAME"'''))
 
+def conv (str):
+       def sub(m):
+               return regularize_id (m.group (1))
+       str = re.sub (r'(maintainer_email|maintainer_web|midi_stuff|gourlay_maxmeasures)',
+                     sub, str)
+       return str
+
+conversions.append (((2, 3, 24),
+                    conv,
+                    '''regularize other identifiers.'''))
+
 
 def conv (str):
        return str
@@ -2273,7 +2435,7 @@ conversions.append (((2, 5, 0),
 
 def conv (str):
        str = re.sub (r'ly:import-module',
-                     r'ly:module-copy', str) 
+                     r'ly:module-copy', str)
        return str
 
 conversions.append (((2, 5, 1),
@@ -2281,12 +2443,17 @@ conversions.append (((2, 5, 1),
                     'ly:import-module -> ly:module-copy'))
 
 def conv (str):
-       str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+       str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<(([^>]|<[^>]*>)*)>',
                      r'\\\1 {\2}', str)
-       str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+       str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<(([^>]|<[^>]*>)*)>',
                      r'\\\1 {\2}', str)
-       str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<([^<]*)>',
+       str = re.sub (r'\\(column|fill-line|dir-column|center-align|right-align|left-align|bracketed-y-column)\s*<(([^>]|<[^>]*>)*)>',
                      r'\\\1 {\2}', str)
+       def get_markup (m):
+               s = m.group (0)
+               s = re.sub (r'''((\\"|})\s*){''', '\2 \\line {', s)
+               return s
+       str = re.sub (r'\\markup\s*{([^}]|{[^}]*})*}', get_markup, str)
        return str
 
 conversions.append (((2, 5, 2),
@@ -2295,15 +2462,128 @@ conversions.append (((2, 5, 2),
 
 def conv (str):
        str = re.sub ('ly:find-glyph-by-name', 'ly:font-get-glyph', str)
+       str = re.sub ('"(scripts|clefs|accidentals)-', r'"\1.', str)
+       str = re.sub ("'hufnagel-do-fa", "'hufnagel.do.fa", str)
+       str = re.sub ("'(vaticana|hufnagel|medicaea|petrucci|neomensural|mensural)-", r"'\1.", str)
        return str
 
-conversions.append (((2, 5, 2),
+conversions.append (((2, 5, 3),
+                    conv,
+                    'ly:find-glyph-by-name -> ly:font-get-glyph, remove - from glyphnames.'))
+
+
+def conv (str):
+       str = re.sub (r"\\override\s+(Voice\.)?Slur #'dashed\s*=\s*#\d*(\.\d+)?",
+                     r"\\slurDashed", str)
+       return str
+
+conversions.append (((2, 5, 12),
                     conv,
-                    'ly:find-glyph-by-name -> ly:font-get-glyph'))
+                    '\set Slur #\'dashed = #X -> \slurDashed'))
 
+def conv (str):
+       input_encoding = 'latin1'
+       def func (match):
+               encoding = match.group (1)
 
+               # FIXME: automatic recoding of other than latin1?
+               if encoding == 'latin1':
+                       return match.group (2)
+
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % ("\\encoding: %s" % encoding))
+               sys.stderr.write ('\n')
+               sys.stderr.write (_ ("LilyPond source must be UTF-8"))
+               sys.stderr.write ('\n')
+               if encoding == 'TeX':
+                       sys.stderr.write (_ ("Try the texstrings backend"))
+                       sys.stderr.write ('\n')
+               else:
+                       sys.stderr.write ( _("Do something like: %s") % \
+                                          ("recode %s..utf-8 FILE" % encoding))
+                       sys.stderr.write ('\n')
+               sys.stderr.write (_ ("Or save as UTF-8 in your editor"))
+               sys.stderr.write ('\n')
+               raise FatalConversionError ()
+
+               return match.group (0)
+
+       str = re.sub (r'\\encoding\s+"?([a-zA-Z0-9]+)"?(\s+)', func, str)
+
+       import codecs
+       de_ascii = codecs.getdecoder ('ascii')
+       de_utf_8 = codecs.getdecoder ('utf_8')
+       de_input = codecs.getdecoder (input_encoding)
+       en_utf_8 = codecs.getencoder ('utf_8')
+       try:
+               de_ascii (str)
+       # only in python >= 2.3
+       # except UnicodeDecodeError:
+       except UnicodeError:
+               # do not re-recode UTF-8 input
+               try:
+                       de_utf_8 (str)
+               #except UnicodeDecodeError:
+               except UnicodeError:
+                       str = en_utf_8 (de_input (str)[0])[0]
+
+
+
+       str = re.sub (r"#\(ly:set-point-and-click '[a-z-]+\)", '', str)
+       return str
+
+conversions.append (((2, 5, 13),
+                    conv,
+                    '\\encoding: smart recode latin1..utf-8. Remove ly:point-and-click'))
+
+
+def conv (str):
+       if re.search ("ly:stencil-set-extent!", str):
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "ly:stencil-set-extent!")
+               sys.stderr.write ('\n')
+               sys.stderr.write ('use (set! VAR (ly:make-stencil (ly:stencil-expr VAR) X-EXT Y-EXT))\n')
+               raise FatalConversionError ()
+       if re.search ("ly:stencil-align-to!", str):
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "ly:stencil-align-to!")
+               sys.stderr.write ('\n')
+               sys.stderr.write ('use (set! VAR (ly:stencil-aligned-to VAR AXIS DIR))\n')
+               raise FatalConversionError ()
+       return str
+
+conversions.append (((2, 5, 17),
+                    conv,
+                    'ly:stencil-set-extent! removed'))
+                   
+def conv (str):
+       str = re.sub (r"ly:warn\b", 'ly:warning', str)
+       return str
+
+conversions.append (((2, 5, 18),
+                    conv,
+                    'ly:warn -> ly:warning'))
+def conv (str):
+       if re.search ("(override-|revert-)auto-beam-setting", str)\
+          or re.search ("autoBeamSettings", str):
+               sys.stderr.write ('\n')
+               sys.stderr.write (NOT_SMART % "auto beam settings")
+               sys.stderr.write ('\n')
+               sys.stderr.write ('''
+Auto beam settings must now specify each interesting moment in a measure
+explicitely; 1/4 is no longer multiplied to cover moments 1/2 and 3/4 too.
+''')
+               sys.stderr.write (UPDATE_MANUALLY)
+               sys.stderr.write ('\n')
+               raise FatalConversionError ()
+       return str
+
+conversions.append (((2, 5, 21),
+                    conv,
+                    'warn about auto beam settings'))
+                   
 ################################
-#      END OF CONVERSIONS      
+#      END OF CONVERSIONS
 ################################
 
 def get_conversions (from_version, to_version):
@@ -2318,36 +2598,44 @@ def latest_version ():
 def do_conversion (infile, from_version, outfile, to_version):
        conv_list = get_conversions (from_version, to_version)
 
-       sys.stderr.write ('Applying conversions: ')
+       sys.stderr.write (_ ("Applying conversion: "))
        str = infile.read ()
        last_conversion = ()
        try:
                for x in conv_list:
-                       sys.stderr.write (tup_to_str (x[0]) + ', ')
+                       sys.stderr.write (tup_to_str (x[0]))
+                       if x != conv_list[-1]:
+                               sys.stderr.write (', ')
                        str = x[1] (str)
                        last_conversion = x[0]
 
        except FatalConversionError:
-               sys.stderr.write ('Error while converting; I won\'t convert any further')
+               sys.stderr.write (_ ("%s: error while converting") \
+                                 % program_name)
+               sys.stderr.write ('\n')
+               sys.stderr.write (_ ("Aborting"))
+               sys.stderr.write ('\n')
 
        if last_conversion:
-               sys.stderr.write ('\n')
                new_ver =  '\\version \"%s\"' % tup_to_str (last_conversion)
 
                if re.search (lilypond_version_re_str, str):
-                       str = re.sub (lilypond_version_re_str,'\\'+new_ver, str)
+                       str = re.sub (lilypond_version_re_str,
+                                     '\\%s' % new_ver, str)
                elif add_version:
                        str = new_ver + '\n' + str
 
+               sys.stderr.write ('\n')
                outfile.write (str)
 
        return last_conversion
-       
+
 class UnknownVersion:
        pass
 
 def do_one_file (infile_name):
-       sys.stderr.write ('Processing `%s\' ... '% infile_name)
+       sys.stderr.write (_ ("Processing `%s\'... ") % infile_name)
+       sys.stderr.write ('\n')
        outfile_name = ''
        if __main__.edit:
                outfile_name = infile_name + '.NEW'
@@ -2369,7 +2657,7 @@ def do_one_file (infile_name):
 
 
        if infile_name:
-               infile = open (infile_name,'r')
+               infile = open (infile_name, 'r')
        else:
                infile = sys.stdin
 
@@ -2394,7 +2682,6 @@ def do_one_file (infile_name):
                os.rename (infile_name, infile_name + '~')
                os.rename (infile_name + '.NEW', infile_name)
 
-       sys.stderr.write ('\n')
        sys.stderr.flush ()
 
 edit = 0
@@ -2404,7 +2691,7 @@ from_version = ()
 outfile_name = ''
 show_rules_p = 0
 
-(options, files) = getopt.getopt (sys.argv[1:], 'ao:f:t:senh',
+(options, files) = getopt.getopt (sys.argv[1:], 'ao:f:t:senhv',
                                  ['no-version', 'version', 'output',
                                  'show-rules', 'help', 'edit',
                                  'from=', 'to='])
@@ -2438,18 +2725,29 @@ for opt in options:
 if show_rules_p:
        show_rules (sys.stdout)
        sys.exit (0)
-               
+
 identify ()
+
+if not files:
+       usage ()
+       sys.exit (2)
+
 for f in files:
        if f == '-':
                f = ''
        elif not os.path.isfile (f):
+               sys.stderr.write ('\n')
+               sys.stderr.write (_ ("can't open file: `%s'") % f)
+               sys.stderr.write ('\n')
+               if len (files) == 1:
+                       sys.exit (1)
                continue
        try:
                do_one_file (f)
        except UnknownVersion:
                sys.stderr.write ('\n')
-               sys.stderr.write ("%s: can't determine version for `%s'" % (program_name, f))
+               sys.stderr.write (_ ("%s: can't determine version for `%s'") \
+                                 % (program_name, f))
                sys.stderr.write ('\n')
                if assume_old:
                        fv = from_version
@@ -2457,7 +2755,8 @@ for f in files:
                        do_one_file (f)
                        from_version = fv
                else:
-                       sys.stderr.write ("%s: skipping: `%s' " % (program_name,  f))
+                       sys.stderr.write (_ ("%s: skipping: `%s'") \
+                                         % (program_name,  f))
                pass
 
 sys.stderr.write ('\n')