From 0aa6050c41ee55f6db06d0bb966fd3102c06f6bf Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Mon, 2 Jul 2012 20:27:46 +0200 Subject: [PATCH] Reject \footnote ... \default without grob specification 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 | 23 +---------------------- ly/music-functions-init.ly | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 32 deletions(-) diff --git a/lily/footnote-engraver.cc b/lily/footnote-engraver.cc index 830fdfe972..06a2568367 100644 --- a/lily/footnote-engraver.cc +++ b/lily/footnote-engraver.cc @@ -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]); } } diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index f8274cfbc4..9f7fcf8f96 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -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 -- 2.39.5