[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: preprocessing an included file with system command
From: |
Michael Ellis |
Subject: |
Re: preprocessing an included file with system command |
Date: |
Sun, 25 Sep 2011 09:23:08 -0400 |
On Sun, Sep 25, 2011 at 6:34 AM, Dmytro O. Redchuk
<address@hidden> wrote:
> On Sat 24 Sep 2011, 23:52 Michael Ellis wrote:
>> On Sat, Sep 24, 2011 at 4:28 PM, Graham Percival
>> > or m4 or python, I'd do this:
>> > # mylily.sh
>> > cp $1 /tmp
>> > sed '...' /tmp/$1 > /tmp/$1-processed.ly
>> > lilypond /tmp/$1-processed.ly
>> > mv /tmp/$1-processed.ly .
> Often it can be done with something like this (within bash script;
> windows equivalent is also quite possible):
>
> sed '...' < $1 | lilypond -o ${1%%.ly} -
>
>> I normally do my LilyPond work with LilyPondTool and have grown quite
>> accustomed to its conveniences. Using a wrapper script would mean
>> having to alter my LilyPondTool options to specify the wrapper script
>> instead of invoking LilyPond directly -- but I often use LilyPond for
>> tasks other than audio transcriptions and don't want to have to keep
>> changing my LilyPondTool options.
> I would, probably, try to write shell script, which takes $PPID and checks if
> the parent is LilypondTool or like that. Not tested .)
>
> Anyway, your question is still interesting. I can't help here, sorry.
>
Thanks, Dmytro. For my immediate problem I think I'm going to save
the Transcribe! output with some distinct extension and write a
watcher process that detects changes in files with that extension and
automatically runs my preprocessing to produce a file with a .inc
extension that I'll include in my .ly file.
But I think the larger question is whether future versions of Lily
should support some form of text macro. Perhaps we could have
something analogous to music functions like
mymacro = #(define-immediate-function ( args ....) (predicates ....) ( body ))
...
\mymacro args
with a guarantee that (body) will be executed before normal parsing
and that the return value would be injected in the file as though it
were the result of \include.
Cheers,
Mike