Generated by hanwen@cs.uu.nl,
From = lilypond-1.5.58, To = lilypond-1.5.59

usage 

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.5.58-1.5.59.diff

Patches do not contain automatically generated files 
or (urg) empty directories, 
i.e., you should rerun autoconf, configure

diff -purN ../lilypond-1.5.58/ChangeLog ./ChangeLog
--- ../lilypond-1.5.58/ChangeLog	Wed May 22 11:33:37 2002
+++ ./ChangeLog	Fri May 31 01:45:07 2002
@@ -1,5 +1,90 @@
+2002-05-31  Han-Wen  <hanwen@cs.uu.nl>
+
+	* scripts/musedata2ly.py (Parser.parse_note_line): add dots. Add
+	note that missing features are excercise for user.
+
+2002-05-30  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* lily/beam.cc (score_stem_lengths): Bugfix for knees: use correct
+	(but alas, not partly precomputed) value for current_y when
+	calculating stem length demerits.
+	(calc_stem_y): Temporary precomputed factors fix.
+
+	* lily/stem.cc (calc_stem_info): Take multiplicity into account
+	for shortest_y too.
+
+	* input/bugs/melisma-tie-rest.ly: New file.
+
+2002-05-30  Han-Wen  <hanwen@cs.uu.nl>
+
+	* lily/stem.cc (calc_stem_info): remove min_y member, rename
+	stuff. 	Remove kneeing stuff.
+
+	* lily/beam.cc (brew_molecule): remove beam direction. Lots of
+	twiddling
+
+2002-05-29  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* scm/sketch.scm: 
+	* scm/ps.scm: 
+	* scm/pdftex.scm: 
+	* scm/pdf.scm: 
+	* scm/tex.scm: Add check for Guile-1.4.1.  Guile includes
+	patch-level of version in minor-version string.  Arg.
+
+2002-05-29  Han-Wen  <hanwen@cs.uu.nl>
+
+	* ly/engraver-init.ly (TabStaffContext): 
+	enable TabStaff by default.
+
+	*  Tablature support by Jean-Baptiste Lamy <jiba@@tuxfamily.org>
+
+2002-05-28  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* config.hh.in: Remove duplicate DIR_DATADIR entry.
+
+	* aclocal.m4: Regenerate.
+	
+	* stepmake/aclocal.m4: Append $FULL_VERSION to datadir.
+
+2002-05-25  Heikki Junes  <heikki.junes@hut.fi>
+
+	* lilypond-mode.el: Added Deutsch notes and fixed "Quick notes".
+
+	* lilypond-mode.el: Write notes with fewer keystrokes trough a 
+	"Quick notes"-interface.
+
+2002-05-26  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* input/regression/non-empty-text.ly: Update example with outdated
+	comment.
+
+2002-05-25  Han-Wen  <hanwen@cs.uu.nl>
+
+	* scripts/convert-ly.py:  add textNonEmpty rule
+
+	* lily/text-engraver.cc (create_grobs): remove textNonEmpty
+
+2002-05-24  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+	* lily/text-item.cc (markup_text2molecule): Junk ugly lookahead by
+	using translate-robust add_molecule instead of add_at_edge.
+	Bugfix for #(lines (finger "" "1")).
+
+2002-05-24  Han-Wen  <hanwen@cs.uu.nl>
+
+	* lily/stem-tremolo.cc (brew_molecule): clean up and fix stem
+	tremolo placement.
+
 2002-05-22  Han-Wen  <hanwen@cs.uu.nl>
 
+	* VERSION: 1.5.58
+ 	
+	* Documentation/user/refman.itely: Bugfix: add node Repeats and
+	MIDI.  Regenerate menu.  Fix @end example.
+
+	* lily/accidental.cc: Add cautionary-style to interface.
+
 	* mf/feta-beugel.mf (code): use autometric macros for braces.
 	This fixes input/bugs/braces.
 
diff -purN ../lilypond-1.5.58/Documentation/topdocs/AUTHORS.texi ./Documentation/topdocs/AUTHORS.texi
--- ../lilypond-1.5.58/Documentation/topdocs/AUTHORS.texi	Thu Mar 21 01:44:50 2002
+++ ./Documentation/topdocs/AUTHORS.texi	Wed May 29 11:05:18 2002
@@ -21,7 +21,10 @@ list is alphabetically ordered.
 
 @itemize @bullet
 @item @email{tca@@gnu.org, Tom Cato Amundsen},
-    cembalo-partita in lilypond, accordion symbols, some lilypond-book.py
+    cembalo-partita in lilypond, accordion symbols, some
+lilypond-book.py
+@item  @email{jiba@@tuxfamily.org,Jean-Baptiste Lamy }
+   Tablature support
 @item @email{matsb@@s3.kth.se, Mats Bengtsson},
     @uref{http://www.s3.kth.se/~matsb/}
     lots of testing, fixes, general comments and contributions.
diff -purN ../lilypond-1.5.58/Documentation/topdocs/INSTALL.texi ./Documentation/topdocs/INSTALL.texi
--- ../lilypond-1.5.58/Documentation/topdocs/INSTALL.texi	Sun May 19 02:11:54 2002
+++ ./Documentation/topdocs/INSTALL.texi	Mon May 27 15:28:16 2002
@@ -143,7 +143,6 @@ distribution supports g++ 3.x and flex.
 Check out @uref{http://www.python.org, the python website}.
 
 @item GUILE (version 1.4 or newer).
-GUILE-1.3.4 may work but is no longer supported.
 Check out
 @uref{http://www.gnu.org/software/guile/guile.html,the GUILE webpage}.
 
diff -purN ../lilypond-1.5.58/Documentation/user/invoking.itexi ./Documentation/user/invoking.itexi
--- ../lilypond-1.5.58/Documentation/user/invoking.itexi	Sun May 19 02:11:55 2002
+++ ./Documentation/user/invoking.itexi	Fri May 24 15:03:22 2002
@@ -38,7 +38,9 @@ have appropriate environment variables s
 set @code{MFINPUTS} and @code{TEXINPUTS} to point to the directory
 containing LilyPond metafont and @file{.tex} files.  For processing
 PostScript output with Ghostscript you have to set @code{GS_FONTPATH}
-to point to the directory containing LilyPond PFA files.
+to point to the directory containing LilyPond PFA files.  When you
+print direct PS output, remember to send the PFA files to the printer
+as well.
 
 Scripts to do this are included in
 @file{buildscripts/out/lilypond-profile} (for sh shells) and
diff -purN ../lilypond-1.5.58/Documentation/user/refman.itely ./Documentation/user/refman.itely
--- ../lilypond-1.5.58/Documentation/user/refman.itely	Wed May 22 11:49:26 2002
+++ ./Documentation/user/refman.itely	Mon May 27 11:21:06 2002
@@ -1416,11 +1416,11 @@ text (see @ref{Text markup}) above or be
 @code{c^"text"}. 
 
 By default, these indications do not influence the note spacing, but
-if @code{Voice.textNonEmpty} is set to true the widths will be taken
-into account.  The identifier @code{\fatText} is defined in the standard
-includes.
-@lilypond[fragment,singleline,verbatim]
-\relative c' { c4^"longtext" \fatText c4_"longlongtext" c4 }
+by setting the grob property @code{no-spacing-rods} to false, the
+widths will be taken into account.  The identifier @code{\fatText} is
+defined in the standard includes.
+@lilypond[fragment,singleline,verbatim] \relative c' { c4^"longtext"
+\fatText c4_"longlongtext" c4 }
 @end lilypond
 
 Text scripts are created in form of @internalsref{TextScript} grobs, in
diff -purN ../lilypond-1.5.58/NEWS ./NEWS
--- ../lilypond-1.5.58/NEWS	Tue May 21 00:05:01 2002
+++ ./NEWS	Thu May 30 12:37:53 2002
@@ -1,6 +1,8 @@
 
 New features in 1.5
 
+* Simple tablature
+
 * Many speedups, many slowdowns.
 
 * More extensibility
diff -purN ../lilypond-1.5.58/VERSION ./VERSION
--- ../lilypond-1.5.58/VERSION	Tue May 21 12:36:49 2002
+++ ./VERSION	Thu May 30 18:06:25 2002
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
-PATCH_LEVEL=58
+PATCH_LEVEL=59
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
diff -purN ../lilypond-1.5.58/aclocal.m4 ./aclocal.m4
--- ../lilypond-1.5.58/aclocal.m4	Tue May 21 00:05:15 2002
+++ ./aclocal.m4	Wed May 29 11:05:54 2002
@@ -1,7 +1,4 @@
 dnl aclocal.m4   -*-shell-script-*-
-dnl WARNING WARNING WARNING
-dnl do not edit! this is aclocal.m4, generated from stepmake/aclocal.m4
-dnl aclocal.m4   -*-shell-script-*-
 dnl StepMake subroutines for configure.in
 
 
@@ -222,7 +219,7 @@ AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
 
 AC_DEFUN(STEPMAKE_DATADIR, [
     if test "$datadir" = "\${prefix}/share"; then
-	    datadir='${prefix}/share/'$package
+	    datadir='${prefix}/share/'$package/$FULL_VERSION
     fi
     DIR_DATADIR=${datadir}
     presome=${prefix}
@@ -233,12 +230,9 @@ AC_DEFUN(STEPMAKE_DATADIR, [
 
     AC_SUBST(datadir)
     AC_SUBST(DIR_DATADIR)
-    
-    dnl yeah, so fuck me gently with a cactus: this doesnt belong here
-    dnl Please take the person responsible for inventing shell-scripts out
-    dnl and shoot him. On behalf of the sane world, thank you.
-    dnl DIR_SHAREDSTATEDIR="foobar"
-    dnl AC_SUBST(DIR_SHAREDSTATEDIR)
+
+    # we used to set DIR_SHAREDSTATEDIR here,
+    # but apparently that broke something
     
     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
 ])
diff -purN ../lilypond-1.5.58/config.hh.in ./config.hh.in
--- ../lilypond-1.5.58/config.hh.in	Sun Feb 10 18:43:09 2002
+++ ./config.hh.in	Wed May 29 11:05:18 2002
@@ -3,11 +3,9 @@
 /* Hmm */
 #define PACKAGE "@package@"
 
-/* define if bla bla /var and the like. */
+/* we don't set DIR_SHAREDSTATEDIR anymore */
 #define DIR_SHAREDSTATEDIR "@DIR_SHAREDSTATEDIR@"
 
-#define DIR_DATADIR "@DIR_DATADIR@"
-
 /* default lilypond init and input dir */
 #define  DIR_DATADIR "@DIR_DATADIR@"
 
diff -purN ../lilypond-1.5.58/debian/rules ./debian/rules
--- ../lilypond-1.5.58/debian/rules	Mon Feb 25 00:30:48 2002
+++ ./debian/rules	Fri May 24 17:40:10 2002
@@ -111,7 +111,7 @@ binary-arch: DH_OPTIONS=-a
 binary-arch: build install
 	dh_testdir
 	dh_testroot
-	cp -av lilypond-mode.el lilypond-font-lock.el \
+	cp -av lilypond-mode.el lilypond-font-lock.el lilypond-indent.el \
 		$(r)/usr/share/emacs/site-lisp/
 	dh_installdocs DEDICATION NEWS ROADMAP *.txt
 
diff -purN ../lilypond-1.5.58/input/bugs/grace-fold-spacing.ly ./input/bugs/grace-fold-spacing.ly
--- ../lilypond-1.5.58/input/bugs/grace-fold-spacing.ly	Thu Jan  1 01:00:00 1970
+++ ./input/bugs/grace-fold-spacing.ly	Fri May 24 00:12:16 2002
@@ -0,0 +1,19 @@
+\score{<
+  \notes \relative c'' \context Staff=violin{
+    \time 3/4
+    b4. b8 a g |
+    \grace a g8.^\trill fis32 g fis4 a8. a16 |
+  }
+  \notes \relative c'' \context Staff=violoncello{
+    \time 3/4
+    \clef tenor
+
+    g8 d^\trill [g d c b] |
+    \clef bass b8.^\trill a32 b a4 r |
+  }
+>
+\paper{
+  linewidth=-1
+}
+}
+
diff -purN ../lilypond-1.5.58/input/bugs/hjbugs.ly ./input/bugs/hjbugs.ly
--- ../lilypond-1.5.58/input/bugs/hjbugs.ly	Fri Apr 12 11:45:39 2002
+++ ./input/bugs/hjbugs.ly	Thu Jan  1 01:00:00 1970
@@ -1,36 +0,0 @@
-%{
-
-2) Grace-output broken: \grace a8 ~ a2 \grace a8 ~ a2
-
-Expected : a8( )a2 a8( )a2
-BUG-here : a8( )a2( a8 )a2
-
-3) Vertical aligns of lines, i.e., line height incorrect:
-
-c^#'(lines (finger "1" ""))  % upper 1,       lower 1
-c^#'(lines (finger "1" "1")) % upper 1,       lower 1
-\stemDown
-c_#'(lines (finger "" "1"))  % upper 1/2 ?!?, lower 1 <- BUG IN UPPER LINE
-c_#'(lines (finger "1" "1")) % upper 1,       lower 1
-
-%}
-
-
-\score { 
-     \notes \transpose c''
-     \context Voice {
- 	<e>~<e>~<c e fis>~<b e f>   % paper & midi broken
- 	<e>~<e>~<c e fis>~<b e f>   % here both are ok.
- 	c^#'(lines (finger "1" ""))
- 	c^#'(lines (finger "1" "1"))
- 	\stemDown
- 	c_#'(lines (finger "" "1"))  % wrong line height of an empty line
- 	c_#'(lines (finger "1" "1")) 
- 
- 	\grace a8 ~ a2 \grace a8 ~ a2 a8
- 	% produces: a8( )a2( a8 )a2   and midi: a1 (a2 \grace a a -> a2)
- 	% should be: a8( )a2 a8( )a2  should be: a2 a2 
-  }
-     \midi{}
-     \paper{}
- }
diff -purN ../lilypond-1.5.58/input/bugs/melisma-tie-rest.ly ./input/bugs/melisma-tie-rest.ly
--- ../lilypond-1.5.58/input/bugs/melisma-tie-rest.ly	Thu Jan  1 01:00:00 1970
+++ ./input/bugs/melisma-tie-rest.ly	Thu May 30 16:05:48 2002
@@ -0,0 +1,24 @@
+\header{
+    texidoc = "Lyric extenders that start because of an autmatic tie melisma,
+extend during a subsequent rest, and cannot be forced to stop."
+}
+\score{
+    <
+	\addlyrics
+	\context Staff = soprano {
+	    \property Staff.automaticMelismata = ##t
+	    \context Voice=soprano\notes\relative c'' {
+		c4 ~ c r2 r1 c
+		c4 ~ c
+		\melismaEnd
+		\property Staff.tieMelismaBusy = ##f
+		r2 r1 c
+	    }
+	}
+	\context Lyrics = "soprano" \lyrics {
+	    hey __ stop?
+	    hey __ STOP!!!
+	}
+    >
+}
+
diff -purN ../lilypond-1.5.58/input/bugs/tremolo.ly ./input/bugs/tremolo.ly
--- ../lilypond-1.5.58/input/bugs/tremolo.ly	Sun May 19 02:06:27 2002
+++ ./input/bugs/tremolo.ly	Thu Jan  1 01:00:00 1970
@@ -1,12 +0,0 @@
-
-
-%{
-
-Hi,
-
-In the following example, the tremolo beams are too 
-close to the long beam.
-
-%}
-
-\score{\notes\relative c'{ c8:32 d:32 e:32 f:32 }}
diff -purN ../lilypond-1.5.58/input/regression/beam-concave.ly ./input/regression/beam-concave.ly
--- ../lilypond-1.5.58/input/regression/beam-concave.ly	Sat May  4 14:57:28 2002
+++ ./input/regression/beam-concave.ly	Thu May 30 12:37:54 2002
@@ -3,10 +3,8 @@
 texidoc = "Concave beams should be horizontal. informally spoken,
   concave refers to the shape of the notes that are opposite a
   beam. If an up-beam has high notes on its center stems, then we call
-  it concave.  In this example, only the beams that are marked `horiz'
-  are considered concave by lily. They should be printed horizontally.
-  "
-}
+  it concave.  This example shows borderline cases. Only the beams
+  that are marked `horiz' should be printed horizontally.  " }
 
 
 %{
diff -purN ../lilypond-1.5.58/input/regression/beam-multiple-cross-staff.ly ./input/regression/beam-multiple-cross-staff.ly
--- ../lilypond-1.5.58/input/regression/beam-multiple-cross-staff.ly	Thu Jan  1 01:00:00 1970
+++ ./input/regression/beam-multiple-cross-staff.ly	Thu May 30 00:55:36 2002
@@ -0,0 +1,26 @@
+\header {
+
+    texidoc = "Kneed beams (often happens with cross-staff beams)
+should look good when there are multiple beams: all the beams should
+go on continuously at the staff change. Stems in both staffs reach up
+to the last beam.
+"
+}
+
+\score { \notes
+	 \context PianoStaff \relative c' <
+	     \context Staff = SA {
+		 \stemDown
+		 [c8 c16 \translator Staff = SB \stemUp c16 ]
+		 \stemBoth
+		 [f g \translator Staff = SA a c] 
+			       }
+	     \context Staff = SB \relative c' {
+\clef bass
+		 [b8 b16 \stemUp b,,16 ]
+		 [b8 b16 \stemDown b''16 b ]
+	     }	     
+	     
+	     >
+
+}
diff -purN ../lilypond-1.5.58/input/regression/non-empty-text.ly ./input/regression/non-empty-text.ly
--- ../lilypond-1.5.58/input/regression/non-empty-text.ly	Mon Feb  4 15:59:31 2002
+++ ./input/regression/non-empty-text.ly	Mon May 27 11:21:08 2002
@@ -1,18 +1,22 @@
 \version "1.3.146"
 
 \header{
-texidoc="
+    texidoc="
 Text is set with empty horizontal dimensions.  The boolean property
-textNonEmpty is used to respect the horizontal size of text.
+TextScript.no-spacing-rods is used to control the horizontal size of text.
 "
 }
-\score { \notes {
-c2_"very wide and long text" c | \break
-\fatText  % short for \property Voice.textNonEmpty = ##t
-c_"very wide and long text" c
-}
 
-\paper {
-  linewidth  = 3.\cm
-  }
+\score{
+    \notes{
+	%% \emptyText
+	%% short for \property Voice.TextScript \set #'no-spacing-rods = ##t
+	c2_"very wide and long text" c | \break
+	%% short for \property Voice.TextScript \set #'no-spacing-rods = ##f
+	\fatText
+	c_"very wide and long text" c
+    }
+    \paper {
+	linewidth  = 3.0\cm
+    }
 }
diff -purN ../lilypond-1.5.58/input/test/markup.ly ./input/test/markup.ly
--- ../lilypond-1.5.58/input/test/markup.ly	Mon Feb  4 16:01:22 2002
+++ ./input/test/markup.ly	Fri May 24 15:03:25 2002
@@ -1,43 +1,81 @@
 \version "1.3.146"
 
+\header {
+  texidoc ="Test font selection and scm text markup"
+%% Note that the font-encoding trick only works when uning latex,
+%% ie, you must use ly2dvi.
 
+}
 
-%
-% Test new font selection and scm text markup
-%
 
 \score{
-	\notes\relative c''{
-		\stemUp
-% {
-		a-"text"
-		b-#"texta"
-		c-#'(bold "textb")
+  \notes\relative c''{
+    \stemUp
+				% {
+    a-"text"
+    b-#"texta"
+    c-#'(bold "textb")
 
-		d-#'(lines "one" "two" "three")
-		e-#'(lines (bold "one") 
-		  (columns "and" "there" "is" ((font-family . number) "2"))
-		  (italic "three"))
-		f-#'(finger "3")
-		g-#'(music (named "noteheads-2" "flags-u3"))
-		b-#'(columns "a" (((kern . 3) (raise . 2)) "b") "c")
-		c-#'(columns "1" (((raise . -2) (kern . -1)) "2") "3")
-% }
-	        d-#'(lines "Violoncello" "    e" "Contrabasso")
-	        e-#'((lines (baselineskip . 0) (kern . 1.5)) "Violoncello" "    e" "Contrabasso")
-	        e-#'(((baselineskip . 0) (kern . 1.5) lines) "Violoncello" "    e" "Contrabasso")
-  		g-"ÅÖÄÜÇÕ"
-		}
-	\paper{
-		linewidth = -1.\mm
-	        fontenc = "T1"
-  		\translator{
-			\ScoreContext
-			TextScript \override #'font-family = #'roman
-			TextScript \override #'font-shape = #'upright
-			TextScript \revert #'no-spacing-rods
-			TextScript \override #'direction = #1
-			TextScript \override #'font-encoding = #'T1
-  	}
-	}
+    d-#'(lines "one" "two" "three")
+    e-#'(lines (bold "one") 
+    (columns "and" "there" "is" ((font-family . number) "2"))
+    (italic "three"))
+    f-#'(finger "3")
+    g-#'(music (named "noteheads-2"
+    ((kern . -0.1) "flags-stem")
+    (((kern . -0.1) (raise . 3.5)) "flags-u3"))))
+    b-#'(columns "a" (((kern . 3) (raise . 2)) "b") "c")
+    c-#'(columns "1" (((raise . -2) (kern . -1)) "2") "3")
+				% }
+    d-#'(lines "Violoncello" "    e" "Contrabasso")
+    e-#'((lines (baselineskip . 0) (kern . 1.5)) "Violoncello" "    e" "Contrabasso")
+    e-#'(((baselineskip . 0) (kern . 1.5) lines) "Violoncello" "    e" "Contrabasso")
+    g-"ÅÖÄÜÇÕ"
+    c,,
+    c1 c1
+    
+    \stemUp
+    c4^#'(lines "1" "" "2")
+    c^#'(lines "3" "4" "5")
+    \stemDown
+    c_#'(lines "6" "" "7")
+    c_#'(lines "8" "9" "0")
+    
+    \stemUp
+    c4^#'(lines "1" "")
+    c^#'(lines "2" "3")
+    \stemDown
+    c_#'(lines "" "4")
+    c_#'(lines "5" "6")
+    
+    c^#'(columns "foe" ((raise . 3) "bar"))
+    c^#'(columns "foe" (super "12") (sub "3 4"))
+    c^#'(columns "foe" (super (overstrike "o") "/") (sub "x"))
+    c^#'(columns "foe" (overstrike "o") "/")
+    c^#'(columns "foe" ((bold roman overstrike) "o") "/")
+    c^#'(columns "foe" ((extent . (0 . 0)) "o") "/")
+    c^#'(columns "foo" (super "bar" (super "baz")))
+    c
+    %% c^#`(columns (lines "" ";" "") (lines "1" ((bold) "2") "3"))
+    c^#`(columns (lines "" ";" "") (lines "1" "2" "3"))
+    c^#`(columns (lines "" ";" "") (lines "1" (bold "2") "3"))
+    c^#`(columns (lines "" ";" "") (lines "1" (columns (bold "2")) "3"))
+	
+    
+  }
+  \paper{
+				%linewidth = -1.\mm
+    fontenc = "T1"
+    \translator{
+      \ScoreContext
+      TextScript \override #'font-family = #'roman
+      TextScript \override #'font-shape = #'upright
+      TextScript \revert #'no-spacing-rods
+      TextScript \override #'direction = #1
+      TextScript \override #'font-encoding = #'T1
+    }
+  }
 }
