lilypond-devel
[Top][All Lists]
Advanced

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

Re: Patch: Make #{ ... #} wagonloads more useful


From: David Kastrup
Subject: Re: Patch: Make #{ ... #} wagonloads more useful
Date: Sun, 28 Aug 2011 15:09:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Carl Sorensen <address@hidden> writes:

>> Here is a fun example:
>> 
>> the extending documentation contains the example
>> 
>>     Inline Scheme code
>> 
>>     The main disadvantage of `\tweak' is its syntactical inflexibility.
>>     For example, the following produces a syntax error.
>> 
>>     F = \tweak #'font-size #-3 -\flageolet
>> 
>>     \relative c'' {
>>       c4^\F c4_\F
>>     }

[...]

>> Ugh.  But with the new patch, this can be reduced to
>> 
>>     F = ##{-\tweak #'font-size #-3 -\flageolet#}
>> 
>> If you check the resulting expressions, you'll find that apart from the
>> added origin property they are identical.
>> 
>> Is that smooth or what?
>
> What, are you trying to make it easy for users to do complicated things?
> Why in the world would you want to do that?
>
> This is WAY cool.  Thanks!

Actually, this particular example is rather lousy, since

F = -\tweak #'font-size #-3 -\flageolet

works just fine.  Somebody ought to find a better example.

I have the slight suspicion that people will be more delighted about
something like

#(define-markup-command (double-box layout props text) (markup?)
  "Draw a double box around text."
  (interpret-markup layout props
    (markup #:override '(box-padding . 0.4) #:box
            #:override '(box-padding . 0.6) #:box text)))

being able to be written as

#(define-markup-command (double-box layout props text) (markup?)
  "Draw a double box around text."
  (interpret-markup layout props
     #{\markup \override #'(box-padding . 0.4) \box \override #'(box-padding . 
0.6) \box { $text } #}))


After all, that looks decidedly less obscure than the markup macro.

-- 
David Kastrup




reply via email to

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