Re: Way to flatten nested \include's?

2015-08-25 Thread Johan Vromans
On Tue, 25 Aug 2015 09:23:12 +1000
Andrew Bernard andrew.bern...@gmail.com wrote:

 Unless you enjoy writing Scheme as much as I do!

I programmed quite a lot in lisp and APL, but never quite liked it.

From a practical point of view: every linux system comes with Perl and
Python. If you're lucky you can add Scheme yourself.

-- Johan

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


Re: Way to flatten nested \include's?

2015-08-25 Thread Andrew Bernard

That was the general idea. I posted some instructions about how to add the 
utility to a lilypond installation for people but in a new thread. It was 
actually one of the main reasons I did it in Scheme - there would be a 
guaranteed known execution environment installed if the user is using lilypond 
to begin with.

A






On 25/08/2015 17:49, David Kastrup 
lilypond-user-bounces+andrew.bernard=gmail@gnu.org on behalf of 
d...@gnu.org wrote:

If all else fails, the lilypond binary itself can serve as a GUILE
interpreter.


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


Re: Way to flatten nested \include's?

2015-08-25 Thread David Kastrup
Johan Vromans jvrom...@squirrel.nl writes:

 On Tue, 25 Aug 2015 09:23:12 +1000
 Andrew Bernard andrew.bern...@gmail.com wrote:

 Unless you enjoy writing Scheme as much as I do!

 I programmed quite a lot in lisp and APL, but never quite liked it.

 From a practical point of view: every linux system comes with Perl and
 Python. If you're lucky you can add Scheme yourself.

If all else fails, the lilypond binary itself can serve as a GUILE
interpreter.

-- 
David Kastrup

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


Re: Way to flatten nested \include's?

2015-08-25 Thread David Kastrup
Andrew Bernard andrew.bern...@gmail.com writes:

 lilypond-user-bounces+andrew.bernard=gmail@gnu.org on behalf of 
 d...@gnu.org wrote:

If all else fails, the lilypond binary itself can serve as a GUILE
interpreter.

 That was the general idea. I posted some instructions about how to add
 the utility to a lilypond installation for people but in a new
 thread. It was actually one of the main reasons I did it in Scheme -
 there would be a guaranteed known execution environment installed if
 the user is using lilypond to begin with.

It's not just that.  It's also that the lilypond executable is pretty
sure to know the search paths of LilyPond.  You cannot really get them
reliably without calling LilyPond, and if you do that anyway, why not
use its interpreter?

-- 
David Kastrup

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


Re: Way to flatten nested \include's?

2015-08-25 Thread Andrew Bernard
I am not sure I understand. Is having a symlink:

flatten-ly - /home/username/bin/lilypond-wrapper.guile

not correct? The convert-ly utility is set up as:

convert-ly - /home/username/bin/lilypond-wrapper.python


Andrew


On 25/08/2015 18:11, David Kastrup d...@gnu.org wrote:


It's not just that.  It's also that the lilypond executable is pretty
sure to know the search paths of LilyPond.  You cannot really get them
reliably without calling LilyPond, and if you do that anyway, why not
use its interpreter?


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


Re: Way to flatten nested \include's?

2015-08-25 Thread Marc Hohl

Am 25.08.2015 um 10:11 schrieb David Kastrup:

Andrew Bernard andrew.bern...@gmail.com writes:


lilypond-user-bounces+andrew.bernard=gmail@gnu.org on behalf of 
d...@gnu.org wrote:


If all else fails, the lilypond binary itself can serve as a GUILE
interpreter.


That was the general idea. I posted some instructions about how to add
the utility to a lilypond installation for people but in a new
thread. It was actually one of the main reasons I did it in Scheme -
there would be a guaranteed known execution environment installed if
the user is using lilypond to begin with.


It's not just that.  It's also that the lilypond executable is pretty
sure to know the search paths of LilyPond.  You cannot really get them
reliably without calling LilyPond, and if you do that anyway, why not
use its interpreter?


This would be a great idea!

The flatten-ly procedure would come in handy to solve the problem of
lilypond-book and lyluatex that changes in nested include files do not
cause the lilypond sourecs to be rendered again.

