lilypond-user
[Top][All Lists]
Advanced

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

Re: Text listing output in .txt file


From: David Kastrup
Subject: Re: Text listing output in .txt file
Date: Wed, 02 Aug 2017 21:51:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> 2017-08-02 21:05 GMT+02:00 Jan-Peter Voigt <address@hidden>:
>> Hi Daniel and all others,
>>
>> you wrote about a critrical edition. There is scholarly:
>> https://github.com/openlilylib/scholarly
>> where you can add annotations to your score which then can be collected in
>> another file.
>> If you want to use the EE for tracking, you might use \applyContext #(lambda
>> (context) ... ) .
>> Of course you can use this function right inside your code.
>>
>> I am not at my computer right now, so I can not provide an example (yet).
>> But perhaps someone else can make use of this idea.
>>
>> HTH
>> Jan-Peter
>
> Thanks David, Jan-Peter.
>
> Probably:
>
> remark =
> #(define-music-function (strg)(string?)
> #{
>  \applyContext
>    #(lambda (ctx)
>      (let* ((log-file (format #f "~a-remarks.txt" (ly:parser-output-name)))
>             (port (open-file  log-file "a")))
>       (format port
>               "\nAt bar ~a, position ~a, (location in the ly-file: ~a)\n\t~a"
>               (ly:context-property ctx 'currentBarNumber)
>               (ly:context-property ctx 'measurePosition)
>               (*location*)

We probably had overlapping postings.  That is _exactly_ what I had been
warning against.  At the time you evaluate (*location*) here, it will
be crap.  You need to write just location here and put a
(let ((location (*location*))) ...) around the whole lambda, or better
the whole #{ ... #} (I suspect that inside of #{ ... #}, (*location*)
may already be tainted).  At the time
lambda is actually getting called, it is too late to call *location*.
You have to do that when \remark is getting evaluated.

>               strg)
>        (close port)))
> #})
>
> {
>   \remark text
>   c4 d e f
>   \remark more-text
>   g a b c
>   \remark "further text: pitch is d, length 4"
>   d e f g
> }
>
>
> Cheers,
>   Harm
>

-- 
David Kastrup



reply via email to

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