From 3f2900f0ea52866d3edaa83cee2b16b8be5e4ec9 Mon Sep 17 00:00:00 2001
From: Jan Nieuwenhuizen <janneke@gnu.org>
Date: Mon, 16 Oct 2000 00:00:34 +0200
Subject: [PATCH] patch::: 1.3.96.jcn1

1.3.96.jcn1
===========

* Added slope-limit and attachment-offset properties to slur.

* Slur's broken trend now weighs in the number of note-columns.

* Spacing tweaks:
---
 CHANGES                  |   9 +++
 VERSION                  |   2 +-
 input/emacs-lily.fly     |   1 +
 input/les-nereides.ly    | 119 ++++++++++++++++++++++++++-------------
 lily/arpeggio.cc         |   3 +-
 lily/include/slur.hh     |  26 +++++----
 lily/score-engraver.cc   |   4 +-
 lily/slur.cc             |  77 ++++++++++++++++++++-----
 lily/spacing-spanner.cc  |  34 +++++++----
 ly/engraver.ly           |  26 ++++++++-
 scm/basic-properties.scm |   4 +-
 scm/slur.scm             |  17 +-----
 12 files changed, 222 insertions(+), 100 deletions(-)
 create mode 100644 input/emacs-lily.fly

diff --git a/CHANGES b/CHANGES
index ee5e336d24..3a94fe3357 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,12 @@
+1.3.96.jcn1
+===========
+
+* Added slope-limit and attachment-offset properties to slur.
+
+* Slur's broken trend now weighs in the number of note-columns.
+
+* Spacing tweaks: 
+
 1.3.95.jcn5
 ===========
 
diff --git a/VERSION b/VERSION
index e089428ecd..d1d439c482 100644
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
 PATCH_LEVEL=96
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=jcn1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff --git a/input/emacs-lily.fly b/input/emacs-lily.fly
new file mode 100644
index 0000000000..1fda480437
--- /dev/null
+++ b/input/emacs-lily.fly
@@ -0,0 +1 @@
+cpp -P -traditional -o l-fake.ly  -DFAKE_GRACE les-nereides.ly
\ No newline at end of file
diff --git a/input/les-nereides.ly b/input/les-nereides.ly
index 79a08e0f8e..7dc06841ed 100644
--- a/input/les-nereides.ly
+++ b/input/les-nereides.ly
@@ -19,6 +19,14 @@ cpp -P -traditional -o l-fake.ly  -DFAKE_GRACE les-nereides.ly
  #(define (grace-beam-space-function multiplicity)
          (* (if (<= multiplicity 3) 0.816 0.844) 0.8))
 
