Re: How to append a git version to an output filename

2018-01-16 Thread Thomas Morley
2018-01-16 14:37 GMT+01:00 Urs Liska :

> But you should also look into the openLilyLib files, create a copy of the
> function and try removing the \markup wrapper. This \markup is added
> explicitly so it seems more efficient not to do that in the first place
> instead of removing it afterwards.
>

Indeed, leads to:

\version "2.19.65"

#(use-modules (ice-9 popen))
#(use-modules (ice-9 rdelim))

#(define (strsystem_internal cmd)
   (let* ((port (open-input-pipe cmd))
  (str (read-delimited "" port)))
 (close-pipe port)
 (if (eof-object? str) "" str)))

#(define (some-git-info-string cmd)
  (car
(string-split
  (strsystem_internal (string-append "git " cmd))
  #\newline)))

\bookOutputName "CommitishExample"
\bookOutputSuffix #(some-git-info-string "rev-parse --short HEAD")

{ c'1 }



Btw, I had a look at
https://github.com/openlilylib/snippets/blob/master/editorial-tools/git-commands/definitions.ily

In the definition of `gitCommand' I read

(make-column-markup
  (first result)
  ...)

While `result' is (string-split ...).
If I'm not mistaken, `result' is always a flat list of strings, it's
first element always a _single_ string.
So I wonder how make-column-markup (expecting a markup-_list_) ever worked here.

Also, I have an (likely) older coding of `gitCommand' found on my
computer without make-column-markup (and a few other differencies).


Cheers,
  Harm

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


Re: How to append a git version to an output filename

2018-01-16 Thread Ben Beeson
Thanks URS,

Another great idea for me to try!

Cheers,

Ben

On Jan 16, 2018 08:37, "Urs Liska"  wrote:

>
>
> Am 16.01.2018 um 14:27 schrieb Ben Beeson:
>
> Hi,
>
> Wow, that looks very promising.  I am looking at this note on my cell
> phone right now, so I cannot test it just yet. I will try this later when I
> get home and see what happens.
>
>
> But you should also look into the openLilyLib files, create a copy of the
> function and try removing the \markup wrapper. This \markup is added
> explicitly so it seems more efficient not to do that in the first place
> instead of removing it afterwards.
>
> Urs
>
>
> Thanks very much for this!
>
> Cheers,
>
> Ben
>
>
>
>
> On Jan 15, 2018 21:38, "Flaming Hakama by Elaine" <
> ela...@flaminghakama.com> wrote:
>
>
>
> On Sun, Jan 14, 2018 at 4:10 PM, Urs Liska  wrote:
>
>> Hi Ben,
>>
>> Actually I misread your original post and referred you to what you
>> already had.
>>
>> Elaine's hint is true but won't bring you any further because that's what
>> is already happening in the background when you use the \gitCommittish
>> function.
>>
>> The point is (I think) that the function is explicitly making a markup
>> from a string - and in order to concatenate a string for the file name you
>> should simply avoid that step.
>>
>> Urs
>>
>
> So, the \gitCommitish returns a markup, and it needs to be a string?
> If so, does this help?
>
> http://lsr.di.unimi.it/LSR/Item?id=747
>
>
> %% http://lsr.di.unimi.it/LSR/Item?id=747
> %% see also http://lilypond.org/doc/v2.18/Documentation/notation/text
>
> %% TODO markup->string is in the source
> %% test, if it can be deleted here
>
> % mup = markup argument
> % conc = boolean whether to concat or not
> #(define (markup->string mup conc)
> (let ((result ""))
>  (map (lambda (x)
>   (begin
> ;; if this is a concat-markup, do not insert
> blanks between string
> (if (eq? x concat-markup)(set! conc #t))
> (if (list? x)
> (set! result
>   ;; if we are concatenating or we start
> with an empty result, don't add a blank
>   (if (or conc (string=? result ""))
>   (string-append result
> (markup->string x conc))
>   (string-append result " "
> (markup->string x conc)
> (if (string? x)
> (set! result
>   ;; if we are concatenating or we start
> with an empty result, don't add a blank
>   (if (or conc (string=? result ""))
>   (string-append result x)
>   (string-append result " " x
> result))
>   mup)
>  result)
> )
> #(define-markup-command (plain-text layout props arg)(markup?)
> (interpret-markup layout props (markup
> (markup->string arg #f
>
>
> #(define output-suffix \plain-text \gitCommitish ... )
>
>
>
>
>
> David Elaine Alt
> 415 . 341 .4954 <%28415%29%20341-4954>
> "*Confusion is highly underrated*"
> ela...@flaminghakama.com
> skype: flaming_hakama
> Producer ~ Composer ~ Instrumentalist
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
>
>
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to append a git version to an output filename

2018-01-16 Thread Urs Liska



Am 16.01.2018 um 14:27 schrieb Ben Beeson:

Hi,

Wow, that looks very promising.  I am looking at this note on my cell 
phone right now, so I cannot test it just yet. I will try this later 
when I get home and see what happens.


But you should also look into the openLilyLib files, create a copy of 
the function and try removing the \markup wrapper. This \markup is added 
explicitly so it seems more efficient not to do that in the first place 
instead of removing it afterwards.


Urs



Thanks very much for this!

Cheers,

Ben




On Jan 15, 2018 21:38, "Flaming Hakama by Elaine" 
> wrote:




On Sun, Jan 14, 2018 at 4:10 PM, Urs Liska > wrote:

Hi Ben,

Actually I misread your original post and referred you to what
you already had.

Elaine's hint is true but won't bring you any further because
that's what is already happening in the background when you
use the \gitCommittish function.

The point is (I think) that the function is explicitly making
a markup from a string - and in order to concatenate a string
for the file name you should simply avoid that step.

Urs

So, the \gitCommitish returns a markup, and it needs to be a string?
If so, does this help?

http://lsr.di.unimi.it/LSR/Item?id=747



%% http://lsr.di.unimi.it/LSR/Item?id=747

%% see also
http://lilypond.org/doc/v2.18/Documentation/notation/text


%% TODO markup->string is in the source
%% test, if it can be deleted here

% mup = markup argument
% conc = boolean whether to concat or not
#(define (markup->string mup conc)
        (let ((result ""))
             (map (lambda (x)
                          (begin
                            ;; if this is a concat-markup, do not
insert blanks between string
                            (if (eq? x concat-markup)(set! conc #t))
                            (if (list? x)
                                (set! result
                                  ;; if we are concatenating or we
start with an empty result, don't add a blank
                                  (if (or conc (string=? result ""))
(string-append result (markup->string x conc))
(string-append result " " (markup->string x conc)
                            (if (string? x)
                                (set! result
                                  ;; if we are concatenating or we
start with an empty result, don't add a blank
                                  (if (or conc (string=? result ""))
(string-append result x)
(string-append result " " x
                            result))
                  mup)
             result)
)
#(define-markup-command (plain-text layout props arg)(markup?)
                        (interpret-markup layout props (markup
(markup->string arg #f


#(define output-suffix \plain-text \gitCommitish ... )





David Elaine Alt
415 . 341 .4954            "/Confusion
is highly underrated/"
ela...@flaminghakama.com 
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-





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


Re: How to append a git version to an output filename

2018-01-16 Thread Ben Beeson
Hi,

Wow, that looks very promising.  I am looking at this note on my cell phone
right now, so I cannot test it just yet. I will try this later when I get
home and see what happens.

Thanks very much for this!

Cheers,

Ben




On Jan 15, 2018 21:38, "Flaming Hakama by Elaine" 
wrote:



On Sun, Jan 14, 2018 at 4:10 PM, Urs Liska  wrote:

> Hi Ben,
>
> Actually I misread your original post and referred you to what you already
> had.
>
> Elaine's hint is true but won't bring you any further because that's what
> is already happening in the background when you use the \gitCommittish
> function.
>
> The point is (I think) that the function is explicitly making a markup
> from a string - and in order to concatenate a string for the file name you
> should simply avoid that step.
>
> Urs
>

So, the \gitCommitish returns a markup, and it needs to be a string?
If so, does this help?

http://lsr.di.unimi.it/LSR/Item?id=747


%% http://lsr.di.unimi.it/LSR/Item?id=747
%% see also http://lilypond.org/doc/v2.18/Documentation/notation/text

%% TODO markup->string is in the source
%% test, if it can be deleted here

% mup = markup argument
% conc = boolean whether to concat or not
#(define (markup->string mup conc)
(let ((result ""))
 (map (lambda (x)
  (begin
;; if this is a concat-markup, do not insert
blanks between string
(if (eq? x concat-markup)(set! conc #t))
(if (list? x)
(set! result
  ;; if we are concatenating or we start
with an empty result, don't add a blank
  (if (or conc (string=? result ""))
  (string-append result (markup->string
x conc))
  (string-append result " "
(markup->string x conc)
(if (string? x)
(set! result
  ;; if we are concatenating or we start
with an empty result, don't add a blank
  (if (or conc (string=? result ""))
  (string-append result x)
  (string-append result " " x
result))
  mup)
 result)
)
#(define-markup-command (plain-text layout props arg)(markup?)
(interpret-markup layout props (markup
(markup->string arg #f


#(define output-suffix \plain-text \gitCommitish ... )





David Elaine Alt
415 . 341 .4954 <(415)%20341-4954>
  "*Confusion is highly underrated*"
ela...@flaminghakama.com
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to append a git version to an output filename

2018-01-15 Thread Flaming Hakama by Elaine
On Sun, Jan 14, 2018 at 4:10 PM, Urs Liska  wrote:

> Hi Ben,
>
> Actually I misread your original post and referred you to what you already
> had.
>
> Elaine's hint is true but won't bring you any further because that's what
> is already happening in the background when you use the \gitCommittish
> function.
>
> The point is (I think) that the function is explicitly making a markup
> from a string - and in order to concatenate a string for the file name you
> should simply avoid that step.
>
> Urs
>

So, the \gitCommitish returns a markup, and it needs to be a string?
If so, does this help?

http://lsr.di.unimi.it/LSR/Item?id=747


%% http://lsr.di.unimi.it/LSR/Item?id=747
%% see also http://lilypond.org/doc/v2.18/Documentation/notation/text

%% TODO markup->string is in the source
%% test, if it can be deleted here

% mup = markup argument
% conc = boolean whether to concat or not
#(define (markup->string mup conc)
(let ((result ""))
 (map (lambda (x)
  (begin
;; if this is a concat-markup, do not insert
blanks between string
(if (eq? x concat-markup)(set! conc #t))
(if (list? x)
(set! result
  ;; if we are concatenating or we start
with an empty result, don't add a blank
  (if (or conc (string=? result ""))
  (string-append result (markup->string
x conc))
  (string-append result " "
(markup->string x conc)
(if (string? x)
(set! result
  ;; if we are concatenating or we start
with an empty result, don't add a blank
  (if (or conc (string=? result ""))
  (string-append result x)
  (string-append result " " x
result))
  mup)
 result)
)
#(define-markup-command (plain-text layout props arg)(markup?)
(interpret-markup layout props (markup
(markup->string arg #f


#(define output-suffix \plain-text \gitCommitish ... )





David Elaine Alt
415 . 341 .4954   "*Confusion is
highly underrated*"
ela...@flaminghakama.com
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to append a git version to an output filename

2018-01-14 Thread Urs Liska
Hi Ben,

Actually I misread your original post and referred you to what you already had.

Elaine's hint is true but won't bring you any further because that's what is 
already happening in the background when you use the \gitCommittish function.

The point is (I think) that the function is explicitly making a markup from a 
string - and in order to concatenate a string for the file name you should 
simply avoid that step.

Urs

Am 15. Januar 2018 00:04:53 MEZ schrieb Ben Beeson :
>Good evening all,
>I have attached an example that I hope helps. 
>Thomas, the gitCommitish I am using is the same as the one linked at:  
>https://github.com/openlilylib/snippets/blob/master/editorial-tools/git
>-commands/
>So after committing the LilyPond files to the repository, the current
>git version will appear in the tagline when you rebuild the pdf since
>that value is extracted in the tagline entry. What I seek is a way to
>get that value appended automatically to the generated pdf so that the
>generated pdf would have a filename such as:
>   CommitishExample-0490435.pdf.   
>Using \bookOutputSuffix seemed like a good place to start, but as
>Thomas has pointed out,  \bookOutputSuffix "\gitCommitish" or
>\bookOutputSuffix \gitCommitish does not work.  
>Elaine has a good idea to extract that information at the shell and
>then append it to the filename using shell functions. I had not thought
>of that method before. I will work on a shell script for that and see
>what come out of that.  
>David, 
>My apologies for referring you to the place where the git definitions I
>used were.  I thought that was information you were looking for.  
>Thanks to all for your help,
>Ben  
>
>On Sun, 2018-01-14 at 12:17 -0800, Flaming Hakama by Elaine wrote:
>> > -- Forwarded message --
>> > From: Ben Beeson 
>> > To: David Kastrup , lilypond-user > > rg>
>> > Subject: Re: How to append a git version to an output filename
>> > Hi David,
>> > 
>> > ...
>> > 
>> > What I seek is a way to append whatever the current git version is
>> > to the pdf filename that is generated so I don't have to open the
>> > pdf and check the tagline to see what version it is when searching
>> > for a specific version. Appending the git version to the filename
>> > would make it easier to know which version is represented by the
>> > pdf when searching through the directory.   
>> > 
>> > 
>> 
>> I'm unclear on what you want the git version of.  I can only assume
>> it is one of the lilypond source files.
>> 
>> In any case, if it something to do with the git commit version of a
>> file, you can get that from the command line, such as using something
>> like:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>  git log $file | head -1 | sed 's/commit //'
>> 
>> 
>> 
>> And then there is a way to execute a shell command from within
>> lilypond, and assign it to a variable.  Which I'm not familiar with,
>> but I've read on this list about people doing so.  I'd bet you could
>> find that in the mail archives.
>> 
>> 
>> 
>> > The Guile information I have seen so far online has not been too
>> > helpful for this particular question.  If anyone has any ideas, I
>> > would enjoy seeing those. 
>> > Cheers,
>> > Ben
>> 
>> 
>> HTH, 
>> 
>> David Elaine Alt
>> 415 . 341 .4954   "Confusion
>> is highly underrated"
>> ela...@flaminghakama.com
>> skype: flaming_hakama
>> Producer ~ Composer ~ Instrumentalist
>> 
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>> =-=-=-=-=-=-=-=-=-=-=-=-=- 
>> 
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to append a git version to an output filename

2018-01-14 Thread Ben Beeson
Good evening all,
I have attached an example that I hope helps. 
Thomas, the gitCommitish I am using is the same as the one linked at:  
https://github.com/openlilylib/snippets/blob/master/editorial-tools/git
-commands/
So after committing the LilyPond files to the repository, the current
git version will appear in the tagline when you rebuild the pdf since
that value is extracted in the tagline entry. What I seek is a way to
get that value appended automatically to the generated pdf so that the
generated pdf would have a filename such as:
CommitishExample-0490435.pdf.   
Using \bookOutputSuffix seemed like a good place to start, but as
Thomas has pointed out,  \bookOutputSuffix "\gitCommitish" or
\bookOutputSuffix \gitCommitish does not work.  
Elaine has a good idea to extract that information at the shell and
then append it to the filename using shell functions. I had not thought
of that method before. I will work on a shell script for that and see
what come out of that.  
David, 
My apologies for referring you to the place where the git definitions I
used were.  I thought that was information you were looking for.  
Thanks to all for your help,
Ben  

On Sun, 2018-01-14 at 12:17 -0800, Flaming Hakama by Elaine wrote:
> > -- Forwarded message --
> > From: Ben Beeson 
> > To: David Kastrup , lilypond-user  > rg>
> > Subject: Re: How to append a git version to an output filename
> > Hi David,
> > 
> > ...
> > 
> > What I seek is a way to append whatever the current git version is
> > to the pdf filename that is generated so I don't have to open the
> > pdf and check the tagline to see what version it is when searching
> > for a specific version. Appending the git version to the filename
> > would make it easier to know which version is represented by the
> > pdf when searching through the directory.   
> > 
> > 
> 
> I'm unclear on what you want the git version of.  I can only assume
> it is one of the lilypond source files.
> 
> In any case, if it something to do with the git commit version of a
> file, you can get that from the command line, such as using something
> like:
> 
> 
> 
> 
> 
> 
> 
> 
> 
>  git log $file | head -1 | sed 's/commit //'
> 
> 
> 
> And then there is a way to execute a shell command from within
> lilypond, and assign it to a variable.  Which I'm not familiar with,
> but I've read on this list about people doing so.  I'd bet you could
> find that in the mail archives.
> 
> 
> 
> > The Guile information I have seen so far online has not been too
> > helpful for this particular question.  If anyone has any ideas, I
> > would enjoy seeing those. 
> > Cheers,
> > Ben
> 
> 
> HTH, 
> 
> David Elaine Alt
> 415 . 341 .4954   "Confusion
> is highly underrated"
> ela...@flaminghakama.com
> skype: flaming_hakama
> Producer ~ Composer ~ Instrumentalist
> 
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> =-=-=-=-=-=-=-=-=-=-=-=-=- 
> \version "2.19.80"
 
\include "/home/ben/workspace/GitHub_BagPipeTunes/include/gitDefinitions.ily"


filename = "~/CommitishExample.ly"
tunesetVersion = "Version 1"
source = ""  

 

\header { 
  title = "Commitish Example"
  composer = ""
  arranger = ""
  meter = "" 
  tagline = \markup { \filename  " " \source " "  git Version: \gitCommitish  Committed: \gitDateTime
  Engraved:
  \simple #(strftime "%d - %b - %Y - %H%M  " (localtime (current-time)))
 % with \with-url #"http://lilypond.org/;
 % \line { LilyPond \simple #(lilypond-version) (http://lilypond.org/) }
}
}



\book {
  %\bookOutputSuffix   what to put here to get the suffix to be the git version "0490435" or whatever the latest version is???
  \bookOutputName "CommitishExample"   
  \score {
	\new GrandStaff <<
		\new Staff = "GHB" <<
			\new Voice {			
\time 4/4
\relative c''{	c4 d4 e4 f4 | }
\break

			}
		>>		
	>>

  }
}

  \paper {
#(set-paper-size "letter" 'portrait)
page-breaking = #ly:minimal-breaking
  }





CommitishExample.pdf
Description: Adobe PDF document
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to append a git version to an output filename

2018-01-14 Thread Noeck
Hi,

when I've seen the inclusion of git information on lilypondblog [1], I
liked it and adapted it to my taste:

Of course one can include a whole git log in the score, but the only
thing I was interested in is this: If I have a printed score or a PDF, I
want to know which version that was. All the rest I can look up in git.
And the versioning, I do with tags because I like it more than
hexadecimal hashes.

I have a tag for each year and each commit since then is counted, so
what I write on the score looks like:

   Version 2018.25

It's derived from `git describe`, the full command is:
git describe --long --dirty='+' | sed 's/-/./' | sed -r 's/-g[0-9a-f]+//g'

I like the combination of `git describe` and tags a lot. That's my
personal optimum between usefulness and beauty for both technical and
non-technical readers of the score.

Cheers,
Joram


[1]:
http://lilypondblog.org/2014/04/printing-git-versioning-info-in-a-score/

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


Re: How to append a git version to an output filename

2018-01-14 Thread David Kastrup
Ben Beeson  writes:

> Hi David,
>
> It has been a while since I visited the site, but more information on
> using git with scores is available at:
> http://lilypondblog.org/2014/04/printing-git-versioning-info-in-a-score
> / 
> Urs Liska and Lars Haulin provide some excellent tools and commentary
> with a link to the current definitions.ily file at:
> http://lilypondblog.org/wp-content/uploads/2014/04/definitions.ily in
> the snippets repository available at:
> https://github.com/openlilylib/snippets .  To find the definitions
> file, click through snippets-> editorial-tools -> git-commands.
> Enjoy,

I think I'll look for my enjoyment elsewhere.

-- 
David Kastrup

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


Re: How to append a git version to an output filename

2018-01-14 Thread Ben Beeson
Hi David,

It has been a while since I visited the site, but more information on
using git with scores is available at:
http://lilypondblog.org/2014/04/printing-git-versioning-info-in-a-score
/ 
Urs Liska and Lars Haulin provide some excellent tools and commentary
with a link to the current definitions.ily file at:
http://lilypondblog.org/wp-content/uploads/2014/04/definitions.ily in
the snippets repository available at:
https://github.com/openlilylib/snippets .  To find the definitions
file, click through snippets-> editorial-tools -> git-commands.
Enjoy,
Ben 





On Sun, 2018-01-14 at 17:26 +0100, David Kastrup wrote:
> Ben Beeson  writes:
> 
> > Hi David,
> > Here is how I get the \gitCommitish in the tagline. First, include
> > the
> > "gitDefinitions.ily" file.
> 
> What is that?
> 
> > I use something like this:
> > 
> > \include "/home/workspace/include/gitDefinitions.ily" 
> > 
> > Then in the header declaration, add the \gitCommitish and any other
> > items desired  to the tagline entry: 
> > 
> > \header { 
> >   title = "Title"   
> >   composer = ""
> >   arranger = ""
> >   meter = ""
> >   tagline = \markup { \filename  " " \source " "  git
> > Version:
> > \gitCommitish  Committed: \gitDateTime
> >   Engraved:
> >   \simple #(strftime "%d - %b - %Y - %H%M  " (localtime
> > (current-time)))
> >}
> > }
> > 
> > An example tagline from a score I am editing presently looks like
> > this:
> > 
> > 
> > Here \source is just a note to remind me where I got the
> > information i
> > used. This could be person's name or whatever. For the tagline
> > above,
> > \source is "null", so that value is missing from the tagline.   I
> > hope
> > that  the above is helpful to others. 
> > 
> > Regarding your comment about adding an expression to
> > \bookOutputSuffix
> > -- that is what I am trying to do.  That said, 
> > 
> > \bookOutputSuffix "\gitCommitish" or \bookOutputSuffix =
> > \gitCommitish  does not work as expected.
> 
> What about
> 
> \bookOutputSuffix \gitCommitish
> 
> then?
> 
> > The Guile information I have seen so far online has not been too
> > helpful for this particular question.
> 
> string-append and similar functions exist.
> ___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to append a git version to an output filename

2018-01-14 Thread Thomas Morley
Hi Ben,

2018-01-14 17:26 GMT+01:00 David Kastrup :
> Ben Beeson  writes:
>
>> Hi David,
>> Here is how I get the \gitCommitish in the tagline. First, include the
>> "gitDefinitions.ily" file.
>
> What is that?
>
>> I use something like this:
>>
>> \include "/home/workspace/include/gitDefinitions.ily"
>>
>> Then in the header declaration, add the \gitCommitish and any other
>> items desired  to the tagline entry:
>>
>> \header {
>>   title = "Title"
>>   composer = ""
>>   arranger = ""
>>   meter = ""
>>   tagline = \markup { \filename  " " \source " "  git Version:
>> \gitCommitish  Committed: \gitDateTime
>>   Engraved:
>>   \simple #(strftime "%d - %b - %Y - %H%M  " (localtime
>> (current-time)))
>>}
>> }
>>
>> An example tagline from a score I am editing presently looks like this:
>>
>>
>> Here \source is just a note to remind me where I got the information i
>> used. This could be person's name or whatever. For the tagline above,
>> \source is "null", so that value is missing from the tagline.   I hope
>> that  the above is helpful to others.
>>
>> Regarding your comment about adding an expression to \bookOutputSuffix
>> -- that is what I am trying to do.  That said,
>>
>> \bookOutputSuffix "\gitCommitish" or \bookOutputSuffix =
>> \gitCommitish  does not work as expected.
>
> What about
>
> \bookOutputSuffix \gitCommitish
>
> then?
>
>> The Guile information I have seen so far online has not been too
>> helpful for this particular question.
>
> string-append and similar functions exist.
>
> --
> David Kastrup



noone can help if you don't provide the needed information.
Your gitCommitish _may_ be the same as in
https://github.com/openlilylib/snippets/blob/master/editorial-tools/git-commands/
or not. Noone can tell.
A minimal working example with the used version would have been nice as well.


So for now I _guess_ you took it from there.

The problem then: `bookOutputSuffix' expects a string, but you provide
a markup. Can't work.
Different possibilities to proceed:
- catch what you need from the markup-command and write something
outputting a string
- markup->string

Cheers,
 Harm

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


Re: How to append a git version to an output filename

2018-01-14 Thread David Kastrup
Ben Beeson  writes:

> Hi David,
> Here is how I get the \gitCommitish in the tagline. First, include the
> "gitDefinitions.ily" file.

What is that?

> I use something like this:
>
> \include "/home/workspace/include/gitDefinitions.ily" 
>
> Then in the header declaration, add the \gitCommitish and any other
> items desired  to the tagline entry: 
>
> \header { 
>   title = "Title" 
>   composer = ""
>   arranger = ""
>   meter = ""
>   tagline = \markup { \filename  " " \source " "  git Version:
> \gitCommitish  Committed: \gitDateTime
>   Engraved:
>   \simple #(strftime "%d - %b - %Y - %H%M  " (localtime
> (current-time)))
>}
> }
>
> An example tagline from a score I am editing presently looks like this:
>
>
> Here \source is just a note to remind me where I got the information i
> used. This could be person's name or whatever. For the tagline above,
> \source is "null", so that value is missing from the tagline.   I hope
> that  the above is helpful to others. 
>
> Regarding your comment about adding an expression to \bookOutputSuffix
> -- that is what I am trying to do.  That said, 
>
> \bookOutputSuffix "\gitCommitish" or \bookOutputSuffix =
> \gitCommitish  does not work as expected.

What about

\bookOutputSuffix \gitCommitish

then?

> The Guile information I have seen so far online has not been too
> helpful for this particular question.

string-append and similar functions exist.

-- 
David Kastrup

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


Re: How to append a git version to an output filename

2018-01-14 Thread Ben Beeson
Hi David,
Here is how I get the \gitCommitish in the tagline. First, include the
"gitDefinitions.ily" file.  I use something like this:

\include "/home/workspace/include/gitDefinitions.ily" 

Then in the header declaration, add the \gitCommitish and any other
items desired  to the tagline entry: 

\header { 
  title = "Title"   
  composer = ""
  arranger = ""
  meter = ""
  tagline = \markup { \filename  " " \source " "  git Version:
\gitCommitish  Committed: \gitDateTime
  Engraved:
  \simple #(strftime "%d - %b - %Y - %H%M  " (localtime
(current-time)))
   }
}

