From: David Kastrup Date: Sat, 18 Jun 2016 08:20:43 +0000 (+0200) Subject: Issue 4899/1: Let method_finder also find listeners X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f7013d65b51f1372dc31973b78bbe04f505ea569;p=lilypond.git Issue 4899/1: Let method_finder also find listeners This allows using inherited listeners directly like with acknowledgers and translator methods. --- diff --git a/lily/include/translator.hh b/lily/include/translator.hh index dd0659bf50..0adc835c09 100644 --- a/lily/include/translator.hh +++ b/lily/include/translator.hh @@ -43,6 +43,11 @@ #define DECLARE_TRANSLATOR_CALLBACKS(NAME) \ template \ static SCM method_finder () { return method_find_base (); } \ + template \ + static SCM method_finder () \ + { \ + return Callback_wrapper::make_smob > (); \ + } \ /* end #define */ /* diff --git a/lily/include/translator.icc b/lily/include/translator.icc index b649a1a197..cc2440279f 100644 --- a/lily/include/translator.icc +++ b/lily/include/translator.icc @@ -113,7 +113,7 @@ void add_acknowledger (SCM ptr, #define ADD_LISTENER(cl, m) \ listener_list_ = scm_acons \ (event_class_symbol (#m), \ - Callback_wrapper::make_smob \ - > (), listener_list_) + method_finder<&cl::listen_ ## m> (), \ + listener_list_) #endif /* TRANSLATOR_ICC */