From d681faf94e8060b3d10536d2f4d287d045b8a597 Mon Sep 17 00:00:00 2001
From: Keith OHara <k-ohara5a5a@oco.net>
Date: Tue, 13 Aug 2013 00:31:49 -0700
Subject: [PATCH] trill-pitch-engraver: acknowledge stems and flags; issue 3465

---
 lily/pitched-trill-engraver.cc | 14 ++++++++++++++
 scm/define-grobs.scm           |  4 +++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/lily/pitched-trill-engraver.cc b/lily/pitched-trill-engraver.cc
index ef49b217d1..c2a02e71d9 100644
--- a/lily/pitched-trill-engraver.cc
+++ b/lily/pitched-trill-engraver.cc
@@ -38,6 +38,8 @@ public:
 protected:
   DECLARE_ACKNOWLEDGER (note_head);
   DECLARE_ACKNOWLEDGER (dots);
+  DECLARE_ACKNOWLEDGER (stem);
+  DECLARE_ACKNOWLEDGER (flag);
   DECLARE_ACKNOWLEDGER (trill_spanner);
   void stop_translation_timestep ();
 
@@ -64,6 +66,16 @@ Pitched_trill_engraver::acknowledge_dots (Grob_info info)
   heads_.push_back (info.grob ());
 }
 void
+Pitched_trill_engraver::acknowledge_stem (Grob_info info)
+{
+  heads_.push_back (info.grob ());
+}
+void
+Pitched_trill_engraver::acknowledge_flag (Grob_info info)
+{
+  heads_.push_back (info.grob ());
+}
+void
 Pitched_trill_engraver::acknowledge_note_head (Grob_info info)
 {
   heads_.push_back (info.grob ());
@@ -159,6 +171,8 @@ Pitched_trill_engraver::stop_translation_timestep ()
 
 ADD_ACKNOWLEDGER (Pitched_trill_engraver, note_head);
 ADD_ACKNOWLEDGER (Pitched_trill_engraver, dots);
+ADD_ACKNOWLEDGER (Pitched_trill_engraver, stem);
+ADD_ACKNOWLEDGER (Pitched_trill_engraver, flag);
 ADD_ACKNOWLEDGER (Pitched_trill_engraver, trill_spanner);
 
 ADD_TRANSLATOR (Pitched_trill_engraver,
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index e2b9e6acd7..86bf7c15a9 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -2505,7 +2505,9 @@
         (side-axis . ,X)
         (stencil . ,parenthesize-elements)
         (stencils . ,parentheses-item::calc-parenthesis-stencils)
-        (X-offset . ,ly:side-position-interface::x-aligned-side)
+        ;; offset a bit to the right, further if needed to clear the main note
+        (X-offset . ,(lambda (grob)
+                       (ly:side-position-interface::x-aligned-side grob 2.5)))
         (Y-extent . ,grob::always-Y-extent-from-stencil)
         (meta . ((class . Item)
                  (interfaces . (axis-group-interface
-- 
2.39.5