lilypond-user
[Top][All Lists]
Advanced

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

Re: Editorial accidentals


From: David Kastrup
Subject: Re: Editorial accidentals
Date: Sun, 25 Jun 2017 10:44:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2017-06-25 8:40 GMT+02:00 Menu Jacques <address@hidden>:
>> Thanks Simon for the idea.
>>
>> I’ve defined the following Scheme function for my needs, with accidental 
>> style forced to ‘forget' for the given note:
>>
>> editorialAccidental =
>> #(define-music-function
>>   (note)
>>   (ly:music?)
>>   #{
>>     \once\accidentalStyle forget
>>     \once\set suggestAccidentals = ##t
>>     #note
>>   #})
>>
>> {
>>   \editorialAccidental cis4
>>   cis4
>>   dis4
>>   \editorialAccidental cis4
>> }
>>
>> JM
>
>
> Hi Jaques,
>
> while calling a variable, here 'note', in embedded lily-code, i.e. in
> #{ ... #}, always use $note not #note.
> Doing something with #note destructively changes 'note', so you can't
> access the unchanged 'note' anymore.
> Working on $note works on a copy of 'note' so you still have access to
> the original 'note'.

In this particular use case of using the material (of kind ly:music?)
exactly once, #note is actually correct.  This possibility of using
material uncopied and destructively is useful for processing large
amounts of music like with

\relative c' { 100 lines of stuff }

In cases like that, not creating a copy for music that is just
transitionally used is fine.  In many other cases, you are right that it
isn't, and the error symptoms are hard to understand and occur only
under some circumstances (uses of \relative and \transpose are often
involved but by no means the only triggers).

-- 
David Kastrup



reply via email to

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