If the md5 sum is calculated of a flattened ly file instead of the
original ly file, *every* change is visible.

So +1 for making flatten-ly a lilypond executable!


Marc

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


Re: Way to flatten nested \include's?

2015-08-25 Thread Marc Hohl

Am 25.08.2015 um 11:12 schrieb Andrew Bernard:

I am not sure I understand. Is having a symlink:

flatten-ly - /home/username/bin/lilypond-wrapper.guile


not correct? The convert-ly utility is set up as:

convert-ly - /home/username/bin/lilypond-wrapper.python


I think that David meant that your script should be callable by lilypond
itself, something like

lilypond flatten-ly.ly

This ensures that all include paths are resolved automatically.
A shell script does not know about lilypond's way to find include files ;-)

Marc




Andrew


On 25/08/2015 18:11, David Kastrup d...@gnu.org mailto:d...@gnu.org
wrote:


It's not just that.  It's also that the lilypond executable is pretty
sure to know the search paths of LilyPond.  You cannot really get them
reliably without calling LilyPond, and if you do that anyway, why not
use its interpreter?



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




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


Re: Way to flatten nested \include's?

2015-08-25 Thread David Kastrup
Andrew Bernard andrew.bern...@gmail.com writes:

 On 25/08/2015 18:11, David Kastrup d...@gnu.org wrote:


 It's not just that.  It's also that the lilypond executable is pretty
 sure to know the search paths of LilyPond.  You cannot really get them
 reliably without calling LilyPond, and if you do that anyway, why not
 use its interpreter?

 I am not sure I understand. Is having a symlink:

 flatten-ly - /home/username/bin/lilypond-wrapper.guile

 not correct?

I can't say anything about the wrappers used here.  I was pointing out
that calling a Scheme procedure via the lilypond executable has the
advantage of having search paths etc set correctly.

You can do that with

lilypond -e '(load xxx.scm)'

-- 
David Kastrup

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


Re: Way to flatten nested \include's?

2015-08-24 Thread Andrew Bernard
Of course I shall add include path arguments, and ~ expansion.

Andrew


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


Re: Way to flatten nested \include's?

2015-08-24 Thread Johan Vromans
On Mon, 24 Aug 2015 09:35:35 +1000
Andrew Bernard andrew.bern...@gmail.com wrote:

 Although it can be written in Python or any language, I felt Scheme is in
 the spirit of lilypond.

Scheme is for LP extenstions. This tool, being a standalone program, can
much better be written in Perl or Python.

-- Johan

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


Re: Way to flatten nested \include's?

2015-08-24 Thread Andrew Bernard
Greetings Javier.

Here is a program I wrote for you, flatten-ly to read a lilypond file and 
output it recursively flattening all the nested includes. It’s a shell script 
invoking guile.

Usage: flatten-ly file

Outputs to standard output.

Unashamedly Linux.

I’ll make it more robust, and add a couple of features, add a lilypond style 
wrapper and if there is any interest add it to openlilylib perhaps?

Andrew



From:  lilypond-user-bounces+andrew.bernard=gmail@gnu.org on behalf of 
Javier Ruiz-Alma
Reply-To:  Javier Ruiz-Alma
Date:  Sunday, 23 August 2015 07:20
To:  LilyPond User Group
Subject:  Way to flatten nested \include's?

Is there a way to ask lilypond to expands nested \include's and dump into new 
file, such I can review/compile a flattened version of the code (i.e. for 
debugging)?




flatten-ly
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Way to flatten nested \include's?

2015-08-24 Thread Simon Albrecht

Hi Andrew,

many thanks for your work.
I just tried the script and can’t avoid getting an error about lacking 
rights. My command was:

$flatten-ly 18-der-stuermische-morgen.ly  debug.ly
sudo doesn’t help and it’s regardless of whether I place the script in 
/usr/bin/ or in ~/.

Can you tell why that is?

Yours, Simon

Am 24.08.2015 um 03:23 schrieb Andrew Bernard:

Greetings Javier.

Here is a program I wrote for you, flatten-ly to read a lilypond file 
and output it recursively flattening all the nested includes. It’s a 
shell script invoking guile.


