lilypond-user
[Top][All Lists]
Advanced

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

renumber idea (Re: ANN: python-ly 0.1 (the "ly" tool))


From: Wilbert Berendsen
Subject: renumber idea (Re: ANN: python-ly 0.1 (the "ly" tool))
Date: Tue, 07 Jan 2014 09:14:34 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0

op 07-01-14 08:40, Johan Vromans schreef:
Wilbert Berendsen <address@hidden> writes:

a first release of the command-line ly tool with the Python ly library
is out:
Yay!

Given a (section of) .ly with barchecks and line number comments, e.g.

   d16  c8.~  c4  r2   |  % 9
   \bar "||"
   R1  |  % 10
   R1  |  % 10
   R1  |  % 12
   e4  e8  e16  f16~  f8.  c16  f8  e8   |  % 13

can ly recalculate the line numbers? For example, in Emacs, select a
section and then

   C-u M-| ly "renumber;start=8"

would result in

   d16  c8.~  c4  r2   |  % 8
   \bar "||"
   R1  |  % 9
   R1  |  % 10
   R1  |  % 11
   e4  e8  e16  f16~  f8.  c16  f8  e8   |  % 12


Yes, that would be feasible. But you would need to write "start=8;renumber" or -d start=8 renumber, as otherwise the start variable is set to 8 after the command has been performed.

Although the | % <number> is a convention, and ly is mainly intended to perform operations that really can't be done by some other intelligent editor algorithm. ly also excepts a semantically complete LilyPond input, i.e. it can parse "\relative { c d e f g }", or "{ c d e f g }", but not "c d e f g", as pitch names aren't written in the toplevel LilyPond context.

I am planning support for auto-inserting, and checking, bar checks. That tool could then have an option to add numbered comments.

But this idea raises another idea: The ly utilities are perfectly capable to operate on ranges, they also do that inside Frescobaldi.

So when calling ly from an external editor, and intending for it to operate on some selected range, the best way would be that ly still is fed the whole text input, but that some command or variable would restrict the range to operate on (e.g. "select" the fragment to be manipulated).

Support for selecting a range before calling a command is planned.

Best!
Wilbert



reply via email to

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