lilypond-user
[Top][All Lists]
Advanced

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

Re: How to make a tweak a variable?


From: David Kastrup
Subject: Re: How to make a tweak a variable?
Date: Sun, 18 Sep 2011 00:43:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Xavier Scheuer <address@hidden> writes:

> Hello,
>
> This is maybe a question I have already asked but I cannot find the
> answer (and I'm trying to typeset a score).
>
> I'd like to define a variable that actually consists of a tweak command.
> I.e. to replace
>
>   c1-\tweak #'to-barline ##f \< |  % it works
>   d4\!  % etc.
>
> by
>
>   c1\notToBarline \< |  % it does not work with my attempts
>   d4\!  % etc.
>
> but I do not know how to define my variable "notToBarline" in order to
> make it work.
>
> First I simply tried
>   notToBarline = -\tweak #'to-barline ##f
> but I got an error.
> Then I tried a music function with ly:music? or ly:grob? as argument
> but it failed too.
>   notToBarline = #(define-music-function
>       (parser location grb)
>       (ly:grob?)
>     #{
>       -\tweak #'to-barline ##f $grb
>     #})
>
> I am obviously missing something here (and this is preventing me to
> typeset my score the way I want).
>
> Could you give me some help please?

Use a music argument.  This will, however, only work if the music
function is recognizable as a postevent, namely as

notToBarline = #(define-music-function
  (parser location grb)
  (ly:music?)
#{
  -\tweak #'to-barline ##f-$grb
#})

{
c1-\notToBarline \< |
d4\!  % etc.
}

At the current point of time, you can put postevents into variables, but
music functions work as (and on) postevents only if declared as such.
With the current framework, it would be reasonably simple to implement a
define-event-function (if really wanted), but it does need support in
parser and lexer.

-- 
David Kastrup




reply via email to

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