+%%% Local variables:
+%%% LilyPond-indent-level:2
+%%% End:
diff -purN ../lilypond-1.5.58/input/test/tablature.ly ./input/test/tablature.ly
--- ../lilypond-1.5.58/input/test/tablature.ly	Thu Jan  1 01:00:00 1970
+++ ./input/test/tablature.ly	Wed May 29 01:04:42 2002
@@ -0,0 +1,16 @@
+\version "1.3.146"
+
+%{
+
+A sample tablature.
+
+Tablature is done by overriding the note-head formatting function, and
+putting it on a 6-line staff. A special engraver takes care of going
+from string-number + pitch to number.
+
+%}
+
+\score {
+  \notes  \context TabStaff { ces'16-2 d'-2 e'8-2 g'2.-3  c'4-1 c''8-5 b'-5 }
+  
+ }
diff -purN ../lilypond-1.5.58/lily/accidental.cc ./lily/accidental.cc
--- ../lilypond-1.5.58/lily/accidental.cc	Wed May 22 11:49:54 2002
+++ ./lily/accidental.cc	Wed May 22 15:56:28 2002
@@ -110,6 +110,6 @@ Accidental_interface::brew_molecule (SCM
 
 
 
-ADD_INTERFACE(Accidental_interface, "accidental-interface",
+ADD_INTERFACE (Accidental_interface, "accidental-interface",
 	      "a single accidental",
-	      "cautionary-style style tie accidentals");
+	       "cautionary-style style tie accidentals");
diff -purN ../lilypond-1.5.58/lily/afm.cc ./lily/afm.cc
--- ../lilypond-1.5.58/lily/afm.cc	Wed May 22 11:32:06 2002
+++ ./lily/afm.cc	Fri May 24 16:09:06 2002
@@ -84,7 +84,6 @@ int
 Adobe_font_metric::count () const
 {
   return font_inf_->numOfChars ;
-  //  return ascii_to_metric_idx_.size ();
 }
 
 Box
diff -purN ../lilypond-1.5.58/lily/beam.cc ./lily/beam.cc
--- ../lilypond-1.5.58/lily/beam.cc	Sun May 19 02:12:03 2002
+++ ./lily/beam.cc	Fri May 31 00:30:30 2002
@@ -25,7 +25,8 @@
   */
 
 
-
+/* snapnie now also works */
+#define SNAPNIE
 
 #include <math.h> // tanh.
 
@@ -57,7 +58,8 @@
 const int INTER_QUANT_PENALTY = 1000; 
 const int SECONDARY_BEAM_DEMERIT  = 15;
 const int STEM_LENGTH_DEMERIT_FACTOR = 5;
-const int STEM_LENGTH_LIMIT_PENALTY = 500;
+// possibly ridiculous, but too short stems just won't do
+const int STEM_LENGTH_LIMIT_PENALTY = 5000;
 const int DAMPING_DIRECTIION_PENALTY = 800;
 const int MUSICAL_DIRECTION_FACTOR = 400;
 const int IDEAL_SLOPE_FACTOR = 10;
@@ -90,6 +92,9 @@ Beam::get_interbeam (Grob *me)
   return gh_scm2double (s);
 }
 
+/*
+  Maximum multiplicity.
+ */
 int
 Beam::get_multiplicity (Grob *me) 
 {
@@ -166,13 +171,13 @@ Beam::before_line_breaking (SCM smob)
     }
   if (count >= 1)
     {
-      if (!Directional_element_interface::get (me))
-	Directional_element_interface::set (me, get_default_dir (me));
-      
-      consider_auto_knees (me);
-      set_stem_directions (me);
+      Direction d = get_default_dir (me);
+
+      consider_auto_knees (me, d);
+      set_stem_directions (me, d);
       set_stem_shorten (me);
     }
+
   return SCM_EOL;
 }
 
@@ -222,11 +227,10 @@ Beam::get_default_dir (Grob *me) 
    Urg: non-forced should become `without/with unforced' direction,
    once stem gets cleaned-up. */
 void
-Beam::set_stem_directions (Grob *me)
+Beam::set_stem_directions (Grob *me, Direction d)
 {
   Link_array<Item> stems
     =Pointer_group_interface__extract_grobs (me, (Item*) 0, "stems");
-  Direction d = Directional_element_interface::get (me);
   
   for (int i=0; i <stems.size (); i++)
     {
@@ -243,7 +247,7 @@ Beam::set_stem_directions (Grob *me)
   `Forced' stem directions are ignored.  If you don't want auto-knees,
   don't set, or unset auto-knee-gap. */
 void
-Beam::consider_auto_knees (Grob *me)
+Beam::consider_auto_knees (Grob *me, Direction d)
 {
   SCM scm = me->get_grob_property ("auto-knee-gap");
 
@@ -254,7 +258,7 @@ Beam::consider_auto_knees (Grob *me)
       Real staff_space = Staff_symbol_referencer::staff_space (me);
       Real gap = gh_scm2double (scm) / staff_space;
 
-      Direction d = Directional_element_interface::get (me);
+
       Link_array<Item> stems=
 	Pointer_group_interface__extract_grobs (me, (Item*)0, "stems");
       
@@ -338,8 +342,9 @@ Beam::set_stem_shorten (Grob *m)
 
   /* your similar cute comment here */
   shorten_f *= forced_fraction;
-  
-  me->set_grob_property ("shorten", gh_double2scm (shorten_f));
+
+  if (shorten_f)
+    me->set_grob_property ("shorten", gh_double2scm (shorten_f));
 }
 
 /*  Call list of y-dy-callbacks, that handle setting of
@@ -428,8 +433,48 @@ Beam::quanting (SCM smob)
 
   */
 
-  const int REGION_SIZE = 2;
-  for (int i  = -REGION_SIZE ; i < REGION_SIZE; i++)
+
+  
+  /*
+    Do stem computations.  These depend on YL and YR linearly, so we can
+    precompute for every stem 2 factors.
+   */
+  Link_array<Grob> stems=
+    Pointer_group_interface__extract_grobs (me, (Grob*)0, "stems");
+  Array<Stem_info> stem_infos;
+  Array<Real> lbase_lengths;
+  Array<Real> rbase_lengths;  
+
+  Drul_array<bool> dirs_found(0,0);
+  for (int i= 0; i < stems.size(); i++)
+    {
+      Grob*s = stems[i];
+      stem_infos.push (Stem::calc_stem_info (s));
+      dirs_found[stem_infos.top ().dir_] = true;
+
+#ifdef SNAPNIE
+      Real b = calc_stem_y (me, s, Interval (1,0), false);
+      lbase_lengths.push (b);
+
+      Real a = calc_stem_y (me, s, Interval (0,1), false);
+      rbase_lengths.push (a);
+#endif      
+    }
+
+  Direction ldir = Direction (stem_infos[0].dir_);
+  Direction rdir = Direction (stem_infos.top ().dir_);
+  bool knee_b = dirs_found[LEFT] && dirs_found[RIGHT];
+
+  
+  int REGION_SIZE = 2;
+
+  /*
+    Knees are harder, lets try some more possibilities for knees. 
+   */
+  if (knee_b)
+    REGION_SIZE += 2;
+  
+  for (int i = -REGION_SIZE ; i < REGION_SIZE; i++)
     for (int j = 0; j < num_quants; j++)
       {
 	quantsl.push (i + quants[j] + int (yl));
@@ -477,48 +522,17 @@ Beam::quanting (SCM smob)
 	qscores[i].demerits
 	  += score_forbidden_quants (me, qscores[i].yl, qscores[i].yr,
 				     rad, slt, thickness, interbeam,
-				     multiplicity); 
+				     multiplicity, ldir, rdir); 
       }
 
 
