On Thu, 2017-08-10 at 13:40 -0700, H. S. Teoh wrote:
> On Thu, Aug 10, 2017 at 06:40:10PM +0000, Vlad Kudelin wrote:
> > Lilypond just makes it natural to put everything under
> > version control!
> [...]
>
> [...] I use git, which allows me to experiment with different
> branches (different ways of scoring a passage) quickly and easily, and
> without risk of losing previous versions should I decide to revert.
>
So, here's a bonus, to be inserted immediately below the \version line
of your score:
\version "2.19.40"
% from snippet 197 (more to see at
http://lsr.di.unimi.it/LSR/Search ):
#(define comml (object->string (command-line)))
#(define loc (+ (string-rindex comml #\space ) 2))
#(define commllen (- (string-length comml) 2))
#(define filen (substring comml loc commllen))
% filename
#(define modt (stat:mtime (stat filen)))
% Last modified
#(define modts (strftime "%d %b %Y %H:%M:%S" (localtime
modt))) % Command line
% gitrev (from
http://lilypondblog.org/2014/01/why-use-version-control-for-engraving-scores/#more-2151
)
#(use-modules (ice-9 popen))
#(use-modules (ice-9 rdelim))
% NOTE: This function only reads the first line of the command!
#(define (strsystem_internal cmd)
(let* ((port (open-input-pipe cmd))
(str (read-line port)))
(close-pipe port)
str))
#(define-markup-command (strsystem layout props cmd) (markup?)
(interpret-markup layout props
(strsystem_internal cmd)))
gitrev = \markup { \strsystem "/opt/local/bin/git rev-parse
--short HEAD" }
\header {
tagline = \markup{ \center-column{
\concat {"Music engraving by Lilypond "
$(lilypond-version) "-www.lilypond.org"
}
\line { "Version control for this edition: gitrev "
\gitrev " " \modts }
}}
}
Now you can tell whether that paper copy is up-to-date. Of course, you
don't want this code cluttering up every lilypond score, so best put it
in a separate file and \include it.
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user