1.2.3 Debugging Scheme code

When debugging large Scheme programs, it is helpful when an error occurs to be pointed to the precise line in the program where it was raised. In order to enable source locations to be shown for errors in Scheme code, LilyPond must be run with the command-line option -dcompile-scheme-code. Alternatively, writing #(ly:set-option 'compile-scheme-code) at the top of the LilyPond file has the same effect.

Furthermore, to obtain even more information about the error, you may use the -ddebug-eval option, or the code #(debug-enable 'backtrace) in the file. Under this mode, when an error occurs, a verbose “backtrace” is displayed, containing information about all function calls that led to the problematic spot.

Known issues and warnings

Due to a limitation in the Guile implementation, the -dcompile-scheme-code option currently makes it impossible to compile LilyPond files with more than a few thousand Scheme expressions.

Extending LilyPond v2.25.22 (development-branch).