lilypond-user
[Top][All Lists]
Advanced

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

Re: parser location inTab


From: David Kastrup
Subject: Re: parser location inTab
Date: Sat, 26 Jan 2019 14:59:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Gack McShite <address@hidden> writes:

> Trying to clean up errors.  I see this pattern a lot, so I assume it
> should work.
>
> TrackAVoiceAMusic = #(define-music-function (parser location inTab) (boolean?)
> #{
>    \tempo 4=106
>    \clef #(if $inTab "tab" "treble_8")
>
> and then later
>
>    \context Voice = "TrackAVoiceAMusic" {
>       \TrackAVoiceAMusic ##f
>    }
>
>
> or
>
>    \context TabVoice = "TrackAVoiceAMusic" {
>       \removeWithTag #'chords
>       \removeWithTag #'texts
>       \TrackAVoiceAMusic ##t
>    }
>
> Originally had \version "2.14.0"
> changed to \version "2.18.0"
>
> Thanks for hints.


2 Updating files with ‘convert-ly’
**********************************

As LilyPond is improved, the syntax (input language) of some commands
and functions can change.  This can result in unexpected errors,
warnings or even wrong output when input files, previously created for
older versions of LilyPond are then used with later versions.

   To help with this the ‘convert-ly’ command can be used to upgrade
these older input files to use the newer syntax.

* Menu:

* Why does the syntax change?::
* Invoking convert-ly::
* Command line options for convert-ly::
* Problems running convert-ly::
* Manual conversions::
* Writing code to support multiple versions::

[...]

File: lilypond-usage.info,  Node: Invoking convert-ly,  Next: Command line 
options for convert-ly,  Prev: Why does the syntax change?,  Up: Updating files 
with convert-ly

2.2 Invoking ‘convert-ly’
=========================

The ‘convert-ly’ command uses the ‘\version’ number in the input file to
detect older versions.  In most cases, to upgrade your input file it is
sufficient just to run;

     convert-ly -e myfile.ly

in the directory containing the input file.  This will upgrade
‘myfile.ly’ in-place and preserve the original file by renaming it
‘myfile.ly~’.  The ‘\version’ number in the upgraded input file, along
with any required syntax updates, is also changed.

   When run, the ‘convert-ly’ command will output the version numbers of
which conversions have been made to.  If no version numbers are listed
in the output for the file, it is already up to date and using the
latest LilyPond syntax.

          Note: For each new version of LilyPond, a new ‘convert-ly’
          command is created, however not every version of LilyPond will
          need syntax changes for its input files from the version
          before.  This means that the ‘convert-ly’ command will only
          convert input files up to the latest syntax change it has and
          this, in turn, may mean that the ‘\version’ number left in the
          upgraded input file is sometimes earlier than the version of
          ‘convert-ly’ command itself.

   To convert all input files in a single directory use;

     convert-ly -e *.ly

   Linux and MacOS X users can both use the appropriate terminal
application, but MacOS X users can also execute this command directly
under the menu entry ‘Compile > Update syntax’.

   A Windows user would run the command;

     convert-ly.py -e *.ly

entering these commands in a ‘command prompt’ usually found under ‘Start
> Accessories > Command Prompt’ or for version 8 users, by typing in the
search window ‘command prompt’.

   To convert all input files that reside in different sets of
subdirectories;

     find . -name '*.ly' -exec convert-ly -e '{}' \;

   This example searches and converts all input files in the current
directory and all directories below it recursively.  The converted files
will be located in the same directory along with their renamed
originals.  This should also work for MacOS X users, although only via
the terminal app.

   Windows user would use;

     forfiles /s /M *.ly /c "cmd /c convert-ly.py -e @file"

   Alternatively, an explicit path to the top-level of your folder
containing all the sub-folders that have input files in them can be
stated using the ‘/p’ option;

     forfiles /s /p C:\Documents\MyScores /M *.ly /c "cmd /c convert-ly.py -e 
@file"

   If there are spaces in the path to the top-level folder, then the
whole path needs to be inside double quotes;

     forfiles /s /p "C:\Documents\My Scores" /M *.ly /c "cmd /c convert-ly.py 
-e @file"



-- 
David Kastrup



reply via email to

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