Usage: flatten-ly file

Outputs to standard output.

Unashamedly Linux.

I’ll make it more robust, and add a couple of features, add a lilypond 
style wrapper and if there is any interest add it to openlilylib perhaps?


Andrew



From: lilypond-user-bounces+andrew.bernard=gmail@gnu.org 
mailto:lilypond-user-bounces+andrew.bernard=gmail@gnu.org on 
behalf of Javier Ruiz-Alma

Reply-To: Javier Ruiz-Alma
Date: Sunday, 23 August 2015 07:20
To: LilyPond User Group
Subject: Way to flatten nested \include's?

Is there a way to ask lilypond to expands nested \include's and dump 
into new file, such I can review/compile a flattened version of the 
code (i.e. for debugging)?




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


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


Re: Way to flatten nested \include's?

2015-08-24 Thread Orm Finnendahl
Am Montag, den 24. August 2015 um 21:57:37 Uhr (+0200) schrieb Blöchl Bernhard:
 The attached file is a binary, not a lilypond file, regardless of the
 extension .ly?

No, it is a text file but the mime type of the attachment is specified
as application/octet stream. I changed it to text/plain in my Mail
program and then it was no problem to open it.

--
Orm

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


Re: Way to flatten nested \include's?

2015-08-24 Thread Simon Albrecht

Am 24.08.2015 um 21:57 schrieb Blöchl Bernhard:
The attached file is a binary, not a lilypond file, regardless of the 
extension .ly?
Have another look: it’s not flatten.ly, but flatten-ly – without any 
file name extension.
It’s not a binary either, but plain text, and is used as a shell script, 
as Andrew said in his explanation below.


HTH, Simon




Am 24.08.2015 03:23, schrieb Andrew Bernard:

Greetings Javier.

Here is a program I wrote for you, flatten-ly to read a lilypond file
and output it recursively flattening all the nested includes. It's a
shell script invoking guile.

Usage: flatten-ly file

Outputs to standard output.

Unashamedly Linux.

I'll make it more robust, and add a couple of features, add a lilypond
style wrapper and if there is any interest add it to openlilylib
perhaps?

Andrew

From: lilypond-user-bounces+andrew.bernard=gmail@gnu.org on
behalf of Javier Ruiz-Alma
Reply-To: Javier Ruiz-Alma
Date: Sunday, 23 August 2015 07:20
To: LilyPond User Group
Subject: Way to flatten nested include's?

Is there a way to ask lilypond to expands nested include's and dump
into new file, such I can review/compile a flattened version of the
code (i.e. for debugging)?


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


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



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


Re: Way to flatten nested \include's?

2015-08-24 Thread Blöchl Bernhard
The attached file is a binary, not a lilypond file, regardless of the 
extension .ly?




Am 24.08.2015 03:23, schrieb Andrew Bernard:

Greetings Javier.

Here is a program I wrote for you, flatten-ly to read a lilypond file
and output it recursively flattening all the nested includes. It's a
shell script invoking guile.

Usage: flatten-ly file

Outputs to standard output.

Unashamedly Linux.

I'll make it more robust, and add a couple of features, add a lilypond
style wrapper and if there is any interest add it to openlilylib
perhaps?

Andrew

From: lilypond-user-bounces+andrew.bernard=gmail@gnu.org on
behalf of Javier Ruiz-Alma
Reply-To: Javier Ruiz-Alma
Date: Sunday, 23 August 2015 07:20
To: LilyPond User Group
Subject: Way to flatten nested include's?

Is there a way to ask lilypond to expands nested include's and dump
into new file, such I can review/compile a flattened version of the
code (i.e. for debugging)?


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


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


Re: Way to flatten nested \include's?

2015-08-24 Thread Andrew Bernard
Hi Johan,

Unless you enjoy writing Scheme as much as I do!

Scheme is perfectly fine for utility programs. It may be less maintainable for 
the hoi polloi - but then, the same can be said of llypond! :-)