An example tagline from a score I am editing presently looks like this:


Here \source is just a note to remind me where I got the information i
used. This could be person's name or whatever. For the tagline above,
\source is "null", so that value is missing from the tagline.   I hope
that  the above is helpful to others. 

Regarding your comment about adding an expression to \bookOutputSuffix
-- that is what I am trying to do.  That said, 

\bookOutputSuffix "\gitCommitish" or \bookOutputSuffix =
\gitCommitish  does not work as expected.  

What I seek is a way to append whatever the current git version is to
the pdf filename that is generated so I don't have to open the pdf and
check the tagline to see what version it is when searching for a
specific version. Appending the git version to the filename would make
it easier to know which version is represented by the pdf when
searching through the directory.   

The Guile information I have seen so far online has not been too
helpful for this particular question.  If anyone has any ideas, I would
enjoy seeing those. 

Cheers,

Ben 







On Sun, 2018-01-14 at 11:37 +0100, David Kastrup wrote:
> Ben Beeson  writes:
> 
> > Hello all,
> > 
> > I am using git to keep track of edits to scores and am presently
> > using 
> > 
> > 
> > \bookOutputName "score-filename" 
> >  
> > to write the output filename for the pdf that is generated in the
> > LilyPond "ly" file.  I am also using  
> > 
> > "git Version: \gitCommitish " 
> > 
> > in the tagline so the generated pdf has the git version information
> > included in the score that is generated.
> 
> How would that work?
> 
> > I am wondering if there is a way to include \gitCommitish in
> > \bookOutputSuffix so that the output filename looks like:
> > 
> > "score-filename-gitversion.pdf".
> > 
> > So far I have not been able to figure out how to do that or find an
> > existing solution in the snippets, forum or elsewhere.   If anyone
> > has
> > a solution, please share it.
> 
> It's easy to use any Guile string expression as argument to
> \bookOutputSuffix but I have no idea how you manage to get the
> Commitish
> into the tagline.
> ___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: How to append a git version to an output filename

