From 3c6b689307064879dee14768cc4487584345199b Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Mon, 16 Jun 2003 23:05:11 +0000 Subject: [PATCH] * scm/music-functions.scm (make-ottava-set): only do ottavation if centralCPosition is set. * lily/translator-scheme.cc (ly:context-property-where-defined): return '() if not found. --- ChangeLog | 8 ++++++ input/test/gourlay.ly | 10 ++++++-- lily/translator-scheme.cc | 5 +++- scm/music-functions.scm | 52 ++++++++++++++++++++------------------- 4 files changed, 47 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5801b8d872..10bacef668 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-06-17 Han-Wen Nienhuys + + * scm/music-functions.scm (make-ottava-set): + only do ottavation if centralCPosition is set. + + * lily/translator-scheme.cc (ly:context-property-where-defined): + return '() if not found. + 2003-06-17 Heikki Junes * lilypond-mode.el (LilyPond-un-comment-region): removed. diff --git a/input/test/gourlay.ly b/input/test/gourlay.ly index ef7572e0cd..1b0a170ccd 100644 --- a/input/test/gourlay.ly +++ b/input/test/gourlay.ly @@ -1,6 +1,12 @@ \version "1.7.18" -\header{ texidoc="@cindex Gourlay -This is taken from Gourlay's paper on breaking lines. " } +\header{ + + texidoc="@cindex Gourlay + +This is taken from Gourlay's paper on +breaking lines. " + +} \score{ \notes \context Staff \relative c'' < diff --git a/lily/translator-scheme.cc b/lily/translator-scheme.cc index 2ced54dbf1..da08478fae 100644 --- a/lily/translator-scheme.cc +++ b/lily/translator-scheme.cc @@ -54,7 +54,10 @@ LY_DEFINE(ly_context_property_where_defined, SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context"); SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol"); - return tr->where_defined (name)->self_scm(); + + tr = tr->where_defined (name); + if (tr) + return tr? tr->self_scm(): SCM_EOL; } LY_DEFINE(ly_unset_context_property, diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 266b0d66d1..3945e10a55 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -308,31 +308,33 @@ a property set for MultiMeasureRestNumber." "Either reset centralCPosition to the stored original, or remember old centralCPosition, add OCTAVATION to centralCPosition, and set OTTAVATION to `8va', or whatever appropriate." - (if (= octavation 0) - (let* - ((where (ly:context-property-where-defined context 'centralCPosition)) - (oc0 (ly:get-context-property context 'originalCentralCPosition)) ) - - (ly:set-context-property context 'centralCPosition oc0) - (ly:unset-context-property where 'originalCentralCPosition) - (ly:unset-context-property where 'ottavation)) - - (let* - ((where (ly:context-property-where-defined context 'centralCPosition)) - (c0 (ly:get-context-property context 'centralCPosition)) - (new-c0 (+ c0 (* -7 octavation))) - (string (cdr - (assoc octavation '((2 . "15ma") - (1 . "8va") - (0 . #f) - (-1 . "8va bassa") - (-2 . "15ma bassa")))))) - - (ly:set-context-property context 'centralCPosition new-c0) - (ly:set-context-property context 'originalCentralCPosition c0) - (ly:set-context-property context 'ottavation string) - - ))) + (if (number? (ly:get-context-property context 'centralCPosition)) + + (if (= octavation 0) + (let* + ((where (ly:context-property-where-defined context 'centralCPosition)) + (oc0 (ly:get-context-property context 'originalCentralCPosition))) + + (ly:set-context-property context 'centralCPosition oc0) + (ly:unset-context-property where 'originalCentralCPosition) + (ly:unset-context-property where 'ottavation)) + + (let* + ((where (ly:context-property-where-defined context 'centralCPosition)) + (c0 (ly:get-context-property context 'centralCPosition)) + (new-c0 (+ c0 (* -7 octavation))) + (string (cdr + (assoc octavation '((2 . "15ma") + (1 . "8va") + (0 . #f) + (-1 . "8va bassa") + (-2 . "15ma bassa")))))) + + (ly:set-context-property context 'centralCPosition new-c0) + (ly:set-context-property context 'originalCentralCPosition c0) + (ly:set-context-property context 'ottavation string) + + )))) (ly:set-mus-property! m 'procedure ottava-modify) (context-spec-music m "Staff") -- 2.39.2