+%% cpp: don't start on first column
+%% hmm, why doesn't this work?
+ #(define (make-text-checker text)
+  (lambda (elt)
+    (and (not (eq? #f (memq 'text-item-interface (ly-get-elt-property elt 'interfaces))))
+         (not (#f (string-match text (ly-get-elt-property elt 'text)))))
+    ))
+
 global = \notes{
     \partial 2;
     \key a \major;
@@ -40,7 +48,10 @@ treble = \context Voice=treble \notes\relative c''{
     \property Voice.NoteColumn \push #'horizontal-shift = #0
     \outputproperty #(make-type-checker 'text-item-interface) 
 	    #'extra-offset = #'(-6 . 2)
+    %% *Style* = Large??
+    \property Voice.TextScript \push #'style = #"Large"
     r2^"Allegretto scherzando"
+    \property Voice.TextScript \pop #'style
     %2
     \property Voice.Stem \pop #'direction
     \property Voice.Stem \push #'direction = #1
@@ -48,6 +59,8 @@ treble = \context Voice=treble \notes\relative c''{
     %3
     r4 <cis\arpeggio fis a cis> r8.
     \translator Staff=bass
+    \outputproperty #(make-text-checker "m")
+	    #'extra-offset = #'(-6 . 2)
     cis,16^2^"m.d."( <fis8 fis,> <e! e,!>
     %4
     <)dis,4 a' dis>
@@ -56,10 +69,17 @@ treble = \context Voice=treble \notes\relative c''{
     \property Voice.Slur \push #'direction = #1
     \property PianoStaff.connectArpeggios = ##t
     \property Voice.TextSpanner \pop #'type
+
+    %% Ghostview is ok, but xdvi shows a solid line
+    \property Voice.TextSpanner \push #'line-thickness = #2
+    \property Voice.TextSpanner \push #'dash-period = #0.5
+
     \property Voice.TextSpanner \push #'type = #"dotted-line"
     \property Voice.TextSpanner \push #'edge-height = #'(0 . 1.5)
-    \property Voice.TextSpanner \push #'edge-text = #'("8va " . "")
+    \property Voice.TextSpanner \push #'edge-text = #'("8 " . "")
     \property Staff."c0-position" = #-13
+    \outputproperty #(make-text-checker "m")
+	    #'extra-offset = #'(-6 . 2)
     cis''''4^"m.g."\arpeggio \spanrequest \start "text"  (
 
 #ifndef FAKE_GRACE
@@ -84,12 +104,21 @@ treble = \context Voice=treble \notes\relative c''{
 
 #else % FAKE_GRACE 
 
+    \property Score.PaperColumn  \push #'space-factor = #0.6
+    \property Score.PaperColumn  \push #'to-musical-spacing-factor = #0.04
     \property Voice.NoteHead \push #'font-size = #-1
     \property Voice.Stem \push #'font-size = #-1
+    \property Voice.Stem \push #'length = #6
+    \property Voice.Stem \push #'beamed-lengths =
+        #(map (lambda (x) (* 1.25 x)) '(0.0 2.5 2.0 1.5))
+    \property Voice.Stem \push #'beamed-minimum-lengths =
+        #(map (lambda (x) (* 1.25 x)) '(0.0 1.5 1.25 1.0))
+
     \property Voice.Beam \push #'font-size = #-1
     \property Voice.TextScript \push #'font-size = #-1
+    \property Voice.Fingering \push #'font-size = #-1
     \property Voice.Slur \push #'font-size = #-1
-    \property Voice.LocalKey \push #'font-size = #-1
+    \property Staff.Accidentals \push #'font-size = #-1
     \property Voice.Beam \push #'space-function = #grace-beam-space-function
 
     )cis16
@@ -103,12 +132,17 @@ treble = \context Voice=treble \notes\relative c''{
 
     \property Voice.NoteHead \pop #'font-size
     \property Voice.Stem \pop #'font-size
+    \property Voice.Stem \pop #'length
+    \property Voice.Stem \pop #'beamed-lengths
+    \property Voice.Stem \pop #'beamed-minimum-lengths
     \property Voice.Beam \pop #'font-size
     \property Voice.TextScript \pop #'font-size
+    \property Voice.Fingering \pop #'font-size
     \property Voice.Slur \pop #'font-size
-    \property Voice.LocalKey \pop #'font-size
+    \property Staff.Accidentals \pop #'font-size
     \property Voice.Beam \pop #'space-function
-
+    \property Score.PaperColumn  \pop #'space-factor
+    \property Score.PaperColumn \pop #'to-musical-spacing-factor
 #endif % FAKE_GRACE
     
 
@@ -121,23 +155,23 @@ treble = \context Voice=treble \notes\relative c''{
 }
 
 trebleTwo = \context Voice=trebleTwo \notes\relative c''{
-    % Broken?
     \property Voice.NoteColumn \push #'horizontal-shift = #1
     s2
     s1*2
     s4
     \property Voice.Stem \pop #'direction
     \property Voice.Stem \push #'direction = #-1
-    <cis4\arpeggio a fis dis>
+    <cis'4\arpeggio a fis dis>
 
 #ifdef FAKE_GRACE
     s32*16
 #endif
 
     \property Voice.NoteColumn \push #'force-hshift = #-0.2
-    <e2 gis, e d>
-    %r8 cis4. d4 [<cis8-5-4( e,-1> <b-3 d,-1> |
-    r8 cis4. d4
+    <e,2 gis, e d>
+    % Hmm s/r?
+    %r8 cis4. d4
+    s8 cis4. d4
     \property Voice.NoteColumn \pop #'force-hshift
     [<cis8( e,> <b-3 d,-1> |
     \property Voice.NoteColumn \push #'force-hshift = #-0.2
@@ -148,14 +182,9 @@ trebleTwo = \context Voice=trebleTwo \notes\relative c''{
 }
 
 bass = \context Voice=bass \notes\relative c{
-    \property Voice.Slur \pop #'details
     \property Voice.Slur \push #'details =
-%        #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 1.0))
-        #'((height-limit . 6.0) (ratio . 0.333) (force-blowfit . 1.0) (beautiful . 0.1))
-    \property Voice.Slur \pop #'de-uglify-parameters
-    \property Voice.Slur \push #'de-uglify-parameters =
-%    #'(1.5  0.8  -2.0)
-    #'(2.4  0.8  4.0)
+          #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 5.0))
+    \property Voice.Slur \push #'attachment-offset = #'((0 . -3) . (0 . -6))
     \property Voice.Stem \pop #'direction
     \property Voice.Slur \push #'direction = #-1
     % huh, auto-beamer?
@@ -187,8 +216,7 @@ bass = \context Voice=bass \notes\relative c{
     r2
     %4
     \property Voice.Slur \pop #'details
-    \property Voice.Slur \push #'details =
-        #'((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5))
+    \property Voice.Slur \pop #'attachment-offset
     \property Voice.Stem \pop #'direction
     \property Voice.Stem \push #'direction = #-1
     <b,,4 b,>
@@ -205,12 +233,28 @@ bass = \context Voice=bass \notes\relative c{
     %Hmm
     %\grace { s16 s s s s32 s s s s \clef bass; s }
     \clef bass;
+    \grace { <e,,,32( e,> } <)gis'2 e>
 #else
-    s4 s8 s32 s  s \clef bass; s
-#endif
+    s4 s8 s32 s  s \clef bass;
+    \property Score.PaperColumn  \push #'space-factor = #0.6
+    \property Score.PaperColumn  \push #'to-musical-spacing-factor = #0.1
+    \property Voice.NoteHead \push #'font-size = #-1
+    \property Voice.Stem \push #'font-size = #-1
+    \property Voice.Stem \push #'length = #6
+    \property Voice.Slur \push #'font-size = #-1
+    \property Voice.Slur \push #'attachment-offset = #'((-0.5 . 0) . (0.5 . 0))
+    <e,,,32( e,>
 
-    \grace { <e,,,32( e,> } <)gis'2 e>
-    %5%
+    \property Voice.NoteHead \pop #'font-size
+    \property Voice.Stem \pop #'font-size
+    \property Voice.Stem \pop #'length
+    \property Voice.Slur \pop #'font-size
+    \property Score.PaperColumn  \pop #'space-factor
+    \property Score.PaperColumn \pop #'to-musical-spacing-factor
+     <)gis'2 e>
+    \property Voice.Slur \pop #'attachment-offset
+#endif
+    %5
     \property Voice.Slur \pop #'direction
     \property Voice.Slur \push #'direction = #1
     a,8 [e'-5(<)a-2 cis-3>]
@@ -266,11 +310,14 @@ middleDynamics = \context Dynamics=middle \notes{
     s8 s4
 
     \outputproperty #(make-type-checker 'dynamic-interface) 
-	    #'extra-offset = #'(0 . 3.5)
-    s1\mf-"a tempo"
-    s8
+	    #'extra-offset = #'(0 . 4)
+    %s1\mf-"a tempo"
+    s2\mf-"a tempo" s4
+    \outputproperty #(make-type-checker 'crescendo-interface) 
+	    #'extra-offset = #'(0.5 . -1)
+    s\> \!s8
     \outputproperty #(make-type-checker 'dynamic-interface) 
-	    #'extra-offset = #'(-1 . 3.5)
+	    #'extra-offset = #'(-1 . 4)
     s8\mf s4 s4 s8\> s32 s s \!s
 }
 
@@ -335,20 +382,22 @@ lowerDynamics = \context Dynamics=lower \notes{
 	>
     >
     \paper {
+	%%BURP
+	magnification_italic = 1.;
 	\translator {
 	    \ScoreContext
 	    TimeSignature \push #'style = #"C"
+	    SpacingSpanner \push #'maximum-duration-for-spacing = #(make-moment 1 4)
+
+	    \remove Bar_number_engraver;
         }
 	\translator {
 	    \type "Engraver_group_engraver";
 	    \name Dynamics;
 	    \consists "Output_property_engraver";
 	    Generic_property_list = #generic-voice-properties
-	    %Generic_property_list = #generic-lyrics-properties
 	    \consists "Property_engraver";
 	    DynamicsMinimumVerticalExtent = #(cons -3 -3)
-	    %VerticalAlignment \push #'threshold = #'(8 . 8) 
-	    %VerticalAlignment \push #'threshold = #'(10 . 10) 
 	    VerticalAlignment \push #'threshold = #'(9 . 9) 
 
 	    startSustain = #"Ped."
@@ -356,7 +405,6 @@ lowerDynamics = \context Dynamics=lower \notes{
 	    stopStartSustain = #"*Ped."
 	    startUnaChorda = #"una chorda"
 	    stopUnaChorda = #"tre chorde"
-	    % should make separate lists for stopsustain and startsustain 
 	    
 	    \consists "Piano_pedal_engraver";
 	    \consists "Script_engraver";
@@ -364,25 +412,16 @@ lowerDynamics = \context Dynamics=lower \notes{
 	    \consists "Text_engraver";
 	    %GURGURGU, text is initialised using TextScript
 	    TextScript \push #'style = #"italic"
-	    TextScript \push #'font-size = #2
+	    %%% TextScript \push #'font-size = #2
 
 	    \consists "Skip_req_swallow_translator";
 
 	    \consistsend "Axis_group_engraver";
     	}
 
-	\translator {
-	    \VoiceContext
-	    %TextScript \push #'style = #"italic"
-	    %TextScript \push #'font-size = #3
-	    TextScript \push #'size = #"Large"
-	    TextScript \push #'font-size = #"Large"
-        }
 	\translator {
 	    \PianoStaffContext
 	    \accepts Dynamics;
-	    %VerticalAlignment \push #'threshold = #'(8 . 8) 
-	    %VerticalAlignment \push #'threshold = #'(6 . 6)
 	    VerticalAlignment \push #'threshold = #'(7 . 7)
         }
 	\translator {
diff --git a/lily/arpeggio.cc b/lily/arpeggio.cc
index 7f889715db..e432c710a8 100644
--- a/lily/arpeggio.cc
+++ b/lily/arpeggio.cc
@@ -84,6 +84,7 @@ Arpeggio::brew_molecule (SCM smob)
 /*
   We have to do a callback, because brew_molecule () triggers a
   vertical alignment if it is cross-staff.
+  This callback alos adds padding.
 */
 MAKE_SCHEME_CALLBACK(Arpeggio, width_callback,2);
 SCM
@@ -94,5 +95,5 @@ Arpeggio::width_callback (SCM smob, SCM axis)
   assert (a == X_AXIS);
   Molecule arpeggio = me->paper_l ()->lookup_l (0)->afm_find ("scripts-arpeggio");
 
-  return ly_interval2scm (arpeggio.extent (X_AXIS));
+  return ly_interval2scm (arpeggio.extent (X_AXIS) * 1.5);
 }
diff --git a/lily/include/slur.hh b/lily/include/slur.hh
index 797bdc321b..82f5b9a125 100644
--- a/lily/include/slur.hh
+++ b/lily/include/slur.hh
@@ -46,23 +46,25 @@
 class Slur
 {
 public:
-  static void add_column (Score_element*me,Score_element*col);
-  DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
+  static void add_column (Score_element *me, Score_element *col);
+  DECLARE_SCHEME_CALLBACK (brew_molecule, (SCM));
   static void set_interface (Score_element*);
   static bool  has_interface (Score_element*);
-  static Array<Offset> get_encompass_offset_arr (Score_element*me) ;
-  static Bezier get_curve (Score_element*me) ;
-  static Direction get_default_dir (Score_element*me) ;
-  DECLARE_SCHEME_CALLBACK(after_line_breaking, (SCM ));
-  DECLARE_SCHEME_CALLBACK(set_spacing_rods, (SCM ));
+  static Array<Offset> get_encompass_offset_arr (Score_element *me);
+  static Bezier get_curve (Score_element *me);
+  static Direction get_default_dir (Score_element *me);
+  DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+  DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
+
 private:  
   static Real get_first_notecolumn_y (Score_element *me, Direction dir);
   static Offset broken_trend_offset (Score_element *me, Direction dir);
-  static Offset get_attachment (Score_element*me,Direction dir, Score_element**common) ;
-  static void de_uglyfy (Score_element*me,Slur_bezier_bow* bb, Real default_height);
-  static void set_extremities (Score_element*me);
-  static void set_control_points (Score_element*me);
-  static Offset encompass_offset (Score_element*me,Score_element *col,Score_element**common);
+  static Offset get_attachment (Score_element *me,Direction dir, Score_element **common);
+  static void de_uglyfy (Score_element *me,Slur_bezier_bow* bb, Real default_height);
+  static void set_extremities (Score_element *me);
+  static void set_control_points (Score_element *me);
+  static void check_slope (Score_element *me);
+  static Offset encompass_offset (Score_element *me, Score_element *col, Score_element **common);
 };
 
 #endif // SLUR_HH
diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc
index cb3577a163..187f1b689a 100644
--- a/lily/score-engraver.cc
+++ b/lily/score-engraver.cc
@@ -32,8 +32,8 @@ Score_engraver::prepare (Moment w)
 {
   Global_translator::prepare (w);
 
-  SCM props = get_property (ly_symbol2scm ("PaperColumn"));
-  set_columns (new Paper_column (props),  new Paper_column (props));
+  set_columns (new Paper_column (get_property (ly_symbol2scm ("NonMusicalPaperColumn"))),
+	       new Paper_column (get_property (ly_symbol2scm ("PaperColumn"))));
   
   command_column_l_->set_elt_property ("when", w.make_scm());
   musical_column_l_->set_elt_property ("when", w.make_scm());
diff --git a/lily/slur.cc b/lily/slur.cc
index 38d163fde7..63420539c5 100644
--- a/lily/slur.cc
+++ b/lily/slur.cc
@@ -11,7 +11,6 @@
   [TODO]
     * fix broken interstaff slurs
     * begin and end should be treated as a/acknowledge Scripts.
-    * broken slur should have uniform trend
     * smart changing of endings
     * smart changing of (Y-?)offsets to avoid ugly beziers
        (along-side-stem)
@@ -122,11 +121,53 @@ Slur::after_line_breaking (SCM smob)
   return SCM_UNSPECIFIED;
 } 
 
+
 void
-Slur::set_extremities (Score_element*me)
+Slur::check_slope (Score_element *me)
+{
+  /*
+    Avoid too steep slurs.
+   */
+  SCM s = me->get_elt_property ("slope-limit");
+  if (gh_number_p (s))
+    {
+      Array<Offset> encompass = get_encompass_offset_arr (me);
+      Drul_array<Offset> attachment;
+      attachment[LEFT] = encompass[0];
+      attachment[RIGHT] = encompass.top ();
+
+      Real dx = attachment[RIGHT][X_AXIS] - attachment[LEFT][X_AXIS];
+      Real dy = attachment[RIGHT][Y_AXIS] - attachment[LEFT][Y_AXIS];
+      if (!dx)
+	return;
+      
+      Real slope = slope = abs (dy / dx);
+
+      Real limit = gh_scm2double (s);
+
+      if (slope > limit)
+	{
+	  Real staff_space = Staff_symbol_referencer::staff_space ((Score_element*)me);
+	  Direction dir = (Direction)gh_scm2int (me->get_elt_property ("direction"));
+	  Direction d = (Direction)(- dir * (sign (dy)));
+	  SCM a = me->get_elt_property ("attachment-offset");
+	  Drul_array<Offset> o;
+	  o[LEFT] = ly_scm2offset (index_cell (a, LEFT));
+	  o[RIGHT] = ly_scm2offset (index_cell (a, RIGHT));
+	  o[d][Y_AXIS] -= (limit - slope) * dx * dir / staff_space;
+	  //o[d][Y_AXIS] = attachment[-d][Y_AXIS] + (dx * limit * dir / staff_space);
+	  me->set_elt_property ("attachment-offset",
+				gh_cons (ly_offset2scm (o[LEFT]),
+					 ly_offset2scm (o[RIGHT])));
+	}
+    }
+}
+
+void
+Slur::set_extremities (Score_element *me)
 {
   if (!Directional_element_interface::get (me))
-    Directional_element_interface ::set (me,get_default_dir (me));
+    Directional_element_interface::set (me, get_default_dir (me));
 
   Direction dir = LEFT;
   do 
@@ -148,8 +189,11 @@ Slur::set_extremities (Score_element*me)
 	}
     }
   while (flip (&dir) != LEFT);
+
+  check_slope (me);
 }
 
+
 Real
 Slur::get_first_notecolumn_y (Score_element *me, Direction dir)
 {
@@ -199,7 +243,10 @@ Slur::broken_trend_offset (Score_element *me, Direction dir)
 					     me->get_elt_property ("direction"));
 	      Real neighbour_y = get_first_notecolumn_y (neighbour, dir);
 	      Real y = get_first_notecolumn_y (me, -dir);
-	      o = Offset (0, (y + neighbour_y) / 2);
+	      int neighbour_cols = scm_ilength (neighbour->get_elt_property ("note-columns"));
+	      int cols = scm_ilength (me->get_elt_property ("note-columns"));
+	      o = Offset (0, (y*neighbour_cols + neighbour_y*cols) /
+			  (cols + neighbour_cols));
 	      break;
 	    }
 	}
@@ -208,7 +255,7 @@ Slur::broken_trend_offset (Score_element *me, Direction dir)
 }
 
 Offset
-Slur::get_attachment (Score_element*me,Direction dir,
+Slur::get_attachment (Score_element *me, Direction dir,
 		      Score_element **common) 
 {
   SCM s = me->get_elt_property ("attachment");
@@ -220,8 +267,8 @@ Slur::get_attachment (Score_element*me,Direction dir,
   SCM a = dir == LEFT ? gh_car (s) : gh_cdr (s);
   Spanner*sp = dynamic_cast<Spanner*>(me);
   String str = ly_symbol2string (a);
-  Real ss = Staff_symbol_referencer::staff_space ((Score_element*)me);
-  Real hs = ss / 2.0;
+  Real staff_space = Staff_symbol_referencer::staff_space ((Score_element*)me);
+  Real hs = staff_space / 2.0;
   Offset o;
   
   Score_element *stem = 0;
@@ -239,7 +286,8 @@ Slur::get_attachment (Score_element*me,Direction dir,
 		Default position is centered in X, on outer side of head Y
 	       */
 	      o += Offset (0.5 * n->extent (n,X_AXIS).length (),
-			   0.5 * ss * Directional_element_interface::get (me));
+			   0.5 * staff_space
+			   * Directional_element_interface::get (me));
 	    }
 	  else if (str == "alongside-stem")
 	    {
@@ -249,7 +297,8 @@ Slur::get_attachment (Score_element*me,Direction dir,
 	       */
 	      o += Offset (n->extent (n,X_AXIS).length ()
 			   * (1 + Stem::get_direction (stem)),
-			   0.5 * ss * Directional_element_interface::get (me));
+			   0.5 * staff_space
+			   * Directional_element_interface::get (me));
 	    }
 	  else if (str == "stem")
 	    {
@@ -295,7 +344,7 @@ int stemdir = stem ? Stem::get_direction (stem) : 1;
 
   if (l != SCM_BOOL_F)
     {
-      o += ly_scm2offset (gh_cdr (l)) * ss * dir;
+      o += ly_scm2offset (gh_cdr (l)) * staff_space * dir;
     }
 
   /*
@@ -308,6 +357,8 @@ int stemdir = stem ? Stem::get_direction (stem) : 1;
 	- me->relative_coordinate (common[Y_AXIS], Y_AXIS);
     }
 
+  o += ly_scm2offset (index_cell (me->get_elt_property ("attachment-offset"),
+				  dir)) * staff_space;
   return o;
 }
 
@@ -356,12 +407,12 @@ Slur::encompass_offset (Score_element*me,
 }
 
 Array<Offset>
-Slur::get_encompass_offset_arr (Score_element*me) 
+Slur::get_encompass_offset_arr (Score_element *me)
 {
   Spanner*sp = dynamic_cast<Spanner*>(me);
   SCM eltlist = me->get_elt_property ("note-columns");
-  Score_element *common[] = {me->common_refpoint (eltlist,X_AXIS),
-			     me->common_refpoint (eltlist,Y_AXIS)};
+  Score_element *common[] = {me->common_refpoint (eltlist, X_AXIS),
+			     me->common_refpoint (eltlist, Y_AXIS)};
 
 
   common[X_AXIS] = common[X_AXIS]->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc
index a1f329fc37..c5b306092a 100644
--- a/lily/spacing-spanner.cc
+++ b/lily/spacing-spanner.cc
@@ -75,6 +75,18 @@ Spacing_spanner::do_measure (Score_element*me, Link_array<Score_element> cols)
 
       Item* combinations[4][2]={{l,r}, {lb,r}, {l,rb},{lb,rb}};
 
+
+      /*
+	left refers to the space that is associated with items of the left column, so you have
+
+	  LC  <- left_space -><- right_space -> RC
+              <-    total space              ->
+	      
+
+        typically, right_space is non-zero when there are
+        accidentals in RC
+	  
+       */
       for (int j=0; j < 4; j++)
 	{
 	  Paper_column * lc = dynamic_cast<Paper_column*> (combinations[j][0]);
@@ -115,10 +127,11 @@ Spacing_spanner::do_measure (Score_element*me, Link_array<Score_element> cols)
 	    We want the space before barline to be like the note
 	    spacing in the measure.
 	  */
+	  SCM sfac =lc->get_elt_property ("space-factor");
 	  if (Item::breakable_b (lc) || lc->original_l_)
-	    s.strength_f_ = non_musical_space_strength;
-	  else if (!lc->musical_b ())
-	    left_distance *= me->paper_l ()->get_var ("decrease_nonmus_spacing_factor");
+	    s.strength_f_ =  non_musical_space_strength;
+	  else if (gh_number_p (sfac))
+	    left_distance *= gh_scm2double (sfac);
 
 	  
 	  Real right_dist = 0.0;
@@ -135,15 +148,14 @@ Spacing_spanner::do_measure (Score_element*me, Link_array<Score_element> cols)
 	  /*
 	    don't want to create too much extra space for accidentals
 	  */
-	  if (lc->musical_b () && rc->musical_b ())
-	    {
-	      if (!to_boolean (rc->get_elt_property ("contains-grace")))
-		right_dist *= me->paper_l ()->get_var ("musical_to_musical_left_spacing_factor");
-	    }
+	  if (rc->musical_b ())
+	   {
+	      if (to_boolean (rc->get_elt_property ("contains-grace")))
+		right_dist *= me->paper_l ()->get_var ("before_grace_spacing_factor"); // fixme.
+	      else
+		right_dist *= gh_scm2double (lc->get_elt_property ("before-musical-spacing-factor"));
+	   }
 
-	  if (rc->musical_b () && to_boolean (rc->get_elt_property ("contains-grace")))
-	    right_dist *= me->paper_l ()->get_var ("before_grace_spacing_factor");
- 
  	  s.distance_f_ = left_distance + right_dist;
 	    
 	  Real stretch_dist = 0.;
diff --git a/ly/engraver.ly b/ly/engraver.ly
index d24a5da6f2..6db1546235 100644
--- a/ly/engraver.ly
+++ b/ly/engraver.ly
@@ -445,6 +445,7 @@ ScoreContext = \translator {
  		(molecule-callback . ,Arpeggio::brew_molecule)
 		(Y-offset-callbacks . (,Staff_symbol_referencer::callback))
 		(X-offset-callbacks . (,Side_position::aligned_side))
+		(right-padding . 0.4)  ; Hmm, not generic?
 		(direction . -1)
 		(staff-position . 0.0)
  		(name . "Arpeggio") 
@@ -730,7 +731,13 @@ ScoreContext = \translator {
 	PaperColumn = #`(
 		(interfaces . (paper-column-interface axis-group-interface))
 		(axes 0)
-		(rank . -1)
+		(before-musical-spacing-factor . 0.4)
+		(name . "PaperColumn")
+	)
+	NonMusicalPaperColumn = #`(
+		(interfaces . (paper-column-interface axis-group-interface))
+		(axes 0)
+		(before-musical-spacing-factor . 1.0)
 		(name . "PaperColumn")
 	)
 
@@ -760,7 +767,22 @@ ScoreContext = \translator {
 		(name . "ScriptColumn")
 	)
 	
-	Slur = #default-basic-slur-properties
+	Slur = #`(
+	        (interfaces . (slur-interface))
+		(molecule-callback . ,Slur::brew_molecule)
+		(thickness . 1.2)		
+		(spacing-procedure . ,Slur::set_spacing_rods)		
+		(minimum-length . 1.5)
+		(after-line-breaking-callback . ,Slur::after_line_breaking)
+		(extremity-rules . ,default-slur-extremity-rules)
+		(extremity-offset-alist . ,default-slur-extremity-offset-alist)
+		(de-uglify-parameters . ( 1.5  0.8  -2.0))
+		(details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5)))
+		(y-free . 0.75)
+		(slope-limit . 0.8)
+		(attachment-offset . ((0 . 0) . (0 . 0)))
+		(name . "Slur")
+		)
 
 	SpacingSpanner =#`(
 		(spacing-procedure . ,Spacing_spanner::set_springs)
diff --git a/scm/basic-properties.scm b/scm/basic-properties.scm
index 37fe4c1944..d5f5d1a947 100644
--- a/scm/basic-properties.scm
+++ b/scm/basic-properties.scm
@@ -26,8 +26,8 @@
 ;
 (define (default-beam-flag-width-function type)
   (cond
-   ((eq? type 1) 1.98)
-   ((eq? type 1) 1.65)
+   ((eq? type 1) 1.98) 
+   ((eq? type 1) 1.65) ;; FIXME: check what this should be and why
    (else 1.32)
    ))
 
diff --git a/scm/slur.scm b/scm/slur.scm
index 41150ef8d6..046d86ddcf 100644
--- a/scm/slur.scm
+++ b/scm/slur.scm
@@ -100,19 +100,4 @@
     ))
 
 
-(define default-basic-slur-properties
-  `(
-   (interfaces . (slur-interface))
-   (molecule-callback . ,Slur::brew_molecule)
-   (thickness . 1.2)		
-   (spacing-procedure . ,Slur::set_spacing_rods)		
-   (minimum-length . 1.5)
-   (after-line-breaking-callback . ,Slur::after_line_breaking)
-   (extremity-rules . ,default-slur-extremity-rules)
-   (extremity-offset-alist . ,default-slur-extremity-offset-alist)
-   (de-uglify-parameters . ( 1.5  0.8  -2.0))
-   (details . ((height-limit . 2.0) (ratio . 0.333) (force-blowfit . 0.5) (beautiful . 0.5)))
-   (y-free . 0.75)
-   (name . "Slur")
-   )
-  )
+
-- 
2.39.5