+
+ /*
+ ignore interspersed grace notes.
+ */
+ Moment now = now_mom ();
+ if (!is_same_grace_state (beam_start_location_, now))
+ return;
+
+ Duration *stem_duration = unsmob<Duration> (ev->get_property ("duration"));
+ Moment dur = stem_duration->get_length ();
+
+ //Moment dur = unsmob<Duration> (ev->get_property ("duration"))->get_length ();
+ Moment measure_now = measure_position (context ());
+ bool recheck_needed = false;
+
+ if (dur < shortest_mom_)
+ {
+ /* new shortest moment, so store it and set recheck_needed */
+ shortest_mom_ = dur;
+ recheck_needed = true;
+ }
+
+ /* end should be based on shortest_mom_, begin should be
+ based on current duration */
+ consider_end (measure_now, shortest_mom_);
+ consider_begin (measure_now, dur);
+
+ if (!stems_)
+ return;
+
+ grouping_->add_stem (now - beam_start_moment_ + beam_start_location_,
+ durlog - 2,
+ Stem::is_invisible (stem),
+ stem_duration->factor (),
+ (to_boolean (stem->get_property ("tuplet-start"))));
+ stems_->push_back (stem);
+ last_add_mom_ = now;
+ extend_mom_ = max (extend_mom_, now) + get_event_length (ev, now);
+ if (recheck_needed)
+ recheck_beam ();
+}
+
+void
+Auto_beam_engraver::recheck_beam ()
+{
+ /*
+ Recheck the beam after the shortest duration has changed
+ If shorter duration has created a new break, typeset the
+ first part of the beam and reset the current beam to just
+ the last part of the beam
+ */
+ Beaming_pattern *new_grouping_ = 0;
+ vector<Item *> *new_stems_ = 0;
+ Moment temporary_shortest_mom;
+ SCM temporary_beam_settings;
+
+ bool found_end;
+
+ for (vsize i = 0; i < stems_->size () - 1;)