-  /*
-    Do stem lengths.  These depend on YL and YR linearly, so we can
-    precompute for every stem 2 factors.
-   */
-  Link_array<Grob> stems=
-    Pointer_group_interface__extract_grobs (me, (Grob*)0, "stems");
-  Array<Stem_info> stem_infos;
-  Array<Real> lbase_lengths;
-  Array<Real> rbase_lengths;  
-
-  Array<int> directions;
-  
-  Drul_array<bool> dirs_found(0,0);
-
-  for (int i= 0; i < stems.size(); i++)
-    {
-      Grob*s = stems[i];
-      stem_infos.push( Stem::calc_stem_info (s));
-
-      Real b = calc_stem_y (me, s, Interval (1,0));
-      lbase_lengths.push (b);
-
-      b = calc_stem_y (me, s, Interval (0,1));
-      rbase_lengths.push (b);
-
-      Direction d = Directional_element_interface::get( s);
-      directions.push( d);
-      dirs_found [d] = true;
-    }
-
-  bool knee_b = dirs_found[LEFT] && dirs_found[RIGHT];
   for (int i = qscores.size (); i--;)
     if (qscores[i].demerits < 100)
       {
 	qscores[i].demerits
 	  += score_stem_lengths (stems, stem_infos,
 				 lbase_lengths, rbase_lengths,
-				 directions, knee_b,
+				 knee_b,
 				 me, qscores[i].yl, qscores[i].yr);
       }
 
@@ -556,32 +570,58 @@ Beam::score_stem_lengths (Link_array<Gro
 			  Array<Stem_info> stem_infos,
 			  Array<Real> left_factor,
 			  Array<Real> right_factor,
-			  Array<int> directions,
 			  bool knee, 
-			  Grob*me, Real yl, Real yr)
+			  Grob*me,
+			  Real yl, Real yr)
 {
   Real demerit_score = 0.0 ;
+  Real pen = STEM_LENGTH_LIMIT_PENALTY;
+  
+#if 0
+  if (knee)
+    pen = sqrt(pen);
+#endif
   
+  Real x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS);
+  Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - x0;
+
   for (int i=0; i < stems.size (); i++)
     {
       Grob* s = stems[i];
       if (Stem::invisible_b (s))
 	continue;
 
+#ifdef SNAPNIE
+      /* for a two-stemmed, interstaff beam knee up/down:
+
+      \score {
+        \context PianoStaff \notes\relative c' <
+          \context Staff = lh {
+            \stemDown [c8 \translator Staff = rh \stemUp a'' ]
+          }
+          \context Staff = rh \relative c' s4
+        >
+      }
+
+	 with yl = -5.8 (about ideal)
+	 and yr = -1 (ridiculous pos)
+	 this yields current_y = -8.1 (about ideal) */
+
       Real current_y =
 	yl * left_factor[i] + right_factor[i]* yr;
+#else
+      Real f = (s->relative_coordinate (0, X_AXIS) - x0) / dx;
+      Real current_y = yl + f * (yr - yl);
+#endif      
 
       Stem_info info = stem_infos[i];
-      Direction d = Direction (directions[i]);
+      Direction d = info.dir_;
 
-      Real pen = STEM_LENGTH_LIMIT_PENALTY;
-      if (knee)
-	pen = sqrt(pen);
+      demerit_score += pen
+	* ( 0 >? (info.dir_ * (info.shortest_y_ - current_y)));
       
-      demerit_score += pen * ( 0 >? (info.min_y - d * current_y));
-      demerit_score += pen * ( 0 >? (d * current_y  - info.max_y));
-
-      demerit_score += STEM_LENGTH_DEMERIT_FACTOR * shrink_extra_weight (d * current_y  - info.ideal_y);
+      demerit_score += STEM_LENGTH_DEMERIT_FACTOR
+	* shrink_extra_weight (d * current_y  - info.dir_ * info.ideal_y_);
     }
 
   demerit_score *= 2.0 / stems.size (); 
@@ -590,7 +630,8 @@ Beam::score_stem_lengths (Link_array<Gro
 }
 
 Real
