Re: Wish for short version function

2014-01-10 Thread Noeck
Hi David,

Am 10.01.2014 10:15, schrieb David Kastrup:
> guile> (format "LilyPond ~:@{~a.~a~}" (ly:version))
> "LilyPond 2.19"
> 
> That does not really require a command of its own.

That is indeed quite short and usable. I am still a stranger to scheme.
I suppose it does something like in python "%d.%d".format(version) but
the ~, : and @ signs look like magic to me.
I will read this:
http://www.gnu.org/software/guile/manual/html_node/Formatted-Output.html


>> Why integrated?
> 
> You'll likely be writing a format string anyway.

So far not, I always did this (which I find much more readable):
\markup { "Lilypond" #(lilypond-version) }

Thanks,
Joram

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


Re: Wish for short version function

2014-01-10 Thread David Kastrup
Noeck  writes:

> Hi all,
>
> I have a wish for a scheme function integrated in LilyPond:
> A function that returns the short form of the version used: e.g. 2.18
> (and not 2.18.0)
>
>
> I don’t know if that already exists, I couldn’t find it anywhere. The
> reason why I want this function is below. It would be very easy to
> implement: In scm/lily.scm after the definition of lilypond-version, one
> could add:
>
> (define-safe-public (lilypond-short-version) ; or short-lilypond-version
>   (string-join
>(map (lambda (x) (if (symbol? x)
> (symbol->string x)
> (number->string x)))
> (list-head (ly:version) 2))
>"."))
>
>
> What for?
> For a custom tagline like: Lilypond 2.18

dak@lola:/usr/local/tmp/lilypond$ lilypond scheme-sandbox
GNU LilyPond 2.19.0
Processing `/usr/local/share/lilypond/2.19.0/ly/scheme-sandbox.ly'
Parsing...
guile> (format "LilyPond ~:@{~a.~a~}" (ly:version))
"LilyPond 2.19"
guile> (exit)

Success: compilation successfully completed
dak@lola:/usr/local/tmp/lilypond$ 

That does not really require a command of its own.

> Why integrated?

You'll likely be writing a format string anyway.

-- 
David Kastrup

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


Wish for short version function

2014-01-10 Thread Noeck
Hi all,

I have a wish for a scheme function integrated in LilyPond:
A function that returns the short form of the version used: e.g. 2.18
(and not 2.18.0)


I don’t know if that already exists, I couldn’t find it anywhere. The
reason why I want this function is below. It would be very easy to
implement: In scm/lily.scm after the definition of lilypond-version, one
could add:

(define-safe-public (lilypond-short-version) ; or short-lilypond-version
  (string-join
   (map (lambda (x) (if (symbol? x)
(symbol->string x)
(number->string x)))
(list-head (ly:version) 2))
   "."))


What for?
For a custom tagline like: Lilypond 2.18

As \version statement I always use the full (2.18.0) version (for
convert-ly reasons). But on the printed score this is too much (imho).
It doesn’t mean anything to singers in a choir. But I still want to
mention LP and for those who know it, it would be nice to see if the
used version was new or old. Many programs have version numbers without
dots and that’s what people are used to: Windows 95, Windows 8, Sibelius
7, Finale 2014 etc. The major version number contains almost no
information, so I need the next one, too.

Why integrated?
Surely I can write this in my own include, but if this already comes
with LP, it is safer to use it in scores for Mutopia etc. as chances are
higher that it can be automatically updated to future versions of LP.

Cheers,
Joram

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