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

2014-01-07 Thread Wilbert Berendsen

op 07-01-14 08:40, Johan Vromans schreef:

Wilbert Berendsen wbs...@xs4all.nl 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

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: ANN: python-ly 0.1 (the ly tool)

2014-01-07 Thread David Kastrup
David Kastrup d...@gnu.org writes:

 Johan Vromans jvrom...@squirrel.nl writes:

 Wilbert Berendsen wbs...@xs4all.nl writes:

 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

 In Emacs, you can just do
 M-C-: % \([0-9]\)+$ RET % \,(+ \# 8) RET

 Assign it to a keyboard macro/command if you do it more frequently...

Of course, M-C-% rather than M-C-:, sorry for any confusion.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


ANN: python-ly 0.1 (the ly tool)

2014-01-06 Thread Wilbert Berendsen

Hi all,

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


Url: https://pypi.python.org/pypi/python-ly/

The package is registered and uploaded with PYPI. It does not depend on 
PyQt4 or Frescobaldi. Please test and experiment :-)
The 'ly' tool version 0.1 is able to indent, reformat, translate and 
transpose, and it can display some information. Planned featuress are 
rhythm tools and syntax-colored html and xml output.


Frescobaldi still includes the ly library (and will also in the 
forseeable future). So Frescobaldi will not depend on python-ly. If you 
clone Frescobaldi from git, you can also find and use the ly tool there, 
although Frescobaldi's install procedure does not install the 'ly' 
command by default.


The 'python-ly' package is developed within the Frescobaldi git 
repository at github.com/wbsoft/frescobaldi, in the frescobaldi_app/ly 
directory.


Best regards,
Wilbert

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: ANN: python-ly 0.1 (the ly tool)

2014-01-06 Thread Martin Tarenskeen



On Tue, 7 Jan 2014, Wilbert Berendsen wrote:


Hi all,

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


Url: https://pypi.python.org/pypi/python-ly/


I did python-pip install python-ly on my Fedora system and did a few 
short tests. Seems to work nicely.


Thank you, very useful!

--

MT



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: ANN: python-ly 0.1 (the ly tool)

2014-01-06 Thread Mike Solomon
On Jan 7, 2014, at 8:31 AM, Wilbert Berendsen wbs...@xs4all.nl wrote:

 Hi all,
 
 a first release of the command-line ly tool with the Python ly library is out:
 
 Url: https://pypi.python.org/pypi/python-ly/

WAY cool - many thanks!
Took it for a spin and I see a noticeable improvement in several files.
In general, as the hackishness of the file increases, the more difficulty the 
script has beautifying it.

I’d love to help you extend the script to do two things that I need for my 
projects:
-) pretty scheme and music functions
-) certain spacing conventions based on rules (that could be elaborated in 
python)

Lemme know if that’s of interest.

Cheers,
MS
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: ANN: python-ly 0.1 (the ly tool)

2014-01-06 Thread Johan Vromans
Wilbert Berendsen wbs...@xs4all.nl 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

-- Johan

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user