-Beam::score_slopes_dy (Grob *me, Real yl, Real yr,
+Beam::score_slopes_dy (Grob *me,
+		       Real yl, Real yr,
 		       Real dy_mus, Real dy_damp)
 {
   Real dy = yr - yl;
@@ -602,9 +643,8 @@ Beam::score_slopes_dy (Grob *me, Real yl
     }
 
    dem += MUSICAL_DIRECTION_FACTOR * (0 >? (fabs (dy) - fabs (dy_mus)));
-  
-
    dem += shrink_extra_weight (fabs (dy_damp) - fabs (dy))* IDEAL_SLOPE_FACTOR;
+
    return dem;
 }
 
@@ -620,7 +660,8 @@ Beam::score_forbidden_quants (Grob*me,
 			      Real rad,
 			      Real slt,
 			      Real thickness, Real interbeam,
-			      int multiplicity)
+			      int multiplicity,
+			      Direction ldir, Direction rdir)
 {
   Real dy = yr - yl;
 
@@ -639,11 +680,11 @@ Beam::score_forbidden_quants (Grob*me,
       Real inter = 0.5;
       Real hang = 1.0 - (thickness - slt) / 2;
       
-      Direction dir = Directional_element_interface::get (me);
-      if (fabs (yl - dir * interbeam) < rad
+
+      if (fabs (yl - ldir * interbeam) < rad
 	  && fabs (my_modf (yl) - inter) < 1e-3)
 	dem += SECONDARY_BEAM_DEMERIT;
-      if (fabs (yr - dir * interbeam) < rad
+      if (fabs (yr - rdir * interbeam) < rad
 	  && fabs (my_modf (yr) - inter) < 1e-3)
 	dem += SECONDARY_BEAM_DEMERIT;
 
@@ -660,48 +701,48 @@ Beam::score_forbidden_quants (Grob*me,
 
 
       // hmm, without Interval/Drul_array, you get ~ 4x same code...
-      if (fabs (yl - dir * interbeam) < rad + inter)
+      if (fabs (yl - ldir * interbeam) < rad + inter)
 	{
-	  if (dir == UP && dy <= eps
+	  if (ldir == UP && dy <= eps
 	      && fabs (my_modf (yl) - sit) < eps)
 	    dem += SECONDARY_BEAM_DEMERIT;
 	  
-	  if (dir == DOWN && dy >= eps
+	  if (ldir == DOWN && dy >= eps
 	      && fabs (my_modf (yl) - hang) < eps)
 	    dem += SECONDARY_BEAM_DEMERIT;
 	}
 
-      if (fabs (yr - dir * interbeam) < rad + inter)
+      if (fabs (yr - rdir * interbeam) < rad + inter)
 	{
-	  if (dir == UP && dy >= eps
+	  if (rdir == UP && dy >= eps
 	      && fabs (my_modf (yr) - sit) < eps)
 	    dem += SECONDARY_BEAM_DEMERIT;
 	  
-	  if (dir == DOWN && dy <= eps
+	  if (rdir == DOWN && dy <= eps
 	      && fabs (my_modf (yr) - hang) < eps)
 	    dem += SECONDARY_BEAM_DEMERIT;
 	}
       
       if (multiplicity >= 3)
 	{
-	  if (fabs (yl - 2 * dir * interbeam) < rad + inter)
+	  if (fabs (yl - 2 * ldir * interbeam) < rad + inter)
 	    {
-	      if (dir == UP && dy <= eps
+	      if (ldir == UP && dy <= eps
 		  && fabs (my_modf (yl) - straddle) < eps)
 		dem += SECONDARY_BEAM_DEMERIT;
 	      
-	      if (dir == DOWN && dy >= eps
+	      if (ldir == DOWN && dy >= eps
 		  && fabs (my_modf (yl) - straddle) < eps)
 		dem += SECONDARY_BEAM_DEMERIT;
 	}
 	  
-	  if (fabs (yr - 2 * dir * interbeam) < rad + inter)
+	  if (fabs (yr - 2 * rdir * interbeam) < rad + inter)
 	    {
-	      if (dir == UP && dy >= eps
+	      if (rdir == UP && dy >= eps
 		  && fabs (my_modf (yr) - straddle) < eps)
 		dem += SECONDARY_BEAM_DEMERIT;
 	      
-	      if (dir == DOWN && dy <= eps
+	      if (rdir == DOWN && dy <= eps
 		  && fabs (my_modf (yr) - straddle) < eps)
 		dem += SECONDARY_BEAM_DEMERIT;
 	    }
@@ -727,16 +768,14 @@ Beam::least_squares (SCM smob)
       me->set_grob_property ("positions", ly_interval2scm (pos));
       return SCM_UNSPECIFIED;
     }
-  
-  Direction dir = Directional_element_interface::get (me);
 
-  Interval ideal (Stem::calc_stem_info (first_visible_stem (me)).ideal_y,
-		  Stem::calc_stem_info (last_visible_stem (me)).ideal_y);
+  Interval ideal (Stem::calc_stem_info (first_visible_stem (me)).ideal_y_,
+		  Stem::calc_stem_info (last_visible_stem (me)).ideal_y_);
   
   if (!ideal.delta ())
     {
-      Interval chord (Stem::chord_start_f (first_visible_stem (me)),
-		      Stem::chord_start_f (last_visible_stem (me)));
+      Interval chord (Stem::chord_start_y (first_visible_stem (me)),
+		      Stem::chord_start_y (last_visible_stem (me)));
 
 
       /*
@@ -749,16 +788,18 @@ Beam::least_squares (SCM smob)
       /* Make simple beam on middle line have small tilt */
       if (!ideal[LEFT] && chord.delta () && count == 2)
 	{
-	  Direction d = (Direction) (sign (chord.delta ()) * dir);
-	  pos[d] = gh_scm2double (me->get_grob_property ("thickness")) / 2
-	    * dir;
+
+	  /*
+	    FIXME. -> UP
+	  */
+	  Direction d = (Direction) (sign (chord.delta ()) * UP);
+	  pos[d] = gh_scm2double (me->get_grob_property ("thickness")) / 2;
+	  //	  	    * dir;
 	  pos[-d] = - pos[d];
 	}
       else
 	{
 	  pos = ideal;
-	  pos[LEFT] *= dir ;
-	  pos[RIGHT] *= dir ;
 	}
     }
   else
@@ -776,7 +817,7 @@ Beam::least_squares (SCM smob)
 	  if (Stem::invisible_b (s))
 	    continue;
 	  ideals.push (Offset (s->relative_coordinate (0, X_AXIS) - x0,
-			       Stem::calc_stem_info (s).ideal_y));
+			       Stem::calc_stem_info (s).ideal_y_));
 	}
       Real y; 
       Real dydx;
@@ -784,9 +825,9 @@ Beam::least_squares (SCM smob)
 
       Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - x0;
       Real dy = dydx * dx;
-      me->set_grob_property ("least-squares-dy", gh_double2scm (dy * dir));
+      me->set_grob_property ("least-squares-dy", gh_double2scm (dy));
 
-      pos = Interval (y*dir, (y+dy) * dir);
+      pos = Interval (y, (y+dy));
     }
 
   me->set_grob_property ("positions", ly_interval2scm (pos));
@@ -831,16 +872,16 @@ Beam::check_concave (SCM smob)
          == Stem::get_direction(stems[0]))
     {
       Real r1 = gh_scm2double (gap);
-      Real dy = Stem::chord_start_f (stems.top ())
-	- Stem::chord_start_f (stems[0]);
+      Real dy = Stem::chord_start_y (stems.top ())
+	- Stem::chord_start_y (stems[0]);
 
       
       Real slope = dy / (stems.size () - 1);
       
-      Real y0 = Stem::chord_start_f (stems[0]);
+      Real y0 = Stem::chord_start_y (stems[0]);
       for (int i = 1; i < stems.size () - 1; i++)
 	{
-	  Real c = (Stem::chord_start_f (stems[i]) - y0) - i * slope;
+	  Real c = (Stem::chord_start_y (stems[i]) - y0) - i * slope;
 	  if (c > r1)
 	    {
 	      concaveness1 = true;
@@ -851,41 +892,54 @@ Beam::check_concave (SCM smob)
 
     
   /* Concaveness #2: Sum distances of inner noteheads that fall
-     outside the interval of the two outer noteheads */
+     outside the interval of the two outer noteheads.
+
+     We only do this for beams where first and last stem have the same
+     direction. --hwn.
+
+
+     Note that "convex" stems compensate for "concave" stems.
+     (is that intentional?) --hwn.
+  */
+  
   Real concaveness2 = 0;
   SCM thresh = me->get_grob_property ("concaveness-threshold");
   Real r2 = infinity_f;
-  if (!concaveness1 && gh_number_p (thresh))
+  if (!concaveness1 && gh_number_p (thresh)
+      && Stem::get_direction(stems.top ())
+         == Stem::get_direction(stems[0]))
     {
       r2 = gh_scm2double (thresh);
-      
-      Direction dir = Directional_element_interface::get (me);  
 
+      Direction dir = Stem::get_direction(stems.top ());
       Real concave = 0;
-      Interval iv (Stem::chord_start_f (stems[0]),
-		   Stem::chord_start_f (stems.top ()));
+      Interval iv (Stem::chord_start_y (stems[0]),
+		   Stem::chord_start_y (stems.top ()));
       
       if (iv[MAX] < iv[MIN])
 	iv.swap ();
       
       for (int i = 1; i < stems.size () - 1; i++)
 	{
-	  Real c = 0;
-	  Real f = Stem::chord_start_f (stems[i]);
-	  if ((c = f - iv[MAX]) > 0)
-	    concave += c;
-	  else if ((c = f - iv[MIN]) < 0)
-	    concave += c;
+	  Real f = Stem::chord_start_y (stems[i]);
+	  concave += ((f - iv[MAX] ) >? 0) +
+	    ((f - iv[MIN] ) <? 0);
 	}
-      /*
-	Ugh. This will mess up with knees. Direction should be
-	determined per stem.
-       */
       concave *= dir;
-
       concaveness2 = concave / (stems.size () - 2);
-      /* ugh: this is the a kludge to get input/regression/beam-concave.ly
-	 to behave as baerenreiter. */
+      
+      /* ugh: this is the a kludge to get
+	 input/regression/beam-concave.ly to behave as
+	 baerenreiter. */
+
+      /*
+	huh? we're dividing twice (which is not scalable) meaning that
+	the longer the beam, the more unlikely it will be
+	concave. Maybe you would even expect the other way around??
+
+	--hwn.
+	
+       */
       concaveness2 /= (stems.size () - 2);
     }
   
@@ -939,36 +993,72 @@ Beam::slope_damping (SCM smob)
 /*
   Calculate the Y position of the stem-end, given the Y-left, Y-right
   in POS, and for stem S.
+
+  If CORRECT, correct for multiplicity of beam in case of knees.
  */
 Real
-Beam::calc_stem_y (Grob *me, Grob* s, Interval pos)
+Beam::calc_stem_y (Grob *me, Grob* s, Interval pos, bool correct)
 {
   int beam_multiplicity = get_multiplicity (me);
   int stem_multiplicity = (Stem::duration_log (s) - 2) >? 0;
+  
+  int first_multiplicity = (Stem::duration_log (first_visible_stem (me))
+			    - 2) >? 0;
+  int last_multiplicity = (Stem::duration_log (last_visible_stem (me))
+			   - 2) >? 0;
 
   Real thick = gh_scm2double (me->get_grob_property ("thickness"));
   Real interbeam = get_interbeam (me);
 
   // ugh -> use commonx
-  Real x0 = first_visible_stem (me)->relative_coordinate (0, X_AXIS);
-  Real dx = last_visible_stem (me)->relative_coordinate (0, X_AXIS) - x0;
+  Grob * fvs = first_visible_stem (me);
+  Grob *lvs = last_visible_stem (me);
+    
+  Real x0 = fvs ? fvs->relative_coordinate (0, X_AXIS) : 0.0;
+  Real dx = fvs ? lvs->relative_coordinate (0, X_AXIS) - x0 : 0.0;
+  Real r = s->relative_coordinate (0, X_AXIS) - x0;
   Real dy = pos.delta ();
   Real stem_y = (dy && dx
-		 ? (s->relative_coordinate (0, X_AXIS) - x0) / dx
+		 ? r / dx
 		 * dy
 		 : 0) + pos[LEFT];
 
-  /* knee */
-  Direction dir  = Directional_element_interface::get (me);
-  Direction sdir = Directional_element_interface::get (s);
-  
-  /* knee */
-  if (dir!= sdir)
+  Direction my_dir = Directional_element_interface::get (s);
+  Direction first_dir = fvs? Directional_element_interface::get (fvs) : my_dir;
+
+  if (correct && my_dir != first_dir)
     {
-      stem_y -= dir * (thick / 2 + (beam_multiplicity - 1) * interbeam);
+      /*
+	WTF is happening here ?
+
+	 It looks as if this is some kind of fixup for multiple kneed
+	 beams to get a piece of stem at the #.
+	 
+
+                x
+	        |
+         =======|
+	 |======#
+	 |
+	 |
+	x 
+
+	Rules for this kind of stuff are hairy. In any event, the
+	current stem should look at the multiplicity of its
+	predecessor.
+
+	--hwn.
+	
+       */
+      
+      // FIXME, hairy stuff
+      stem_y += my_dir * (thick / 2 + (beam_multiplicity - 1) * interbeam);
 
       // huh, why not for first visible?
 
+      /*
+	What the heck is happening here?? 
+       */
       Grob *last_visible = last_visible_stem (me);
       if (last_visible)
 	{
@@ -980,7 +1070,6 @@ Beam::calc_stem_y (Grob *me, Grob* s, In
       else
 	programming_error ("No last visible stem");
     }
-
   return stem_y;
 }
 
@@ -1002,23 +1091,32 @@ Beam::set_stem_lengths (Grob *me)
     if (!Stem::invisible_b (stems[i]))
       common = common->common_refpoint (stems[i], Y_AXIS);
 
-  Direction dir = Directional_element_interface::get (me);
   Interval pos = ly_scm2interval (me->get_grob_property ("positions"));
   Real staff_space = Staff_symbol_referencer::staff_space (me);
+
+  /*
+    DOCUMENT THIS.
+   */
+#if 0
   Real thick = gh_scm2double (me->get_grob_property ("thickness"));
+  Direction dir = Directional_element_interface::get (me);
   bool ps_testing = to_boolean (ly_symbol2scm ("ps-testing"));
+#endif
+  
   for (int i=0; i < stems.size (); i++)
     {
       Item* s = stems[i];
       if (Stem::invisible_b (s))
 	continue;
 
-      Real stem_y = calc_stem_y (me, s, pos);
+      Real stem_y = calc_stem_y (me, s, pos, true);
 
+#if 0
       // doesn't play well with dvips
       if (ps_testing)
 	if (Stem::get_direction (s) == dir)
 	  stem_y += Stem::get_direction (s) * thick / 2;
+#endif
       
       /* caution: stem measures in staff-positions */
       Real id = me->relative_coordinate (common, Y_AXIS)
@@ -1057,7 +1155,12 @@ Beam::set_beaming (Grob *me, Beaming_inf
 /*
   beams to go with one stem.
 
-  FIXME: clean me up.
+  FIXME: clean me up:
+
+  The beam should be constructed by one function that knows where the
+  X and Y points are, and only inspects the stems to obtain
+  multiplicity and stem directions.
+  
   */
 Molecule
 Beam::stem_beams (Grob *me, Item *here, Item *next, Item *prev, Real dydx)
@@ -1080,21 +1183,18 @@ Beam::stem_beams (Grob *me, Item *here, 
   Real nw_f;
   if (!Stem::first_head (here))
     nw_f = 0;
-  else {
-    int t = Stem::type_i (here); 
-
-    SCM proc = me->get_grob_property ("flag-width-function");
-    SCM result = gh_call1 (proc, gh_int2scm (t));
-    nw_f = gh_scm2double (result);
-  }
+  else
+    {
+      int t = Stem::duration_log (here); 
 
+      SCM proc = me->get_grob_property ("flag-width-function");
+      SCM result = gh_call1 (proc, gh_int2scm (t));
+      nw_f = gh_scm2double (result);
+    }
 
-  Direction dir = Directional_element_interface::get (me);
 
   /* [Tremolo] beams on whole notes may not have direction set? */
- if (dir == CENTER)
-    dir = Directional_element_interface::get (here);
-
+  Direction dir = Directional_element_interface::get (here);
 
   /* half beams extending to the left. */
   if (prev)
@@ -1194,8 +1294,6 @@ Beam::stem_beams (Grob *me, Item *here, 
     }
   leftbeams.add_molecule (rightbeams);
 
-  /* Does beam quanting think  of the asymetry of beams? 
-     Refpoint is on bottom of symbol. (FIXTHAT) --hwn. */
   return leftbeams;
 }
 
@@ -1236,15 +1334,20 @@ Beam::brew_molecule (SCM smob)
   Real dy = pos.delta ();
   Real dydx = dy && dx ? dy/dx : 0;
 
+
   for (int i=0; i < stems.size (); i++)
     {
       Item *item = stems[i];
       Item *prev = (i > 0)? stems[i-1] : 0;
       Item *next = (i < stems.size ()-1) ? stems[i+1] :0;
 
+
+      
       Molecule sb = stem_beams (me, item, next, prev, dydx);
       Real x = item->relative_coordinate (0, X_AXIS) - x0;
       sb.translate (Offset (x, x * dydx + pos[LEFT]));
+
+
       mol.add_molecule (sb);
     }
   
@@ -1293,7 +1396,7 @@ Beam::forced_stem_count (Grob *me) 
       if (Stem::invisible_b (s))
 	continue;
 
-      if (((int)Stem::chord_start_f (s)) 
+      if (((int)Stem::chord_start_y (s)) 
         && (Stem::get_direction (s) != Stem::get_default_dir (s)))
         f++;
     }
@@ -1435,5 +1538,6 @@ the ideal slope, how close the result is
 take the best scoring combination.
 
 ",
-  "position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy direction damping flag-width-function neutral-direction positions space-function thickness");
+  "position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap chord-tremolo beamed-stem-shorten shorten least-squares-dy damping flag-width-function neutral-direction positions space-function thickness");
+
 
diff -purN ../lilypond-1.5.58/lily/chord-tremolo-engraver.cc ./lily/chord-tremolo-engraver.cc
--- ../lilypond-1.5.58/lily/chord-tremolo-engraver.cc	Sun May  5 15:44:49 2002
+++ ./lily/chord-tremolo-engraver.cc	Fri May 24 15:03:25 2002
@@ -169,9 +169,9 @@ Chord_tremolo_engraver::acknowledge_grob
 	  Stem::set_beaming (s, f, RIGHT);
 	  
  	  SCM d = s->get_grob_property ("direction");
-	  if (Stem::type_i (s) != 1)
+	  if (Stem::duration_log (s) != 1)
 	    {
-	      int gap_i =Stem::duration_log (s) - ((Stem::type_i (s) >? 2) - 2);
+	      int gap_i =Stem::duration_log (s) - ((Stem::duration_log (s) >? 2) - 2);
 	      beam_p_->set_grob_property ("gap", gh_int2scm (gap_i));
 	    }
 	  s->set_grob_property ("direction", d);
diff -purN ../lilypond-1.5.58/lily/fingering-engraver.cc ./lily/fingering-engraver.cc
--- ../lilypond-1.5.58/lily/fingering-engraver.cc	Wed Apr 10 19:25:36 2002
+++ ./lily/fingering-engraver.cc	Mon May 27 11:21:10 2002
@@ -198,13 +198,6 @@ Fingering_engraver::make_script (Directi
     }
   
   fingering->set_grob_property ("text", r->get_mus_property ("text"));
-  
-  SCM nonempty = get_property ("textNonEmpty");
-  if (to_boolean (nonempty))
-    /*
-      empty fingering: signal that no rods should be applied.  
-    */
-    fingering->set_grob_property ("no-spacing-rods" , SCM_BOOL_F);
 		
   announce_grob (fingering, r->self_scm());
   fingerings_.push (fingering);
@@ -243,5 +236,5 @@ ENTER_DESCRIPTION(Fingering_engraver,
 /* descr */       "Create fingering-scripts",
 /* creats*/       "Fingering",
 /* acks  */       "rhythmic-head-interface stem-interface",
-/* reads */       "scriptHorizontal textNonEmpty",
+/* reads */       "scriptHorizontal",
 /* write */       "");
diff -purN ../lilypond-1.5.58/lily/include/beam.hh ./lily/include/beam.hh
--- ../lilypond-1.5.58/lily/include/beam.hh	Sun May 19 02:12:08 2002
+++ ./lily/include/beam.hh	Fri May 31 00:29:29 2002
@@ -39,11 +39,11 @@ public:
   static Real score_slopes_dy (Grob*, Real,Real,Real,Real);
   static Real score_stem_lengths (Link_array<Grob>,
 				  Array<Stem_info>,
-				  Array<Real>, Array<Real>, Array<int>,
+				  Array<Real>, Array<Real>, 
 				  bool,Grob*,Real , Real);
   static Real score_forbidden_quants (Grob*, Real, Real,
 				      Real, Real, Real, Real,
-				      int);
+				      int, Direction, Direction);
   
   
   static Molecule stem_beams (Grob*,Item *here, Item *next, Item *prev,
@@ -51,10 +51,10 @@ public:
 
 private:
   static Direction get_default_dir (Grob*);
-  static void set_stem_directions (Grob*);
-  static void consider_auto_knees (Grob*);
+  static void set_stem_directions (Grob*, Direction );
+  static void consider_auto_knees (Grob*, Direction d);
   static void set_stem_shorten (Grob*);
-  static Real calc_stem_y (Grob*, Grob* s, Interval pos);
+  static Real calc_stem_y (Grob*, Grob* s, Interval pos, bool correct);
   static void set_stem_lengths (Grob*);
   static int forced_stem_count (Grob*);
 };
diff -purN ../lilypond-1.5.58/lily/include/stem-info.hh ./lily/include/stem-info.hh
--- ../lilypond-1.5.58/lily/include/stem-info.hh	Tue Mar 19 00:34:00 2002
+++ ./lily/include/stem-info.hh	Thu May 30 12:37:57 2002
@@ -15,15 +15,12 @@
 /*
   Parameters for a stem, (multiply with stemdirection, to get real values
   for a downstem.)
-  
  */
 struct Stem_info 
 {
-  Real ideal_y;
-
-  // fixme: we're an Interval!
-  Real min_y;
-  Real max_y;
+  Direction dir_;
+  Real ideal_y_;
+  Real shortest_y_;
 };
 
 #endif // STEM_INFO_HH
diff -purN ../lilypond-1.5.58/lily/include/stem.hh ./lily/include/stem.hh
--- ../lilypond-1.5.58/lily/include/stem.hh	Tue Apr 23 11:51:08 2002
+++ ./lily/include/stem.hh	Wed May 29 11:05:19 2002
@@ -23,13 +23,13 @@ public:
   static void set_beaming (Grob*,int,  Direction d);
   static Grob * beam_l (Grob*);
   static Grob * first_head (Grob*) ;
+  static Grob * last_head  (Grob*) ;
   static Drul_array<Grob*> extremal_heads (Grob*);
   static Grob * support_head (Grob*) ;
   static void add_head (Grob*me, Grob*n);
   static Stem_info calc_stem_info (Grob *) ;
-  static Real chord_start_f (Grob *) ;
+  static Real chord_start_y (Grob *) ;
   static Direction get_direction (Grob*) ;
-  static int type_i (Grob *) ;
   static void set_stemend (Grob *,Real);
   static Direction get_default_dir (Grob *) ;
 
diff -purN ../lilypond-1.5.58/lily/mark-engraver.cc ./lily/mark-engraver.cc
--- ../lilypond-1.5.58/lily/mark-engraver.cc	Wed Apr 10 19:30:34 2002
+++ ./lily/mark-engraver.cc	Wed May 22 15:59:06 2002
@@ -57,7 +57,7 @@ void
 Mark_engraver::acknowledge_grob (Grob_info inf)
 {
   Grob * s = inf.grob_l_;
- if (text_p_ && Bar_line::has_interface (s))
+  if (text_p_ && Bar_line::has_interface (s))
     {
       /*
 	Ugh. Figure out how to do this right at beginning of line, (without
diff -purN ../lilypond-1.5.58/lily/pitch.cc ./lily/pitch.cc
--- ../lilypond-1.5.58/lily/pitch.cc	Sun May 19 02:12:06 2002
+++ ./lily/pitch.cc	Wed May 29 11:05:18 2002
@@ -348,9 +348,16 @@ LY_DEFINE(pitch_semitones,  "pitch-semit
 	  "calculate the number of semitones of @var{p} from central C.")
 {
   Pitch *p = unsmob_pitch (pp);
-   SCM_ASSERT_TYPE(p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
+  SCM_ASSERT_TYPE(p, pp, SCM_ARG1, __FUNCTION__, "Pitch");
  
-  int q = p->steps ();
+  int q = p->semitone_pitch ();
+  
+  // Was :
+  //
+  //int q = p->steps ();
+  //
+  // As the function is called "pitch_semitones", I assume it was a mistake !
+  // Jiba
 
   return gh_int2scm (q);
 }
diff -purN ../lilypond-1.5.58/lily/slur.cc ./lily/slur.cc
--- ../lilypond-1.5.58/lily/slur.cc	Sat May  4 14:57:28 2002
+++ ./lily/slur.cc	Fri May 24 15:03:26 2002
@@ -329,7 +329,7 @@ Slur::get_attachment (Grob *me, Directio
 	    }
 	  else if (str == "alongside-stem")
 	    {
-	      o = Offset (0, Stem::chord_start_f (stem));
+	      o = Offset (0, Stem::chord_start_y (stem));
 	      /*
 		Default position is on stem X, on outer side of head Y
 	       */
diff -purN ../lilypond-1.5.58/lily/staff-symbol.cc ./lily/staff-symbol.cc
--- ../lilypond-1.5.58/lily/staff-symbol.cc	Wed Apr 17 13:37:21 2002
+++ ./lily/staff-symbol.cc	Mon May 27 11:21:11 2002
@@ -35,8 +35,7 @@ Staff_symbol::brew_molecule (SCM smob)
   SCM width_scm = me->get_grob_property ("width");
   if (gh_number_p (width_scm)) // user-defined width
     {
-      width =
-	gh_scm2double (width_scm) *
+      width = gh_scm2double (width_scm) *
 	Staff_symbol_referencer::staff_space (me);
     }
   else // determine width automatically
diff -purN ../lilypond-1.5.58/lily/stem-tremolo.cc ./lily/stem-tremolo.cc
--- ../lilypond-1.5.58/lily/stem-tremolo.cc	Sat May  4 14:57:28 2002
+++ ./lily/stem-tremolo.cc	Fri May 24 15:03:26 2002
@@ -21,8 +21,6 @@
   TODO:
     lengthen stem if necessary
  */
-
-
 MAKE_SCHEME_CALLBACK (Stem_tremolo,dim_callback,2);
 
 /*
@@ -49,7 +47,11 @@ Stem_tremolo::height (SCM smob, SCM ax)
   assert (a == Y_AXIS);
 
   SCM mol = me->get_uncached_molecule ();
-  return ly_interval2scm (unsmob_molecule (mol)->extent (a));
+
+  if (Molecule *m = unsmob_molecule (mol))
+    return ly_interval2scm (m->extent (a));
+  else
+    return ly_interval2scm (Interval());
 }
 
 
@@ -87,14 +89,24 @@ Stem_tremolo::brew_molecule (SCM smob)
   Molecule a (Lookup::beam (dydx, width, thick));
   a.translate (Offset (-width/2, width / 2 * dydx));
   
-  int tremolo_flags;
+  int tremolo_flags = 0;
   SCM s = me->get_grob_property ("flag-count");
   if (gh_number_p (s))
     tremolo_flags = gh_scm2int (s);
-  else
-    // huh?
-    tremolo_flags = 1;
 
+  if (!tremolo_flags)
+    {
+      programming_error ("No tremolo flags?");
+
+      me->suicide();
+      return SCM_EOL;
+    }
+
+  /*
+    Who the fuck is 0.81 ?
+
+    --hwn.
+   */
   Real interbeam = beam ? Beam::get_interbeam (beam) : 0.81;
 
   Molecule mol; 
@@ -104,27 +116,47 @@ Stem_tremolo::brew_molecule (SCM smob)
       b.translate_axis (interbeam * i, Y_AXIS);
       mol.add_molecule (b);
     }
-  if (tremolo_flags)
-    mol.translate_axis (-mol.extent (Y_AXIS).center (), Y_AXIS);
-  if (beam)
+  Direction stemdir = Stem::get_direction (stem);
+  Interval mol_ext = mol.extent (Y_AXIS);
+
+  // ugh, rather calc from Stem_tremolo_req
+  int beams_i = (beam)
+    ? (Stem::beam_count (stem, RIGHT) >? Stem::beam_count (stem, LEFT))
+    : 0;
+  
+  Real beamthickness = 0.0;
+  SCM sbt = (beam) ? beam->get_grob_property ("thickness") : SCM_EOL ;
+  if (gh_number_p (sbt))
     {
-      // ugh, rather calc from Stem_tremolo_req
-      int beams_i = Stem::beam_count (stem, RIGHT)
-	>? Stem::beam_count (stem, LEFT);
-      mol.translate (Offset (0,
-			     Stem::stem_end_position (stem) * ss / 2 - 
-			     Directional_element_interface::get (beam)
-			     * beams_i * interbeam));
+      beamthickness = gh_scm2double (sbt) * ss;
     }
-  else
-    {  
-      /*
-	Beams should intersect one beamthickness below stem end
-      */
-      Real dy = Stem::stem_end_position (stem) * ss / 2;
-      dy -= mol.extent (Y_AXIS).length () / 2 *  Stem::get_direction (stem);
 
-      mol.translate (Offset (0, dy));
+  Real end_y
+    = Stem::stem_end_position (stem) *ss/2 
+    - stemdir * (beams_i * beamthickness
+		 + ((beams_i -1) >? 0) * interbeam);
+
+  /*
+    the 0.33 ss is to compensate for the size of the note head
+   */
+  Real chord_start_y = Stem::chord_start_y (stem) +
+    0.33 * ss * stemdir;
+
+  Real padding = interbeam;
+
+  /*
+    if there is not enough space, center on remaining space,
+    else one beamspace away from stem end.
+   */
+  if (stemdir * (end_y - chord_start_y) - 2*padding - mol_ext.length ()  < 0.0)
+    {
+      mol.translate_axis ((end_y + chord_start_y) /2.0  - mol_ext.center (),Y_AXIS);
+    }
+  else
+    {
+      mol.translate_axis (end_y - stemdir * interbeam
+			  -mol_ext [stemdir]
+			  , Y_AXIS);
     }
   
   return mol.smobbed_copy ();
diff -purN ../lilypond-1.5.58/lily/stem.cc ./lily/stem.cc
--- ../lilypond-1.5.58/lily/stem.cc	Tue May 21 00:05:06 2002
+++ ./lily/stem.cc	Fri May 31 00:29:28 2002
@@ -7,6 +7,10 @@
     Jan Nieuwenhuizen <janneke@gnu.org>
 
   TODO: This is way too hairy
+
+  TODO: fix naming.
+
+  Stem-end, chord-start, etc. is all confusing naming.
 */
 
 #include <math.h>		// rint
@@ -70,7 +74,7 @@ Stem::head_positions (Grob*me) 
 
 
 Real
-Stem::chord_start_f (Grob*me) 
+Stem::chord_start_y (Grob*me) 
 {
   return head_positions (me)[get_direction (me)]
     * Staff_symbol_referencer::staff_space (me)/2.0;
@@ -119,11 +123,6 @@ Stem::set_stemend (Grob*me, Real se)
   me->set_grob_property ("stem-end-position", gh_double2scm (se));
 }
 
-int
-Stem::type_i (Grob*me) 
-{
-  return first_head (me) ?  Note_head::balltype_i (first_head (me)) : 2;
-}
 
 /*
   Note head that determines hshift for upstems
@@ -167,6 +166,18 @@ Stem::first_head (Grob*me)
 }
 
 /*
+  The note head opposite to the first head.
+ */
+Grob*
+Stem::last_head (Grob*me)
+{
+  Direction d = get_direction (me);
+  if (!d)
+    return 0;
+  return extremal_heads (me)[d];
+}
+
+/*
   START is part where stem reaches `last' head. 
  */
 Drul_array<Grob*>
@@ -296,7 +307,7 @@ Stem::get_default_stem_end_position (Gro
   Real shorten_f = a[ ((duration_log (me) - 2) >? 0) <? (a.size () - 1)] * 2;
 
   /* On boundary: shorten only half */
-  if (abs (chord_start_f (me)) == 0.5)
+  if (abs (chord_start_y (me)) == 0.5)
     shorten_f *= 0.5;
 
   /* URGURGURG
@@ -311,7 +322,7 @@ Stem::get_default_stem_end_position (Gro
   
   /* stems in unnatural (forced) direction should be shortened, 
     according to [Roush & Gourlay] */
-  if (chord_start_f (me)
+  if (chord_start_y (me)
       && (get_direction (me) != get_default_dir (me)))
     length_f -= shorten_f;
 
@@ -611,7 +622,27 @@ Stem::brew_molecule (SCM smob) 
   Direction d = get_direction (me);
   
   
-  Real y1 = Staff_symbol_referencer::position_f (first_head (me));
+     
+  Real y1;
+
+  /*
+    This is required to avoid stems passing in tablature chords...
+   */
+
+
+  /*
+    TODO: make  the stem start a direction ?
+    
+  */
+  if (to_boolean (me->get_grob_property ("avoid-note-head")))
+    {
+      y1 = Staff_symbol_referencer::position_f (last_head (me));
+    }
+  else
+    {
+      y1 = Staff_symbol_referencer::position_f (first_head (me));
+    }
+  
   Real y2 = stem_end_position (me);
   
   Interval stem_y (y1 <? y2,y2 >? y1);
@@ -725,41 +756,30 @@ Stem::calc_stem_info (Grob*me) 
     {
       Stem_info si ;
 
-      si.ideal_y = gh_scm2double (gh_car (scm_info)); 
-      si.max_y = gh_scm2double (gh_cadr (scm_info)); 
-      si.min_y = gh_scm2double (gh_caddr (scm_info));
+      si.dir_ = Directional_element_interface::get(me); 
+      si.ideal_y_ = gh_scm2double (gh_car (scm_info)); 
+      si.shortest_y_ = gh_scm2double (gh_cadr (scm_info));
 
       return si;
     }
-    
-  Grob * beam = beam_l (me);
-
-  Direction beam_dir = Directional_element_interface::get (beam);
-  if (!beam_dir)
-    {
-      programming_error ("Beam dir not set.");
-      beam_dir = UP;
-    }
-    
 
+  Direction mydir = Directional_element_interface::get (me);
   Real staff_space = Staff_symbol_referencer::staff_space (me);
   Real half_space = staff_space / 2;
-  
+
+  Grob * beam = beam_l (me);
   int multiplicity = Beam::get_multiplicity (beam);
   Real interbeam_f = Beam::get_interbeam (beam);
 
   Real thick = gh_scm2double (beam->get_grob_property ("thickness"));
-  Stem_info info; 
-  info.ideal_y = chord_start_f (me);
-
-  // for simplicity, we calculate as if dir == UP
-
-  /*
-    UGH. This confuses issues more. fixme. --hwn
-   */
-  info.ideal_y *= beam_dir;
+  
+  Real ideal_y = chord_start_y (me);
+  
+  /* from here on, calculate as if dir == UP */
+  ideal_y *= mydir;
+  
   SCM grace_prop = me->get_grob_property ("grace");
-
+  
   bool grace_b = to_boolean (grace_prop);
   
   Array<Real> a;
@@ -780,84 +800,75 @@ Stem::calc_stem_info (Grob*me) 
 
   Real stem_length =  a[multiplicity <? (a.size () - 1)] * staff_space;
 
+  Direction first_dir = Directional_element_interface::get
+    (Beam::first_visible_stem (beam));
 
-  /*
-    This sucks -- On a kneed beam, *all* stems are kneed, not half of them.
-   */
-  if (!beam_dir || (beam_dir == Directional_element_interface::get (me)))
-    /* normal beamed stem */
-    {
-      if (multiplicity)
-	{
-	  info.ideal_y += thick + (multiplicity - 1) * interbeam_f;
-	}
-      info.min_y = info.ideal_y;
-      info.max_y = 1000;  // INT_MAX;
+  // FIXME, hairy.  see beam::calc_stem_y, for knees it's not trival
+  // to calculate where secondary, ternary beams will go.
+  if (multiplicity && first_dir == mydir)
+    ideal_y += thick + (multiplicity - 1) * interbeam_f;
+  
+  Real shortest_y = ideal_y; 
 
-      info.ideal_y += stem_length;
-      info.min_y += minimum_length;
+  ideal_y += stem_length;
+  shortest_y += minimum_length;
 
-      /*
-	lowest beam of (UP) beam must never be lower than second staffline
+  /*
+    lowest beam of (UP) beam must never be lower than second staffline
 
-	Hmm, reference (Wanske?)
+    Hmm, reference (Wanske?)
 
-	Although this (additional) rule is probably correct,
-	I expect that highest beam (UP) should also never be lower
-	than middle staffline, just as normal stems.
+    Although this (additional) rule is probably correct,
+    I expect that highest beam (UP) should also never be lower
+    than middle staffline, just as normal stems.
 	
-      */
-      bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
-      if (!grace_b && !no_extend_b)
-	{
-	  /* highest beam of (UP) beam must never be lower than middle
-	     staffline
-	     lowest beam of (UP) beam must never be lower than second staffline
-	   */
-	  info.min_y =
-	    info.min_y >? 0
-	    >? (- 2 * half_space - thick
-		+ (multiplicity > 0) * thick
-		+ interbeam_f * (multiplicity - 1));
-	}
-    }
-  else
-    /* knee */
+  */
+  bool no_extend_b = to_boolean (me->get_grob_property ("no-stem-extend"));
+  if (!grace_b && !no_extend_b)
     {
-      info.ideal_y -= thick + stem_length;
-      info.max_y = info.ideal_y - minimum_length;
-
-      /*
-	We shouldn't invert the stems, so we set minimum at 0. 
-       */
-      info.min_y = 0.5;
+      /* highest beam of (UP) beam must never be lower than middle
+	 staffline
+	 lowest beam of (UP) beam must never be lower than second staffline
+      */
+      shortest_y =
+	shortest_y >? 0
+	>? (- 2 * half_space - thick
+	    + (multiplicity > 0) * thick
+	    + interbeam_f * (multiplicity - 1));
     }
+    
   
-  info.ideal_y = (info.max_y <? info.ideal_y) >? info.min_y;
+  ideal_y = ideal_y >? shortest_y;
 
   s = beam->get_grob_property ("shorten");
   if (gh_number_p (s))
-    info.ideal_y -= gh_scm2double (s);
+    ideal_y -= gh_scm2double (s);
 
   Grob *common = me->common_refpoint (beam, Y_AXIS);
-  Real interstaff_f = beam_dir *
+  Real interstaff_f = mydir *
     (me->relative_coordinate (common, Y_AXIS)
      - beam->relative_coordinate (common, Y_AXIS));
   
-  info.ideal_y += interstaff_f;
-  info.min_y += interstaff_f;
-  info.max_y += interstaff_f ;
+  ideal_y += interstaff_f;
+  shortest_y += interstaff_f;
 
+  ideal_y *= mydir;
+  shortest_y *= mydir; 
+  
   me->set_grob_property ("stem-info",
-			 scm_list_n (gh_double2scm (info.ideal_y),
-				     gh_double2scm (info.max_y),
-				     gh_double2scm (info.min_y),
+			 scm_list_n (gh_double2scm (ideal_y),
+				     gh_double2scm (shortest_y),
 				     SCM_UNDEFINED));
+
+  Stem_info si;
+  si.dir_ = mydir;
+  si.shortest_y_ = shortest_y;
+  si.ideal_y_ = ideal_y;
   
-  return info;
+  return si;
 }
 
 ADD_INTERFACE (Stem,"stem-interface",
   "A stem",
-  "adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head note-heads direction length style no-stem-extend flag-style dir-forced");
+  "avoid-note-head adjust-if-on-staffline thickness stem-info beamed-lengths beamed-minimum-lengths lengths beam stem-shorten duration-log beaming neutral-direction stem-end-position support-head note-heads direction length style no-stem-extend flag-style dir-forced");
 
diff -purN ../lilypond-1.5.58/lily/tab-note-heads-engraver.cc ./lily/tab-note-heads-engraver.cc
--- ../lilypond-1.5.58/lily/tab-note-heads-engraver.cc	Thu Jan  1 01:00:00 1970
+++ ./lily/tab-note-heads-engraver.cc	Wed May 29 01:10:42 2002
@@ -0,0 +1,156 @@
+/*
+  head-grav.cc -- part of GNU LilyPond
+
+  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+#include <ctype.h>
+#include <stdio.h>
+
+#include "rhythmic-head.hh"
+#include "paper-def.hh"
+#include "musical-request.hh"
+#include "dots.hh"
+#include "dot-column.hh"
+#include "staff-symbol-referencer.hh"
+#include "item.hh"
+#include "score-engraver.hh"
+#include "warn.hh"
+
+/**
+  make (guitar-like) tablature note
+ */
+class Tab_note_heads_engraver : public Engraver
+{
+  Link_array<Item> note_p_arr_;
+  
+  Link_array<Item> dot_p_arr_;
+  Link_array<Note_req> note_req_l_arr_;
+  Link_array<Text_script_req> tabstring_req_arr_;
+public:
+  TRANSLATOR_DECLARATIONS(Tab_note_heads_engraver);
+
+protected:
+  virtual void start_translation_timestep ();
+  virtual bool try_music (Music *req_l) ;
+  virtual void process_music ();
+
+  virtual void stop_translation_timestep ();
+};
+
+
+Tab_note_heads_engraver::Tab_note_heads_engraver()
+{
+}
+
+bool
+Tab_note_heads_engraver::try_music (Music *m) 
+{
+  if (Note_req * n =dynamic_cast <Note_req *> (m))
+    {
+      note_req_l_arr_.push (n);
+      return true;
+    }
+  else if (Text_script_req * ts = dynamic_cast<Text_script_req*> (m))
+    {
+      if (m->get_mus_property ("text-type") != ly_symbol2scm ("finger")) return false;
+      
+      //if (tabstring_req_arr_.size () < note_req_l_arr_.size ()) {
+        tabstring_req_arr_.push (ts);
+      //}
+      return true;
+    }
+  else if (dynamic_cast<Busy_playing_req*> (m))
+    {
+      return note_req_l_arr_.size ();
+    }
+  
+  return false;
+}
+
+
+void
+Tab_note_heads_engraver::process_music ()
+{
+  /*
+  for (int i=0; i < tabstring_req_arr_.size (); i++) {
+      Music * tabstring_req = tabstring_req_arr_[i];
+      
+      size_t lenp;
+      char* tab_string_as_str = gh_scm2newstr(tabstring_req->get_mus_property ("text"), &lenp);
+  }
+  */
+  
+  for (int i=0; i < note_req_l_arr_.size (); i++)
+    {
+      Item * note_p  = new Item (get_property ("TabNoteHead"));
+      
+      Music * req = note_req_l_arr_[i];
+      
+      Music * tabstring_req = tabstring_req_arr_[i];
+      
+      size_t lenp;
+      char* tab_string_as_str = gh_scm2newstr(tabstring_req->get_mus_property ("text"), &lenp);
+      int tab_string = atoi(tab_string_as_str);
+      
+      Duration dur = *unsmob_duration (req->get_mus_property ("duration"));
+      
+      note_p->set_grob_property ("duration-log", gh_int2scm (dur.duration_log ()));
+
+      if (dur.dot_count ())
+	{
+	  Item * d = new Item (get_property ("Dots"));
+	  Rhythmic_head::set_dots (note_p, d);
+	  
+	  if (dur.dot_count ()
+	      != gh_scm2int (d->get_grob_property ("dot-count")))
+	    d->set_grob_property ("dot-count", gh_int2scm (dur.dot_count ()));
+
+	  d->set_parent (note_p, Y_AXIS);
+	  announce_grob (d, SCM_EOL);
+	  dot_p_arr_.push (d);
+	}
+      
+      int pos = 2 * tab_string - 2; // No tab-note between the string !!!
+      SCM c0 = get_property ("centralCPosition");
+      if (gh_number_p (c0)) pos += gh_scm2int (c0);
+      
+      note_p->set_grob_property ("tab-string", gh_int2scm (tab_string));
+      
+      note_p->set_grob_property ("staff-position", gh_int2scm (pos));
+      announce_grob (note_p, req->self_scm());
+      note_p_arr_.push (note_p);
+    }
+}
+
+void
+Tab_note_heads_engraver::stop_translation_timestep ()
+{
+  for (int i=0; i < note_p_arr_.size (); i++)
+    {
+      typeset_grob (note_p_arr_[i]);
+    }
+
+  note_p_arr_.clear ();
+  for (int i=0; i < dot_p_arr_.size (); i++)
+    {
+      typeset_grob (dot_p_arr_[i]);
+    }
+  dot_p_arr_.clear ();
+  
+  note_req_l_arr_.clear ();
+  
+  tabstring_req_arr_.clear ();
+}
+
+void
+Tab_note_heads_engraver::start_translation_timestep ()
+{
+}
+
+
+ENTER_DESCRIPTION(Tab_note_heads_engraver,
+/* descr */       "Generate one or more tablature noteheads from Music of type Note_req.",
+/* creats*/       "TabNoteHead Dots",
+/* acks  */       "",
+/* reads */       "centralCPosition",
+/* write */       "");
diff -purN ../lilypond-1.5.58/lily/text-engraver.cc ./lily/text-engraver.cc
--- ../lilypond-1.5.58/lily/text-engraver.cc	Sun May  5 21:24:47 2002
+++ ./lily/text-engraver.cc	Mon May 27 11:21:11 2002
@@ -89,11 +89,6 @@ Text_engraver::create_grobs ()
       // URG: Text vs TextScript
       String basic = "TextScript";
 
-      if (r->get_mus_property ("text-type") == ly_symbol2scm ("finger"))
-	{
-	  basic = "Fingering";
-	}
-
       Item *text = new Item (get_property (basic.ch_C ()));
 
       /*
@@ -104,19 +99,6 @@ Text_engraver::create_grobs ()
       Axis ax = to_boolean (axisprop) ? X_AXIS : Y_AXIS;
       Side_position_interface::set_axis (text, ax);
 
-#if 0
-      if (r->style_str_ == "finger" && ax == Y_AXIS)
-	{
-	  /*
-	    nicely center the scripts.
-	   */ 
-	  text->add_offset_callback (Side_position_interface::aligned_on_self_proc, X_AXIS);
-	  text->add_offset_callback (Side_position_interface::centered_on_parent_proc, X_AXIS);
-	}
-#endif
-      
-
-      
       /*
 	make sure they're in order by adding i to the priority field.
 	*/
@@ -127,19 +109,6 @@ Text_engraver::create_grobs ()
 	Side_position_interface::set_direction (text, r->get_direction ());
       
       text->set_grob_property ("text", r->get_mus_property ("text"));
-      
-      SCM nonempty = get_property ("textNonEmpty");
-
-      if (gh_boolean_p (nonempty))
-	if (gh_scm2bool (nonempty))
-	  /*
-	    empty text: signal that no rods should be applied.
-	    Default nowadays.
-	  */
-	  text->set_grob_property ("no-spacing-rods" , SCM_BOOL_F);
-	else
-	  text->set_grob_property ("no-spacing-rods" , SCM_BOOL_T);
-       
       announce_grob (text, r->self_scm ());
       texts_.push (text);
     }
@@ -171,5 +140,5 @@ ENTER_DESCRIPTION(Text_engraver,
 /* descr */       "Create text-scripts",
 /* creats*/       "TextScript",
 /* acks  */       "rhythmic-head-interface stem-interface",
-/* reads */       "scriptHorizontal textNonEmpty",
+/* reads */       "scriptHorizontal",
 /* write */       "");
diff -purN ../lilypond-1.5.58/lily/text-item.cc ./lily/text-item.cc
--- ../lilypond-1.5.58/lily/text-item.cc	Wed Apr 10 19:25:36 2002
+++ ./lily/text-item.cc	Fri May 24 15:03:26 2002
@@ -17,6 +17,7 @@
 #include "main.hh"
 #include "all-font-metrics.hh"
 #include "afm.hh"
+#include "lookup.hh"
 
 
 /*
@@ -96,6 +97,7 @@ Text_item::lookup_text (Grob *me, Font_m
   return Molecule (fm->text_dimension (ly_scm2string (text)), list);
 }
 
+
 /*
   TODO:
 
@@ -154,73 +156,37 @@ Text_item::markup_text2molecule (Grob *m
       extent_b = true;
     }
 
-  Offset o (0, (axis == Y_AXIS ? - kern[axis] : 0));
+  Offset o (kern[X_AXIS], raise - kern[Y_AXIS]);
 
-  Molecule mol;
+  
+  Molecule mol = Lookup::filledbox (Box (Interval (0,0), Interval (0,0)));
+  
   while (gh_pair_p (text))
     {
-   
       Molecule m = text2molecule (me, ly_car (text), p);
 
-      /*
-	TODO: look at padding?
-	
-	Look ahead here for kern and raise.
-
-	(cols "foo" ((raise . 1) "bar"))
-	(cols "foo" ((bold (raise . 1)) "bar"))
-
-	When constructing the molecule for bar, all normal extra
-	properties found, such as bold, are used for the construction
-	of bar's molecule.  But for kern or raise, it seems that we're
-	too late then, translating bar's molecule has no effect (or
-	maybe the effect of translating gets nullified when bar's
-	molecule is `added_to_edge' of the molecule for foo?)
-
-	So, while constructing foo's molecule, we look ahead for the
-	raise of bar.  The HEAD of the description of bar may be a
-	single property, or a list, so we must check that too.
-      */
-	
-      SCM next_p = SCM_EOL;
-      if (gh_pair_p (ly_car (text)))
-	next_p = scm_list_n (gh_call2 (f, sheet, ly_caar (text)), SCM_UNDEFINED);
-      SCM next_k = ly_assoc_chain (ly_symbol2scm ("kern"), next_p);
-      Real next_kern = kern[axis];
-      if (gh_pair_p (next_k) && gh_number_p (ly_cdr (next_k)))
-	next_kern = gh_scm2double (ly_cdr (next_k)) * staff_space;
-
-      SCM next_r = ly_assoc_chain (ly_symbol2scm ("raise"), next_p);
-      Real next_raise = 0;
-      if (gh_pair_p (next_r) && gh_number_p (ly_cdr (next_r)))
-	next_raise = gh_scm2double (ly_cdr (next_r)) * staff_space;
-
-      o[Y_AXIS] = next_raise;
-
       if (!m.empty_b ())
 	{
-	  m.translate (o);
-	  if (mol.empty_b ())
-	    mol = m;
-	  else
-	    {
-	      if (axis == Y_AXIS && baseline_skip)
-		next_kern += baseline_skip - m.extent (Y_AXIS)[UP];
-	      mol.add_at_edge (axis, axis == X_AXIS ? RIGHT : DOWN, m, next_kern);
-	    }
+	  m.translate_axis (mol.extent (axis)[axis == X_AXIS ? RIGHT : DOWN]
+			    - (axis == Y_AXIS ? baseline_skip : 0),
+			    axis);
+	  mol.add_molecule (m);
 	}
       text = ly_cdr (text);
     }
   
+  /* Set extend to markup requested value. */
   if (extent_b)
     {
-      /* we're not setting extents for unknown reasons. */
       Box b = mol.extent_box ();
       SCM expr = mol.get_expr ();
 
       b[axis] = extent;
       mol = Molecule (b, expr);
-    }  
+    }
+  
+  mol.translate (o);
+  
   return mol;
 }
 
diff -purN ../lilypond-1.5.58/lilypond-mode.el ./lilypond-mode.el
--- ../lilypond-1.5.58/lilypond-mode.el	Mon Apr 22 15:48:31 2002
+++ ./lilypond-mode.el	Wed May 29 11:05:18 2002
@@ -25,7 +25,7 @@
 (require 'easymenu)
 (require 'compile)
 
-(defconst LilyPond-version "1.5.52"
+(defconst LilyPond-version "1.5.58"
   "`LilyPond-mode' version number.")
 
 (defconst LilyPond-help-address "bug-lilypond@gnu.org"
@@ -510,6 +510,7 @@ command."
   (define-key LilyPond-mode-map "\C-c\C-p" 'LilyPond-command-viewps)
   (define-key LilyPond-mode-map "\C-c\C-m" 'LilyPond-command-next-midi)
   (define-key LilyPond-mode-map "\C-cf" 'font-lock-fontify-buffer)
+  (define-key LilyPond-mode-map "\C-ci" 'LilyPond-quick-note-insert)
   (define-key LilyPond-mode-map "\C-cn" 'LilyPond-insert-tag-notes)
   (define-key LilyPond-mode-map "\C-cs" 'LilyPond-insert-tag-score)
   (define-key LilyPond-mode-map "\C-c:" 'LilyPond-un-comment-region)
@@ -521,6 +522,79 @@ command."
 
 ;;; Menu Support
 
+(defun LilyPond-quick-note-insert()
+  "Insert notes with fewer key strokes by using a simple keyboard piano."
+  (interactive)
+  (setq dutch-notes
+	'(("k" "a") ("l" "b") ("a" "c") ("s" "d") 
+	  ("d" "e") ("f" "f") ("j" "g") ("r" "r")))
+  (setq dutch-note-ends '("eses" "es" "" "is" "isis"))
+  (setq dutch-note-replacements '("" ""))
+  (setq finnish-note-replacements
+	'(("eeses" "eses") ("ees" "es") ("aeses" "asas") ("aes" "as") ("b" "h")
+	  ("beses" "heses") ("bes" "b") ("bis" "his") ("bisis" "hisis")))
+			      ; add more translations of the note names
+  (setq other-keys "()<>~")
+  (setq accid 0) (setq octav 0) (setq durat "") (setq dots 0)
+
+  (message "Press h for help.") (sit-for 0 750 1)
+
+  (setq note-replacements dutch-note-replacements)
+  (while (not (= 27 ; esc to quit
+    (setq x (read-char 
+	     (format " | a[_]s[_]d | f[_]j[_]k[_]l | r with ie ,' 12345678 . 0 (<~>)\\b\\n Esc \n | c | d | e | f | g | a | %s | r with %s%s%s%s"
+		     (if (string= (car(cdr(assoc "b" note-replacements))) "h")
+			 "h" "b")
+		     (nth (+ accid 2) dutch-note-ends)
+		     (make-string (abs octav) (if (> octav 0) ?' ?,)) 
+		     durat 
+		     (if (string= durat "") "" (make-string dots ?.)))))))
+;    (insert (number-to-string x)) ; test numbers for characters
+    (setq note (cdr (assoc (char-to-string x) dutch-notes)))
+    (cond
+     ((= x 127) (backward-kill-word 1)) ; backspace
+     ((= x 13) (progn (insert "\n") (LilyPond-indent-line)))) ; return
+    (setq x (char-to-string x))
+    (cond
+     ((and (string< x "9") (string< "0" x))
+      (progn (setq durat (int-to-string (expt 2 (- (string-to-int x) 1))))
+	     (setq dots 0)))
+     ((string= x " ") (insert " "))
+     ((string= x "0") (progn (setq accid 0) (setq octav 0) 
+			     (setq durat "") (setq dots 0)))
+     ((string= x "i") (setq accid (if (= accid 2) 0 (max (+ accid 1) 1))))
+     ((string= x "e") (setq accid (if (= accid -2) 0 (min (+ accid -1) -1))))
+     ((string= x "'") (setq octav (if (= octav 4) 0 (max (+ octav 1) 1))))
+     ((string= x ",") (setq octav (if (= octav -4) 0 (min (+ octav -1) -1))))
+     ((string= x ".") (setq dots (if (= dots 4) 0 (+ dots 1))))
+     ((not (null (member x (split-string other-keys ""))))
+      (insert (format "%s " x)))
+     ((not (null note))
+      (progn
+	(setq note 
+	      (format "%s%s" (car note) (if (string= "r" (car note)) "" 
+					  (nth (+ accid 2) dutch-note-ends))))
+	(setq notetwo (car (cdr (assoc note note-replacements))))
+	(if (not (null notetwo)) (setq note notetwo))
+	(insert
+	 (format "%s%s%s%s " 
+		 note
+		 (if (string= "r" note) ""
+		     (make-string (abs octav) (if (> octav 0) ?' ?,)))
+		 durat
+		 (if (string= durat "") "" (make-string dots ?.))))
+	(setq accid 0) (setq octav 0) (setq durat "") (setq dots 0)))
+     ((string= x "t") (progn (setq note-replacements dutch-note-replacements)
+			     (message "Selected Dutch notes") 
+			     (sit-for 0 750 1))) ; t
+     ((string= x "n") (progn (setq note-replacements finnish-note-replacements)
+			     (message "Selected Finnish/Deutsch notes") 
+			     (sit-for 0 750 1))) ; n
+			      ; add more translations of the note names
+     ((string= x "h") 
+      (progn (message "Insert notes with fewer key strokes. For example \"i,5.f\" produces \"fis,32. \".") (sit-for 5 0 1) (message "Add also \"a ~ a\"-ties, \"a ( ) b\"-slurs and \"< a b >\"-chords.") (sit-for 5 0 1) (message "Note names are in Du(t)ch by default. Hit 'n' for Fin(n)ish/Deutsch note names.") (sit-for 5 0 1) (message "Backspace deletes last note, return starts a new indented line and Esc quits.") (sit-for 5 0 1) (message "Backspace deletes last note, return starts a new indented line and Esc quits.") (sit-for 5 0 1) (message "Remember to add all other details as well.") (sit-for 5 0 1)))
+    )))
+
 (define-skeleton LilyPond-insert-tag-notes
   "LilyPond notes tag."
   nil
@@ -601,6 +675,7 @@ command."
 	  '(("Insert"
 	     [ "\\notes..."  LilyPond-insert-tag-notes t]
 	     [ "\\score..."  LilyPond-insert-tag-score t]
+	     ["Quick Notes"  LilyPond-quick-note-insert t]
 	     ))
 	  '(("Miscellaneous"
 	     ["Uncomment Region" LilyPond-un-comment-region t]
diff -purN ../lilypond-1.5.58/ly/engraver-init.ly ./ly/engraver-init.ly
--- ../lilypond-1.5.58/ly/engraver-init.ly	Tue May 21 00:05:06 2002
+++ ./ly/engraver-init.ly	Wed May 29 11:05:19 2002
@@ -223,7 +223,7 @@ InnerStaffGroupContext= \translator {
 	\accepts "RhythmicStaff"
 	\accepts "GrandStaff"
 	\accepts "PianoStaff"
-	
+	\accepts "TabStaff"	
 	\accepts "Lyrics"
 	\accepts "ChordNames"
 }
@@ -347,6 +347,7 @@ ScoreContext = \translator {
 	\consists "Span_arpeggio_engraver"
 
 	\accepts "Staff"
+	\accepts "TabStaff"
 	\accepts "StaffContainer"
 	\accepts "StaffGroup"
 	\accepts "RhythmicStaff"	
@@ -442,3 +443,37 @@ FiguredBassContext = \translator {
 	\consists "Figured_bass_engraver"	
 	\consistsend "Axis_group_engraver"
 }
+
+TabVoiceContext =   \translator {
+      \VoiceContext
+      \name "TabVoice"
+      \denies "Thread"
+      \consists "Tab_note_heads_engraver"
+}
+
+TabStaffContext = \translator {
+      \StaffContext
+      \alias "Staff"
+      \name "TabStaff"
+      \denies "Voice"
+      \accepts "TabVoice"
+      
+      % 6 strings
+      StaffSymbol \override #'line-count  = #6
+      StaffSymbol \override #'staff-space = #1.5
+      
+      % One may change the strings tuning as following :
+      % The lenght of the list must be equal to the number of string
+      %TabNoteHead \override #'string-tunings = #'(10 10 10 10 10 10)
+      
+      % Special "TAB" clef
+      clefGlyph = #"clefs-tab"
+      clefPosition = #0
+      
+      % Don't draw stems over the tabature figures !
+      Stem \override #'avoid-note-head = ##t
+      
+      % No accidental in tablature !
+      Accidental  = \turnOff 
+}
+   
diff -purN ../lilypond-1.5.58/ly/params-init.ly ./ly/params-init.ly
--- ../lilypond-1.5.58/ly/params-init.ly	Wed May 15 13:36:12 2002
+++ ./ly/params-init.ly	Wed May 29 11:05:19 2002
@@ -49,7 +49,8 @@ interscoreline = 4. \mm
 \translator { \LyricsVoiceContext }
 \translator { \StaffContainerContext }
 \translator { \FiguredBassContext }
-
+\translator { \TabStaffContext }
+\translator { \TabVoiceContext }
 
 
 
diff -purN ../lilypond-1.5.58/ly/property-init.ly ./ly/property-init.ly
--- ../lilypond-1.5.58/ly/property-init.ly	Wed May 15 13:36:12 2002
+++ ./ly/property-init.ly	Mon May 27 11:21:12 2002
@@ -6,25 +6,26 @@ stemUp = \property Voice.Stem \set #'dir
 stemDown = \property Voice.Stem \set #'direction = #-1 
 stemBoth= \property Voice.Stem \revert #'direction
 
-slurUp   = \property Voice.Slur \override #'direction = #1
-slurDown = \property Voice.Slur \override #'direction = #-1
+slurUp   = \property Voice.Slur \set #'direction = #1
+slurDown = \property Voice.Slur \set #'direction = #-1
 slurBoth = \property Voice.Slur \revert #'direction 
-shiftOn  = \property Voice.NoteColumn \override #'horizontal-shift = #1
-shiftOnn  = \property Voice.NoteColumn \override #'horizontal-shift = #2
-shiftOnnn  = \property Voice.NoteColumn \override #'horizontal-shift = #3
+
+shiftOn  = \property Voice.NoteColumn \set #'horizontal-shift = #1
+shiftOnn  = \property Voice.NoteColumn \set #'horizontal-shift = #2
+shiftOnnn  = \property Voice.NoteColumn \set #'horizontal-shift = #3
 shiftOff  = \property Voice.NoteColumn \revert #'horizontal-shift 
 
-tieUp = \property Voice.Tie \override #'direction = #1
-tieDown = \property Voice.Tie \override #'direction = #-1
+tieUp = \property Voice.Tie \set #'direction = #1
+tieDown = \property Voice.Tie \set #'direction = #-1
 tieBoth = \property Voice.Tie \revert #'direction 
 
 dynamicUp  = {
-  \property Voice.DynamicText \override #'direction = #1
-  \property Voice.DynamicLineSpanner \override #'direction = #1
+  \property Voice.DynamicText \set #'direction = #1
+  \property Voice.DynamicLineSpanner \set #'direction = #1
 }
 dynamicDown = {
-  \property Voice.DynamicText \override #'direction = #-1
-  \property Voice.DynamicLineSpanner \override #'direction = #-1
+  \property Voice.DynamicText \set #'direction = #-1
+  \property Voice.DynamicLineSpanner \set #'direction = #-1
 }
 dynamicBoth = {
   \property Voice.DynamicText \revert #'direction
@@ -32,34 +33,31 @@ dynamicBoth = {
 }
 
 scriptUp  = {
-  \property Voice.TextScript \override #'direction = #1
-  \property Voice.Script \override #'direction = #1
+  \property Voice.TextScript \set #'direction = #1
+  \property Voice.Script \set #'direction = #1
 }
 scriptDown = {
-  \property Voice.TextScript \override #'direction = #-1
-  \property Voice.Script \override #'direction = #-1
+  \property Voice.TextScript \set #'direction = #-1
+  \property Voice.Script \set #'direction = #-1
 }
 scriptBoth = {
   \property Voice.TextScript \revert #'direction
   \property Voice.Script \revert #'direction
 }
 
-dotsUp = \property Voice.Dots \override #'direction = #1
-dotsDown = \property Voice.Dots \override #'direction = #-1
+dotsUp = \property Voice.Dots \set #'direction = #1
+dotsDown = \property Voice.Dots \set #'direction = #-1
 dotsBoth = \property Voice.Dots \revert #'direction 
 
 % why doubly?
 tupletUp  = {
-  \property Voice.TupletBracket \override #'direction = #1
-  \property Voice.TupletBracket \override #'direction = #1
+  \property Voice.TupletBracket \set #'direction = #1
 }
 tupletDown = {
-  \property Voice.TupletBracket \override #'direction = #-1
-  \property Voice.TupletBracket \override #'direction = #-1
+  \property Voice.TupletBracket \set #'direction = #-1
 }
 tupletBoth = {
   \property Voice.TupletBracket \revert #'direction
-  \property Voice.TupletBracket \revert #'direction
 }
 
 
@@ -85,16 +83,15 @@ voiceThree =#(context-spec-music (make-v
 voiceFour = #(context-spec-music (make-voice-props-set 3) "Voice")
 
 % There's also dash, but setting dash period/length should be fixed.
-slurDotted = \property Voice.Slur \override #'dashed = #1
+slurDotted = \property Voice.Slur \set #'dashed = #1
 slurSolid = \property Voice.Slur \revert #'dashed
-tieDotted = \property Voice.Tie \override #'dashed = #1
+tieDotted = \property Voice.Tie \set #'dashed = #1
 tieSolid = \property Voice.Tie \revert #'dashed
 
 	
 tiny  = 
 	\property Voice.fontSize= -2
 
-
 small  = 
 	\property Voice.fontSize= -1
 
@@ -122,8 +119,8 @@ endincipit = \notes{
 autoBeamOff = \property Voice.autoBeaming = ##f
 autoBeamOn = \property Voice.autoBeaming = ##t
 
-emptyText = \property Voice.textNonEmpty = ##f
-fatText = \property Voice.textNonEmpty = ##t
+fatText = \property Voice.TextScript \set #'no-spacing-rods = ##f
+emptyText = \property Voice.TextScript \set #'no-spacing-rods  = ##t
 
 showStaffSwitch = \property Voice.followVoice = ##t
 hideStaffSwitch = \property Voice.followVoice = ##f
diff -purN ../lilypond-1.5.58/make/lilypond.redhat.spec.in ./make/lilypond.redhat.spec.in
--- ../lilypond-1.5.58/make/lilypond.redhat.spec.in	Mon May 13 14:05:22 2002
+++ ./make/lilypond.redhat.spec.in	Wed May 29 10:57:49 2002
@@ -64,7 +64,7 @@ gzip -9fn $RPM_BUILD_ROOT%{_prefix}/info
 %endif
 
 mkdir -p $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/site-start.d
-install -m 644 lilypond-mode.el lilypond-font-lock.el $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/
+install -m 644 lilypond-mode.el lilypond-font-lock.el lilypond-indent.el $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/
 install -m 644 lilypond-init.el $RPM_BUILD_ROOT/usr/share/emacs/site-lisp/site-start.d
 
 gzip -9fn $RPM_BUILD_ROOT%{_prefix}/man/man1/*
@@ -137,9 +137,12 @@ chkfontpath --remove=/usr/share/lilypond
 %{_prefix}/man/man1/mup2ly.1.gz
 %{_prefix}/man/man1/pmx2ly.1.gz
 
-%{_prefix}/share/lilypond/
+%{_prefix}/share/lilypond/@TOPLEVEL_VERSION@/
 %{_prefix}/share/locale/*/LC_MESSAGES/lilypond.mo
 %{_prefix}/../etc/profile.d/lilypond.*
 
 %files documentation
+
 %doc web/
+%doc input/
+%doc mutopia/ 
diff -purN ../lilypond-1.5.58/make/lilypond.suse.spec.in ./make/lilypond.suse.spec.in
--- ../lilypond-1.5.58/make/lilypond.suse.spec.in	Mon Dec 24 14:05:51 2001
+++ ./make/lilypond.suse.spec.in	Fri May 24 17:40:10 2002
@@ -215,6 +215,7 @@ touch var/adm/SuSEconfig/run-texhash
 # hairy to hook it in (possibly non-existing) emacs
 %doc lilypond-mode.el
 %doc lilypond-font-lock.el
+%doc lilypond-indent.el
 
 %config /etc/profile.d/*
 
diff -purN ../lilypond-1.5.58/mf/GNUmakefile ./mf/GNUmakefile
--- ../lilypond-1.5.58/mf/GNUmakefile	Wed May 22 11:32:08 2002
+++ ./mf/GNUmakefile	Mon May 27 13:50:37 2002
@@ -59,7 +59,7 @@ INSTALLATION_OUT_FILES3=$(TFM_FILES)
 PFA_FILES = $(addprefix $(outdir)/, $(FONT_FILES:.mf=.pfa))
 
 ifdef MAKE_PFA_FILES
-ALL_GEN_FILES += $(PFA_FILES) $(outdir)/lilypond.map
+ALL_GEN_FILES += $(PFA_FILES) $(outdir)/lilypond.map $(outdir)/fonts.scale
 INSTALLATION_OUT_DIR4=$(datadir)/fonts/type1
 INSTALLATION_OUT_FILES4=$(PFA_FILES) $(outdir)/fonts.scale
 
@@ -88,5 +88,5 @@ local-clean:
 	rm -f mfplain.mem mfplain.log 
 	rm -f *.tfm *.log
 
-pfa: $(PFA_FILES) 
+pfa: $(PFA_FILES)  
 
diff -purN ../lilypond-1.5.58/scm/font.scm ./scm/font.scm
--- ../lilypond-1.5.58/scm/font.scm	Fri Apr  5 01:12:43 2002
+++ ./scm/font.scm	Mon May 27 11:46:19 2002
@@ -90,8 +90,10 @@
     ((-2 medium italic roman 7) . "cmti8")
     ((-3 medium italic roman 7) . "cmti7")    
 
-    ((4 bold upright roman 17) . "cmbx17")
-    ((3 bold upright roman 17) . "cmbx17")
+    ;;; cmbx17 is sauter, not commonly available as Type1.
+    ((4 bold upright roman 17) . "cmr17") 
+    ((3 bold upright roman 17) . "cmr17")
+    
     ((2 bold upright roman 14) . "cmbx14")
     ((1 bold upright roman 12) . "cmbx12")
     ((0 bold upright roman 10) . "cmbx10")
diff -purN ../lilypond-1.5.58/scm/grob-description.scm ./scm/grob-description.scm
--- ../lilypond-1.5.58/scm/grob-description.scm	Wed May 22 11:32:09 2002
+++ ./scm/grob-description.scm	Thu May 30 18:16:43 2002
@@ -242,7 +242,9 @@
 			  (thickness . 0.48)
 			  (break-align-symbol . staff-bar)
 			  (visibility-lambda . ,begin-of-line-invisible)
-			  (meta . ((interfaces . (font-interface percent-repeat-interface))))
+			  (meta . ((interfaces . (font-interface
+						  break-aligned-interface
+						  percent-repeat-interface))))
 			 ))
 
     (DynamicText
@@ -505,6 +507,17 @@
 	(meta . ((interfaces . (rhythmic-head-interface font-interface note-head-interface staff-symbol-referencer-interface))))
 	))
 
+    (TabNoteHead
+     . (
+	(font-family . roman)
+	(style . default)
+	(molecule-callback . ,tablature-molecule-callback)
+	(Y-offset-callbacks  . (,Staff_symbol_referencer::callback))
+	(stem-attachment-function . ,tablature-stem-attachment-function)
+  (string-tunings . (-8 -3 2 7 11 16))
+	(meta . ((interfaces . (rhythmic-head-interface font-interface note-head-interface staff-symbol-referencer-interface))))
+	))
+
     (Glissando
      . (
 	(type . line)
@@ -799,6 +812,7 @@
 	(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
 	(adjust-if-on-staffline . #t)
 	(font-family . music)	   
+	(avoid-note-head . #f)
 	(meta . ((interfaces . (stem-interface  font-interface))))
 	))
 
diff -purN ../lilypond-1.5.58/scm/grob-property-description.scm ./scm/grob-property-description.scm
--- ../lilypond-1.5.58/scm/grob-property-description.scm	Tue May 21 00:05:07 2002
+++ ./scm/grob-property-description.scm	Wed May 29 11:05:19 2002
@@ -45,9 +45,6 @@ This procedure is called (using dependen
 (grob-property-description 'arch-height number? "height of the hook of a system brace.")
 (grob-property-description 'arch-thick number? "thickness of the hook of system brace.")
 (grob-property-description 'arch-width number? "width of the hook of a system brace.")
-(grob-property-description 'shortest-duration-space number? "Start
-with this much space for the shortest duration. This is explessed in @code{spacing-increment} as unit. See also
-@ref{spacing-spanner-interface}.")
 (grob-property-description 'arpeggio ly-grob? "pointer to arpeggio object.") 
 (grob-property-description 'arpeggio-direction dir? "If set, put an
 arrow on the arpeggio squiggly line.")
@@ -293,7 +290,9 @@ TODO: revise typing.")
 (grob-property-description 'self-alignment-Y number? "like self-alignment-X but for Y axis.")
 (grob-property-description 'shorten number? "the amount of space that a stem should be shortened (DOCME!)")
 (grob-property-description 'shorten-pair number-pair? "the length on each side to shorten a text-spanner, for example a pedal bracket")
-
+(grob-property-description 'shortest-duration-space number? "Start
+with this much space for the shortest duration. This is explessed in @code{spacing-increment} as unit. See also
+@ref{spacing-spanner-interface}.")
 (grob-property-description 'shortest-playing-duration moment? "duration of the shortest playing in that column.")
 (grob-property-description 'shortest-starter-duration moment? "duration of the shortest notes that starts exactly in this column.")
 (grob-property-description 'side-relative-direction dir? "if set: get the direction from a different object, and multiply by this.")
@@ -465,3 +464,7 @@ functions set spanner positions.")
 (grob-property-description 'chord-name-function procedure? "DOCME")
 (grob-property-description 'minimum-beam-collision-distance number?
 "Minimum distance to beam for a rest collision.")
+
+(grob-property-description 'tab-string number?       "The tablature string of a TabNoteHead.")
+(grob-property-description 'avoid-note-head boolean? "if set, the stem of a chord does not pass through all note head, but start at the last note head. Used by tablature.")
+(grob-property-description 'string-tunings list?     "The strings tuning, in semi-tons from the middle C. Used by tablature.")
diff -purN ../lilypond-1.5.58/scm/interface-description.scm ./scm/interface-description.scm
--- ../lilypond-1.5.58/scm/interface-description.scm	Sun May 19 02:16:29 2002
+++ ./scm/interface-description.scm	Wed May 29 11:05:19 2002
@@ -36,3 +36,9 @@
  "a rehearsal mark"
  '(
    ))
+
+;;; todo: this is not typesetting info. Move to interpretation.
+(ly-add-interface
+ 'tablature-interface
+ "tablature notes"
+ '(string-tunings tab-string))
diff -purN ../lilypond-1.5.58/scm/output-lib.scm ./scm/output-lib.scm
--- ../lilypond-1.5.58/scm/output-lib.scm	Fri May 17 00:38:09 2002
+++ ./scm/output-lib.scm	Wed May 29 11:05:19 2002
@@ -5,6 +5,36 @@
 ;;;; (c) 1998--2001 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;; Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
+; Tablature functions, by Jiba (jiba@tuxfamily.org)
+
+; The TabNoteHead stem attachment function.
+(define (tablature-stem-attachment-function style)
+  (cons 0.0 1.0)
+)
+
+; The TabNoteHead molecule callback.
+; Create a text molecule
+(define (tablature-molecule-callback grob)
+  (let ((molecule (fontify-text
+                   (ly-get-default-font grob)
+                   (string-append
+                    (number->string
+                     (- (pitch-semitones (ly-get-mus-property (ly-get-grob-property grob 'cause) 'pitch))
+                        (list-ref
+                         (ly-get-grob-property grob 'string-tunings)
+                         (- (ly-get-grob-property grob 'tab-string)
+                            1 ; remove 1 because list index starts at 0 and guitar string at 1.
+                            ))
+                        )
+                     )
+                    )
+                   )))
+    molecule ; return the molecule.
+    )
+  )
+
+; end of tablature functions
+
 
 (define (arg->string arg)
   (cond ((number? arg) (inexact->string arg 10))
diff -purN ../lilypond-1.5.58/scm/pdf.scm ./scm/pdf.scm
--- ../lilypond-1.5.58/scm/pdf.scm	Tue May 21 00:05:08 2002
+++ ./scm/pdf.scm	Thu May 30 12:37:59 2002
@@ -231,12 +231,10 @@
 
 (define my-eval-in-module eval)
 
-(if (or (equal? (minor-version) "4")
+(if (or (equal? (minor-version) "4.1")
+	(equal? (minor-version) "4")
 	(equal? (minor-version) "3.4"))
-    (begin
-      (set! my-eval-in-module eval-in-module)
-
-    ))
+    (set! my-eval-in-module eval-in-module))
 
 (define-public (pdf-output-expression expr port)
   (display (my-eval-in-module expr this-module) port) )
diff -purN ../lilypond-1.5.58/scm/pdftex.scm ./scm/pdftex.scm
--- ../lilypond-1.5.58/scm/pdftex.scm	Tue May 21 00:05:08 2002
+++ ./scm/pdftex.scm	Thu May 30 12:37:59 2002
@@ -74,7 +74,8 @@
 
 
 
-(if (or (equal? (minor-version) "4")
+(if (or (equal? (minor-version) "4.1")
+	(equal? (minor-version) "4")
 	(equal? (minor-version) "3.4"))
     (define (embedded-pdf expr)
       (let ((ps-string
@@ -222,12 +223,10 @@
 
 (define my-eval-in-module eval)
 
-(if (or (equal? (minor-version) "4")
+(if (or (equal? (minor-version) "4.1")
+	(equal? (minor-version) "4")
 	(equal? (minor-version) "3.4"))
-    (begin
-      (set! my-eval-in-module eval-in-module)
-
-    ))
+    (set! my-eval-in-module eval-in-module))
 
 (define-public (pdftex-output-expression expr port)
   (display (my-eval-in-module expr this-module) port) )
diff -purN ../lilypond-1.5.58/scm/ps.scm ./scm/ps.scm
--- ../lilypond-1.5.58/scm/ps.scm	Tue Apr  2 00:45:10 2002
+++ ./scm/ps.scm	Thu May 30 12:37:59 2002
@@ -14,7 +14,8 @@
 
 (debug-enable 'backtrace)
 
-(if (or (equal? (minor-version) "4")
+(if (or (equal? (minor-version) "4.1")
+	(equal? (minor-version) "4")
 	(equal? (minor-version) "3.4"))
     (define-public (ps-output-expression expr port)
       (display (eval-in-module expr this-module) port))
diff -purN ../lilypond-1.5.58/scm/sketch.scm ./scm/sketch.scm
--- ../lilypond-1.5.58/scm/sketch.scm	Mon Apr  1 21:43:39 2002
+++ ./scm/sketch.scm	Thu May 30 12:37:59 2002
@@ -30,8 +30,9 @@
 ;;    ))
 
 
-;; guile < 1.4 compatibility for eval
-(if (or (equal? (minor-version) "4")
+;; guile <= 1.4.x compatibility for eval
+(if (or (equal? (minor-version) "4.1")
+	(equal? (minor-version) "4")
 	(equal? (minor-version) "3.4"))
     (define (ly-eval e m)
       (eval-in-module e m))
diff -purN ../lilypond-1.5.58/scm/tex.scm ./scm/tex.scm
--- ../lilypond-1.5.58/scm/tex.scm	Mon Apr  1 21:43:39 2002
+++ ./scm/tex.scm	Thu May 30 12:37:59 2002
@@ -121,7 +121,8 @@
   ""
   )
 
-(if (or (equal? (minor-version) "4")
+(if (or (equal? (minor-version) "4.1")
+	(equal? (minor-version) "4")
 	(equal? (minor-version) "3.4"))
     (define (embedded-ps expr)
       (let ((ps-string
@@ -273,12 +274,10 @@
 
 (define my-eval-in-module eval)
 
-(if (or (equal? (minor-version) "4")
+(if (or (equal? (minor-version) "4.1")
+	(equal? (minor-version) "4")
 	(equal? (minor-version) "3.4"))
-    (begin
-      (set! my-eval-in-module eval-in-module)
-
-    ))
+    (set! my-eval-in-module eval-in-module))
 
 (define-public (tex-output-expression expr port)
   (display (my-eval-in-module expr this-module) port )
diff -purN ../lilypond-1.5.58/scripts/convert-ly.py ./scripts/convert-ly.py
--- ../lilypond-1.5.58/scripts/convert-ly.py	Sun May 19 02:12:35 2002
+++ ./scripts/convert-ly.py	Thu May 30 12:37:59 2002
@@ -857,6 +857,15 @@ if 1:
 	
 	conversions.append (((1,5,56), conv, 'Pitch::transpose->ly-transpose-pitch'))
 
+if 1:
+	def conv (str):
+		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'))
+
+
 ################################
 #	END OF CONVERSIONS	
 ################################
diff -purN ../lilypond-1.5.58/scripts/musedata2ly.py ./scripts/musedata2ly.py
--- ../lilypond-1.5.58/scripts/musedata2ly.py	Fri Feb  1 19:20:28 2002
+++ ./scripts/musedata2ly.py	Fri May 31 01:45:08 2002
@@ -13,6 +13,11 @@
 # * tuplets
 #
 
+#
+# I completely forgot how this was supposed to work --hwn 5/2002 
+#
+#
+
 import re
 import sys
 import string
@@ -154,6 +159,16 @@ attr_dict = {
 	'I': get_num_instruments,
 	}
 
+class Attribute_set:
+	def __init__ (self, dict):
+		self.dict = dict
+	def dump (self):
+		s = ''
+		if self. dict.has_key ('T'):
+			s = s+ get_timesig  (self.dict['T'])
+		
+		return s
+
 
 script_table = {
 'v': '\\upbow',
@@ -174,11 +189,6 @@ script_table = {
 'E': '\\fermata',
 }
 
-class Attribute_set:
-	def __init__ (self, dict):
-		self.dict = dict
-	def dump (self):
-		return ''
 
 class Chord:
 	def __init__ (self):
@@ -213,12 +223,17 @@ class Chord:
 			sd = '\\breve'
 		else:
 			sd = '%d' % self.basic_duration
-			
-		sd = sd + '.' * self.dots 
+
+		sd = sd + '.' * self.dots
+
+		str = ')' * len (self.slurstart) + str
+		
 		for p in self.pitches:
 			if str:
 				str = str + ' ' 
 			str = str + pitch_to_lily_string (p) + sd
+		str = str + '(' * len (self.slurstart)
+		
 
 		for s in self.scripts:
 			str = str + '-' + s
@@ -233,6 +248,10 @@ class Chord:
 		str = self.chord_prefix + str + self.chord_suffix
 		
 		return str
+
+class Measure_start:
+	def dump (self):
+		return ' |\n'
 	
 class Parser:
 	def append_entry (self, e):
@@ -251,8 +270,10 @@ class Parser:
 			}
 		self.entries = []
 		self.chords = []
+
 		
 		lines = open (fn).readlines ()
+		lines = map (lambda x: re.sub ("\r$", '', x), lines)
 		lines = self.parse_header (lines)
 		lines = self.append_lines (lines)
 		str = string.join (lines, '\n')
@@ -348,6 +369,14 @@ class Parser:
 			pittup = (oct, name ,alter)
 			ch.add_pitch (pittup)
 
+		ch.dots = 0
+		
+		dot_str = l[17:18]
+		if dot_str  == '.':
+			ch.dots = 1
+		elif dot_str == ':':
+			ch.dots = 2
+
 		base_dur = None
 		if ch.cue or ch.grace:
 			c = di[2]
@@ -357,19 +386,18 @@ class Parser:
 				base_dur = 0.5
 			else:
 				base_dur = 1 << (9 - (ord (c) - ord ('0')))
-		else:		
-			base_dur =  (4 * self.divs_per_q) / string.atoi (di)
+		else:
+			fact  = (1,1)
+			if ch.dots == 1:
+				fact = (2,3)
+			elif ch.dots == 2:
+				fact = (4, 7)
+			
+			base_dur =  (4 * self.divs_per_q* fact[1]) / (string.atoi (di)* fact[0])
 			ch.set_duration (base_dur)
 
 		ch.tied = ch.tied or tied 
-		dots = 0
-		
-		
-		if l[18:19] == '.':
-			dots = 1
-		elif l[18:19] == ':':
-			dots = 2
-
+	
 		if l[26:27] == '[':
 			ch.start_beam = 1
 		elif l[26:27] == ']':
@@ -378,13 +406,13 @@ class Parser:
 
 		additional = l[32:44]
 		for c in additional:
-			try:
-				s = list('([{z').index (c)
-				ch.slurstart.append( s)
-				sluropen = list(')]}x').index (c)
-				ch.slurstop.append( s)
-			except ValueError:
-				pass
+			if c in '([{z':
+				ch.slurstart.append( 0)
+				continue
+			elif c in ')]}x':
+				ch.slurstop.append( 0)
+				continue
+			
 			if c == '*':
 				ch.start_tuplet = 1
 				continue
@@ -414,7 +442,7 @@ class Parser:
 
 			
 	def parse_measure_line (self,l):
-		pass
+		self.append_entry (Measure_start())
 
 
 	def parse_duration (l):
@@ -467,7 +495,8 @@ class Parser:
 	def parse_body (self,lines):
 		comment_switch = 0
 		for l in lines:
-			
+			if not l:
+				continue
 			
 			c = l[0]
 			if c == '&':
@@ -519,6 +548,8 @@ encoded in so-called Musedata format
 musedata2ly converts a set of musedata files to one .ly file, and will
 include a \header field if a .ref file is supplied 
 
+This converter is not complete -- this is left to the user as an excercise.
+
 Report bugs to bug-lilypond@gnu.org.
 
 Written by Han-Wen Nienhuys <hanwen@cs.uu.nl>
@@ -539,7 +570,7 @@ def identify():
 
 
 
-(options, files) = getopt.getopt (sys.argv[1:], 'r:vo:h', ['ref=', 'help','version', 'output='])
+(options, files) = getopt.getopt (sys.argv[1:], 'r:vo:h', ['verbose', 'ref=', 'help','version', 'output='])
 out_filename = None
 ref_file = None
 for opt in options:
@@ -555,6 +586,8 @@ for opt in options:
 		ref_file = a 
 	elif o == '--output' or o == '-o':
 		out_filename = a
+	elif o == '--verbose' :
+		verbose = 1
 	else:
 		print o
 		raise getopt.error
@@ -567,6 +600,7 @@ ly = ''
 
 
 found_ids = ''
+
 for f in files:
 	if f == '-':
 		f = ''
@@ -577,6 +611,12 @@ for f in files:
 
 	id = os.path.basename (f)
 	id = re.sub ('[^a-zA-Z0-9]', 'x', id)
+
+	def num2let (match):
+		return chr (ord (match.group ()) - ord('0') + ord('A'))
+		
+	id = re.sub ('[0-9]', num2let, id)
+	
 	id = 'voice%s' % id
 	ly =ly + '\n\n%s = \\context Staff = "%s" %s\n\n' % (id, id, e.dump ())
 
diff -purN ../lilypond-1.5.58/stepmake/aclocal.m4 ./stepmake/aclocal.m4
--- ../lilypond-1.5.58/stepmake/aclocal.m4	Tue May 21 00:05:08 2002
+++ ./stepmake/aclocal.m4	Wed May 29 11:05:19 2002
@@ -219,7 +219,7 @@ AC_DEFUN(STEPMAKE_CXXTEMPLATE, [
 
 AC_DEFUN(STEPMAKE_DATADIR, [
     if test "$datadir" = "\${prefix}/share"; then
-	    datadir='${prefix}/share/'$package
+	    datadir='${prefix}/share/'$package/$FULL_VERSION
     fi
     DIR_DATADIR=${datadir}
     presome=${prefix}
@@ -230,12 +230,9 @@ AC_DEFUN(STEPMAKE_DATADIR, [
 
     AC_SUBST(datadir)
     AC_SUBST(DIR_DATADIR)
-    
-    dnl yeah, so fuck me gently with a cactus: this doesnt belong here
-    dnl Please take the person responsible for inventing shell-scripts out
-    dnl and shoot him. On behalf of the sane world, thank you.
-    dnl DIR_SHAREDSTATEDIR="foobar"
-    dnl AC_SUBST(DIR_SHAREDSTATEDIR)
+
+    # we used to set DIR_SHAREDSTATEDIR here,
+    # but apparently that broke something
     
     AC_DEFINE_UNQUOTED(DIR_DATADIR, "${DIR_DATADIR}")
 ])
