]> git.donarmstrong.com Git - lilypond.git/commitdiff
Reject \footnote ... \default without grob specification
authorDavid Kastrup <dak@gnu.org>
Mon, 2 Jul 2012 18:27:46 +0000 (20:27 +0200)
committerDavid Kastrup <dak@gnu.org>
Fri, 6 Jul 2012 05:43:22 +0000 (07:43 +0200)
The behavior of \footnote ... \default without grob specification is,
for most purposes, indistinguishable from user error.  In consequence,
it has been turned into user error.

As one consequence, support for the undocumented and inefficient
compatibility mode for use of not-actually-time-based footnotes as an
articulation (-\footnote ... \default) has been removed.  This can
occur as the result of convert-ly from older variants of \footnote
syntax.  Targetting a NO_SMART conversion error message of convert-ly
for this use case is so much more tricky and error-prone than printing
a warning at run-time that it has not been attempted.

lily/footnote-engraver.cc
ly/music-functions-init.ly

index 830fdfe97227c6b06412bd4ab66d8a73f69891c0..06a2568367222c8c9cfee0e9bbe4b6e96d47e6cb 100644 (file)
@@ -115,31 +115,10 @@ Footnote_engraver::acknowledge_grob (Grob_info info)
       return;
     }
 
-  // The following performance hog should eventually be removed:
-  // instead of adding a -\footnote ... \default articulation at the
-  // end of a note, you can perfectly well use \footnote ... before
-  // the note.  This is just for the sake of automatic convert-ly
-  // rules.
-
-  Stream_event *cause = info.event_cause ();
-
-  SCM arts = cause ? cause->get_property ("articulations") : SCM_EOL;
-  for (SCM s = arts; scm_is_pair (s); s = scm_cdr (s))
-    {
-      Stream_event *e = unsmob_stream_event (scm_car (s));
-      if (e->in_event_class ("footnote-event"))
-        footnotify (info.grob (), e);
-    }
-
-  // In contrast, the following code is only called when actual
-  // footnote events have been listened to.  It should not affect
-  // performance.
-
   for (vsize i = 0; i < events_.size (); i++)
     {
       SCM name = events_[i]->get_property ("symbol");
-      if (!scm_is_symbol (name)
-         || info.grob ()->name () == ly_symbol2string (name))
+      if (info.grob ()->name () == ly_symbol2string (name))
         footnotify (info.grob (), events_[i]);
     }
 }
index f8274cfbc4129af8d058eda2fd6d337da088d2bf..9f7fcf8f9623a9c09fab707a0d5027be28c8bbc1 100644 (file)
@@ -372,16 +372,19 @@ to the preceding note or rest as a post-event with @code{-}.")
               'text (or mark (make-null-markup))
               'footnote-text footnote
               'symbol (or grob-name '()))))
-     (if music
-        (begin
-          (set! (ly:music-property music 'tweaks)
-                (acons (if grob-name
-                           (cons grob-name 'footnote-music)
-                           'footnote-music)
-                       mus
-                       (ly:music-property music 'tweaks)))
-          music)
-        mus)))
+     (cond (music
+           (set! (ly:music-property music 'tweaks)
+                 (acons (if grob-name
+                            (cons grob-name 'footnote-music)
+                            'footnote-music)
+                        mus
+                        (ly:music-property music 'tweaks)))
+           music)
+          (grob-name mus)
+          (else
+           (ly:input-warning location
+                             (_ "\\footnote requires music or grob-name"))
+           (make-music 'Music)))))
 
 grace =
 #(def-grace-function startGraceMusic stopGraceMusic