lilypond-devel
[Top][All Lists]
Advanced

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

Re: make pretty-print available in ly files (issue 222810043 by address@


From: david . nalesnik
Subject: Re: make pretty-print available in ly files (issue 222810043 by address@hidden)
Date: Wed, 08 Apr 2015 16:06:47 +0000

On 2015/04/08 11:14:54, dak wrote:
On 2015/04/08 10:43:09, thomasmorley651 wrote:
> On 2015/04/08 10:21:55, dak wrote:
>
> > value->lily-string is probably the most useful reasonably generic
printing
> > facility right now.  But nobody really knows it.
>
> At least, I wasn't aware of it, because of (in a ly-file)
>
> #(display value->lily-string)
> -> Unbound variable: value->lily-string

Like with much of the Scheme-level printing you'll need
#(use-modules (scm display-lily))

It's not been around for long in its current form (and name) anyway.
It became
an exported function under that name with
commit 8d8e8aec6388fbb08ed2219884b82ecf53a9dbcd
Author: David Kastrup <mailto:address@hidden>
Date:   Wed Jan 1 20:54:15 2014 +0100

     Provide value->lily-string function

because I really needed that facility in order to make nice error
messages.
It's in 2.19.1 and 2.18.0 I think, as part of issue 3770.

But doesn't this just return a string?  Also, it requires a parser
argument.


At some point of time, somebody needs to make some sort of plan along
the lines
of "what kind of functions and programming facilities are needed for
working
with LilyPond in a coherent and predictable and comfortable manner"
and put it
into code.  It is quite too often that one runs into the "I cannot
believe
LilyPond does not have something obvious for such an obvious task like
$x"
situation.

And of course documenting it in a convenient way, like "Resources for
..." Can't think of a nice summary word and "easier tampering" or
"hacking" wouldn't send the right message.

It's worth noting that the ~y option IS available within ly files,
though not in scm files, where format has been redefined as
simple-format.  So something like this produces nice results:

#(format #t "~y" (procedure-source grob::rhythmic-location))

==>

(lambda (grob)
  "Return a pair consisting of the measure number and moment within
   the measure of grob @var{grob}."
  (let* ((item (if (grob::has-interface
                     grob
                     'spanner-interface)
                 (ly:spanner-bound grob LEFT)
                 grob))
         (col (ly:item-get-column item)))
    (if (ly:grob? col)
      (ly:grob-property col (quote rhythmic-location))
      '())))

______________

So I guess the way to proceed now is to make a patch reverting this
commit, and then just push it to staging as soon as it passes tests,
rather than going through a review cycle?


https://codereview.appspot.com/222810043/



reply via email to

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