lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Allow Scheme functions to be called inside of markup (issue 28507004


From: dak
Subject: Re: Allow Scheme functions to be called inside of markup (issue 285070043 by address@hidden)
Date: Sat, 16 Jan 2016 20:37:23 +0000

Reviewers: thomasmorley651,

Message:
On 2016/01/16 19:54:54, thomasmorley651 wrote:
After some testings I'm quite happy with it, apart from one use case:

fooII =
#(define-scheme-function (arg)(markup-list?)
#{
   \markup \column $arg
#})

%% doesn't work:
\markup \line { "xy" \fooII { "does" "not" "work"} }
%% works
\markup \line { "xy" \fooII \markuplist { "whatever" "else" } }
\markup \line { "xy" \fooII #'("whatever" "else") }

I think I know why the first case doesn't work. Though, I have no good
idea how
to explain it in the docs without telling a very technical story,
likely very
confusing to the average-user.
Additionally, having to add \markuplist as in the second example is
not nice.
Only a little better is the need to revert to scheme as done in the
third
example.

What other problematic cases can you predict deductively?

Sigh.  This looks like a can of worms.

Arguments of type markup?/markup-list? will obviously be problematic
(apart from the trivial case of strings) without explicit
\markup/\markuplist.  I am afraid that one would need to teach
markup-mode internal arguments to generic function argument lists.  That
would appear to be a likely user expectation.

However, `{' and `}' are mode-independent, and so { } already stands for
an empty sequential music expression and making it stand at the same
time for an empty markup list...  Ugh.

So much for the triviality of the change.

Description:
Allow Scheme functions to be called inside of markup

Please review this at https://codereview.appspot.com/285070043/

Affected files (+1, -1 lines):
  M lily/parser.yy


Index: lily/parser.yy
diff --git a/lily/parser.yy b/lily/parser.yy
index c60c6ed64c1157fa00e516efdcd98b8cb9e9eb0b..f09b437fa3a5b43709b033f7bbea22357f2e737b 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -3693,7 +3693,7 @@ markup_top:
        ;

 markup_scm:
-       embedded_scm_bare
+       embedded_scm
        {
                if (Text_interface::is_markup ($1))
                        MYBACKUP (MARKUP_IDENTIFIER, $1, @1);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]