]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 2976: Allow ly:grob-set-nested-property! to set a single (unnested) property
authorDavid Kastrup <dak@gnu.org>
Sat, 24 Nov 2012 17:57:00 +0000 (18:57 +0100)
committerDavid Kastrup <dak@gnu.org>
Fri, 30 Nov 2012 12:37:29 +0000 (13:37 +0100)
This makes things more orthogonal.

lily/grob-scheme.cc
ly/music-functions-init.ly

index 1fe50f00f18b49afb443c5a91ff6014f0c9c3321..e5976a569b799b4db7a4fa6562afe6ee4953cb0f 100644 (file)
@@ -66,7 +66,7 @@ LY_DEFINE (ly_grob_set_nested_property_x, "ly:grob-set-nested-property!",
 
   LY_ASSERT_SMOB (Grob, grob, 1);
 
-  bool type_ok = ly_cheap_is_list (symlist);
+  bool type_ok = scm_is_pair (symlist);
 
   if (type_ok)
     for (SCM s = symlist; scm_is_pair (s) && type_ok; s = scm_cdr (s))
@@ -74,7 +74,10 @@ LY_DEFINE (ly_grob_set_nested_property_x, "ly:grob-set-nested-property!",
 
   SCM_ASSERT_TYPE (type_ok, symlist, SCM_ARG2, __FUNCTION__, "list of symbols");
 
-  set_nested_property (sc, symlist, val);
+  if (scm_is_pair (scm_cdr (symlist)))
+    set_nested_property (sc, symlist, val);
+  else
+    ly_grob_set_property_x (grob, scm_car (symlist), val);
   return SCM_UNSPECIFIED;
 }
 
@@ -477,4 +480,4 @@ LY_DEFINE (ly_grob_get_vertical_axis_group_index, "ly:grob-get-vertical-axis-gro
   LY_ASSERT_SMOB (Grob, grob, 1);
 
   return scm_from_int (Grob::get_vertical_axis_group_index (gr));
-}
\ No newline at end of file
+}
index 3b25cca5440a1a3e2992e2b7e1eefa10206c7e07..a6a91174ff531e074763fe67a6aac44dd5c1369d 100644 (file)
@@ -736,10 +736,8 @@ with subproperties given as well.")
                        (if (equal?
                             (cdr (assoc 'name (ly:grob-property grob 'meta)))
                             (second p))
-                         (if (null? (cdddr p))
-                             (ly:grob-set-property! grob (caddr p) value)
-                             (ly:grob-set-nested-property!
-                              grob (cddr p) value)))))
+                           (ly:grob-set-nested-property!
+                            grob (cddr p) value))))
          (make-music 'Music))))