lilypond-user
[Top][All Lists]
Advanced

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

Re: Autochange snippet broken?


From: Valentin Villenave
Subject: Re: Autochange snippet broken?
Date: Sat, 2 Jun 2012 22:36:30 +0200

On Sat, Jun 2, 2012 at 6:28 AM, David Kastrup <address@hidden> wrote:
> Much more banal, and actually you were right.  The internals are working
> fine, it is just the user interface that broke down.  Change
>
> autochangeWithPitch =
> #(define-music-function (parser location ref music) (ly:music? ly:music?)
>      (let* ((note (car (ly:music-property ref 'elements)))
>             (ref-pitch (ly:music-property note 'pitch)))
>  (make-autochange-music parser music
>    (if (ly:pitch? ref-pitch) ref-pitch #f))))
>
> to
>
> autochangeWithPitch =
> #(define-music-function (parser location ref music) ((ly:pitch?) ly:music?)
>  (make-autochange-music parser music ref))

Wow. I can't stop being amazed at how more concise the syntax has become lately.

> Or straight to
> autochange = ...
>
> since the pitch argument in the changed function is optional (this would
> not work if the music to autochange looks like c'4 or so, namely is just
> a single note-event, but so what).

Do you think "we" could actually extend the default autochange
command? Or am I being silly suggesting that?

> I actually would write the whole snippet as
> autochange =
> #(define-music-function (parser location ref music) ((ly:pitch?) ly:music?)
>  (let ((mus (make-autochange-music parser
>              (if ref #{ \transpose $ref c' $music #} music))))
>   (set! (ly:music-property mus 'element) music)
>   mus))
> There is no point in meddling with internals for a task like this.  If
> this was supposed to replace the built-in definition, one would probably
> change the internals for a variable split point.  But a user-level
> snippet?  Using \transpose here is certainly good enough.

Sure. (That latest trick could be used to update the LSR snippet,
methinks: apart from the optarg, it should be compatible with 2.14.)

I could have thought of it myself, TBH (if it weren't for that full-on
laziness condition I mentioned earlier).

Thanks!

Cheers,
Valentin.



reply via email to

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