[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Octavation syntax consistency (was: grand predefined-command thread)
From: |
Reinhold Kainhofer |
Subject: |
Re: Octavation syntax consistency (was: grand predefined-command thread) |
Date: |
Sat, 28 Jun 2008 10:59:01 +0200 |
User-agent: |
KMail/1.9.9 |
Am Samstag, 28. Juni 2008 schrieb Valentin Villenave:
> This is not really a predef, but for the past couple of weeks I've
> been trying to implement an easier syntax for octavations, e.g.
>
> \octava 1
> or
> \octava #1
>
> instead of
>
> #(set-octavation 1)
>
> Such a command would be much more consistent with the rest of the
> (non-Scheme) LilyPond syntax (not to mention much easier to type,
> since typing the hash character on a French keyboard requires you to
> twist your arm ;-)...
>
> I couldn't come up with a patch, but I thought someone more skilled
> than me could write it in a sec...
Well, you don't need to be skilled too much, but that part about "a sec" is
definitely true ;-) Attached is an example.
Basically, you write a music-function and inside that music function you
simply copy the stripped-down contents (which is only one line, anyway!) of
the set-octavation function, which is for some strange reason defined as a
scheme function rather than a music function. What's the reason for this?
AFAICS, that scheme function is not used inside any other code, so I see no
reason why that shouldn't be a music function.
So the whole function boils down to:
ottava = #(define-music-function (parser location octave) (number?)
(_i "set the octavation ")
(make-ottava-set octave)
)
Unfortunately, this will still leave you French users the joy of twisting your
fingers;-) I don't think there is any way to implement a function in scheme
that uses \ottava 1 rather than \ottava #1. The only way I'm aware of is to
implement that in the parser...
Cheers,
Reinhold
--
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden, http://reinhold.kainhofer.com/
* Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
* K Desktop Environment, http://www.kde.org, KOrganizer maintainer
* Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
octavation.ly
Description: Text Data
octavation.pdf
Description: Adobe PDF document