While guile is aimed at being an extension language, don't forget that Scheme 
was taught at MIT for many, many years as the finest language to give students 
a deep insight into computing and computer science (refer SICP). [Sadly, they 
now teach Python instead. Real world practicality defeated beauty, insight, and 
elegance. :-(]

Andrew





On 24/08/2015 17:59, Johan Vromans 
lilypond-user-bounces+andrew.bernard=gmail@gnu.org on behalf of 
jvrom...@squirrel.nl wrote:

On Mon, 24 Aug 2015 09:35:35 +1000
Andrew Bernard andrew.bern...@gmail.com wrote:

 Although it can be written in Python or any language, I felt Scheme is in
 the spirit of lilypond.

Scheme is for LP extenstions. This tool, being a standalone program, can
much better be written in Perl or Python.

-- Johan

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


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


RE: Way to flatten nested \include's?

2015-08-23 Thread Javier Ruiz-Alma
Thanks both.

 

I doubt this feature is needed with any frequency.  I happen to be
leveraging some orchestral LP code, which is proving quite convoluted to
trace with its many nested \include's and needs upgrading to current
version.

Some compile issues were reported as programming errors in 2.18.2 with no
clear indication of an associated line of code.

 

I'm down to one remaining error:

programming error: Improbable offset for stencil: -inf staff space

 

Seems to be associated with the following scheme function:

 

#(define (not-last-page layout props arg)

(if (not (book-last-page? layout props))

 (interpret-markup layout props arg)

empty-stencil))

 

The function is used to generate custom on-the-fly footers for pages other
than first and last.

 

I need to create a separate tiny example to replicate and isolate where the
issue is coming from.  I'll ask for help in a new thread.

 

Javier

 

From: Simon Albrecht [mailto:simon.albre...@mail.de] 
Subject: Re: Way to flatten nested \include's?

 

Am 23.08.2015 um 15:23 schrieb Knute Snortum:



I don't know of a LilyPond way to do this, but it would probably be a fairly
simple Python or Perl program.

And wouldn't it be user-friendly to provide such a script with our default
binaries, that is alongside convert-ly?

My 2cts, Simon






 

Knute Snortum

(via Gmail)

 

On Sat, Aug 22, 2015 at 2:20 PM, Javier Ruiz-Alma jav...@ruiz-alma.com
mailto:jav...@ruiz-alma.com  wrote:

I have code split into multiple files.

Is there a way to ask lilypond to expands nested \include's and dump into
new file, such I can review/compile a flattened version of the code (i.e.
for debugging)?

 


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

 






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

 

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


Re: Way to flatten nested \include's?

2015-08-23 Thread Simon Albrecht

Am 23.08.2015 um 15:23 schrieb Knute Snortum:
I don't know of a LilyPond way to do this, but it would probably be a 
fairly simple Python or Perl program.
And wouldn’t it be user-friendly to provide such a script with our 
default binaries, that is alongside convert-ly?


My 2cts, Simon



Knute Snortum
(via Gmail)

On Sat, Aug 22, 2015 at 2:20 PM, Javier Ruiz-Alma 
jav...@ruiz-alma.com mailto:jav...@ruiz-alma.com wrote:


I have code split into multiple files.
Is there a way to ask lilypond to expands nested \include's and
dump into new file, such I can review/compile a flattened version
of the code (i.e. for debugging)?


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




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


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


Re: Way to flatten nested \include's?

2015-08-23 Thread Knute Snortum
I don't know of a LilyPond way to do this, but it would probably be a
fairly simple Python or Perl program.


Knute Snortum
(via Gmail)

On Sat, Aug 22, 2015 at 2:20 PM, Javier Ruiz-Alma jav...@ruiz-alma.com
wrote:

 I have code split into multiple files.
 Is there a way to ask lilypond to expands nested \include's and dump into
 new file, such I can review/compile a flattened version of the code (i.e.
 for debugging)?


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


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


Re: Way to flatten nested \include's?

2015-08-23 Thread Andrew Bernard
Greetings,

Well, I am writing a delightful Scheme program to do the job right now, since I 
read your request. It may only be occasionally useful, but still worth having. 
You don;t have to use every tool in the workshop every day. Although it can be 
written in Python or any language, I felt Scheme is in the spirit of lilypond.

Andrew


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