lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating new articulation (adding to an internal alist)


From: Urs Liska
Subject: Re: Creating new articulation (adding to an internal alist)
Date: Fri, 06 Mar 2015 15:15:55 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Am 06.03.2015 15:03, schrieb David Nalesnik:


On Fri, Mar 6, 2015 at 7:40 AM, Urs Liska <address@hidden> wrote:
Am 06.03.2015 14:35, schrieb David Nalesnik:


On Fri, Mar 6, 2015 at 7:24 AM, David Nalesnik <address@hidden> wrote:


 \version "2.19.16"

#(set! default-script-alist
       (append default-script-alist
         (list
          `("weakbeat"
             . (
                 (script-stencil . (feta . ("weakbeat" . "weakbeat")))
                 ; any other properties
                 (toward-stem-shift-in-column . 0.0)
                 (padding . 0.20)
                 (avoid-slur . around)
                 (direction . ,UP))))))

weakbeat = #(make-articulation "weakbeat")

{ c\weakbeat }

\layout {
  \context {
    \Score
    scriptDefinitions = #default-script-alist
  }
}

%%%


Here's my conclusion:

When using append, we are setting default-script-alist to a list which doesn't necessarily share structure with the original default-script-alist.  scriptDefinitions is bound to the original default-script-alist unless you reassign it to the concatenated list.  append! destructively modifies the list that scriptDefinitions is bound to, so there is no need for the set in the context block.

There is not even the need for the set! in the original definition. That is:
#(append! default-script-alist
   (list
    `("weakbeat"
       . ((script-stencil . (feta . ("weakbeat" . "weakbeat")))
          ; any other properties
          (toward-stem-shift-in-column . 0.0)
And you can do:

 \layout {
  \context {
    \Score
    scriptDefinitions = #(append default-script-alist
                           (list
                            `("weakbeat"
                               . (
                                   (script-stencil . (feta . ("weakbeat" . "weakbeat")))
                                   ; any other properties
                                   (toward-stem-shift-in-column . 0.0)
                                   (padding . 0.20)
                                   (avoid-slur . around)
                                   (direction . ,UP)))))
  }
}

%%%
(Just for completeness...)

Thanks.
And for completeness I also add another (contrived) example image of the whole thing. Small quiz: Who recognizes what this is historically? ;-)

Urs

-- 
Urs Liska
address@hidden

Attachment: test.png
Description: PNG image


reply via email to

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