2018-01-14 Thread Urs Liska



Am 14.01.2018 um 11:44 schrieb Andrew Bernard:

Hi Ben,

I think the desire to add git version information to files is a 
hangover from earlier days when people used to do this with SCCS, CVS, 
RCS, and all those antique systems. With git, due to its model, that's 
not so commonly done nowadays.


If you want to manage your files by the complex git hash numbers, then 
why not check in the output to the commit as well? Then you can simply 
add tags to make it more humanly readable. You could add the tag name 
to the file name if you really so desired. Seems simpler that what you 
are asking to do.


I know this is not the answer you are looking for, but may be a way to go?


Generally it's straightforward to have LilyPond run Git during 
compilation and add any log output to the filename or the tagline. (As 
is already wrapped by my command linked to in the previous comment.


One thing to consider is that more often than not scores will be 
compiled with uncommitted changes being present, so the git committish 
may actually be misleading. (I have added several commands to handle 
that too).


Urs




Andrew



___
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: How to append a git version to an output filename

2018-01-14 Thread Andrew Bernard
Hi Ben,

I think the desire to add git version information to files is a hangover
from earlier days when people used to do this with SCCS, CVS, RCS, and all
those antique systems. With git, due to its model, that's not so commonly
done nowadays.

If you want to manage your files by the complex git hash numbers, then why
not check in the output to the commit as well? Then you can simply add tags
to make it more humanly readable. You could add the tag name to the file
name if you really so desired. Seems simpler that what you are asking to do.

I know this is not the answer you are looking for, but may be a way to go?

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


Re: How to append a git version to an output filename

2018-01-14 Thread Urs Liska

Hi Ben,


Am 14.01.2018 um 03:17 schrieb Ben Beeson:

Hello all,

I am using git to keep track of edits to scores and am presently using

\bookOutputName "score-filename"
to write the output filename for the pdf that is generated in the 
LilyPond "ly" file. I am also using


"git Version: \gitCommitish "

in the tagline so the generated pdf has the git version information 
included in the score that is generated. I am wondering if there is a 
way to include \gitCommitish in \bookOutputSuffix so that the output 
filename looks like:


"score-filename-gitversion.pdf".

So far I have not been able to figure out how to do that or find an 
existing solution in the snippets, forum or elsewhere. If anyone has a 
solution, please share it.


You should have a look at 
https://github.com/openlilylib/snippets/tree/master/editorial-tools/git-commands
I'm not sure if that's up-to-date, and IIRC it doesn't work on windows, 
but probably you can either use that directly throught the "snippets" 
package or copy the useful code.


HTH
Urs





Thanks in advance,

Ben





___
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: How to append a git version to an output filename

2018-01-14 Thread David Kastrup
Ben Beeson  writes:

> Hello all,
>
> I am using git to keep track of edits to scores and am presently using 
>
>
>   \bookOutputName "score-filename" 
>  
> to write the output filename for the pdf that is generated in the
> LilyPond "ly" file.  I am also using  
>
>   "git Version: \gitCommitish " 
>
> in the tagline so the generated pdf has the git version information
> included in the score that is generated.

How would that work?

> I am wondering if there is a way to include \gitCommitish in
> \bookOutputSuffix so that the output filename looks like:
>
>   "score-filename-gitversion.pdf".
>
> So far I have not been able to figure out how to do that or find an
> existing solution in the snippets, forum or elsewhere.   If anyone has
> a solution, please share it.

It's easy to use any Guile string expression as argument to
\bookOutputSuffix but I have no idea how you manage to get the Commitish
into the tagline.

-- 
David Kastrup

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


How to append a git version to an output filename

2018-01-14 Thread Ben Beeson
Hello all,

I am using git to keep track of edits to scores and am presently using 


\bookOutputName "score-filename" 
 
to write the output filename for the pdf that is generated in the
LilyPond "ly" file.  I am also using  

"git Version: \gitCommitish " 

in the tagline so the generated pdf has the git version information
included in the score that is generated. I am wondering if there is a
way to include \gitCommitish in \bookOutputSuffix so that the output
filename looks like:

"score-filename-gitversion.pdf".

So far I have not been able to figure out how to do that or find an
existing solution in the snippets, forum or elsewhere.   If anyone has
a solution, please share it.

Thanks in advance,

Ben   

 


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