[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: error handling
From: |
Thomas Morley |
Subject: |
Re: error handling |
Date: |
Mon, 18 Jul 2022 12:37:38 +0200 |
Am Mo., 18. Juli 2022 um 11:02 Uhr schrieb Jean Abou Samra <jean@abou-samra.fr>:
>
> Le 17/07/2022 à 23:33, Thomas Morley a écrit :
> > Sorry for the delayed reply!
> > I now tried to make some steps for scm-files/ly:load/autocompile.
> >
> > Though, as far as I can tell ly:load doesn't work with relative pathes.
>
>
> As said on the issue, I misremembered what ly:load does, sorry.
> Use add-to-load-path and primitive-load-path as in the example on
> the issue.
>
> I just tried using it and I didn't get conclusive results, but
> I don't even get locations on code within LilyPond itself right now,
> whereas usually I do. I'll probably find a silly mistake in my
> testing when I'm less tired.
I tried to follow two different methods today
###############
(1) compile
In a /scm/file.scm:
(use-modules (system base compile))
(define whatever (lambda (arg) <body>))
(define whatever-procedure (compile 'whatever #:env (interaction-environment))
In an init.ly-file
#(begin
(add-to-load-path ".")
(primitive-load-path "scm/functions.scm"))
Actually this made all slower. Though, in the past I made other
experiments with `compile' making things faster.
While worth investigating, I stopped here, even before looking for
error handling.
###############
(2) auto-compile
My init.ly looks:
%%%%%%%%%%%%%%%%%%%
\version "2.23.9"
\include "zither-paper-defaults.ly"
%\include "zither-tab-markup-commands.ly"
#(begin
;; add current directory in load paths,
;; the default only contains Guile internal paths
(add-to-load-path ".")
(primitive-load-path "scm/markup-commands.scm"))
\include "zither-tab-titling.ly"
%\include "zither-tab-functions.ly"
#(begin
(add-to-load-path ".")
(primitive-load-path "scm/functions.scm"))
%\include "zither-scheme-engraver.ly"
#(begin
(add-to-load-path ".")
(primitive-load-path "scm/scheme-engraver.scm"))
\include "zither-tab-layout.ly"
%%%%%%%%%%%%%%%%%%%
My scm-folder:
$ ls scm/
functions.scm markup-commands.scm scheme-engraver.scm
If I now try to compile a file with
$ GUILE_AUTO_COMPILE=1 lilypond doc-snippets/zither-rests.ly
Further compilations without auto-compile are fast.
Forcing a known problem, which I was not able to localize before, now returns:
scm/functions.scm:375:8: In procedure set-rest-staff-position:
In procedure -: Wrong type argument in position 1: #f
That's pretty nice and a GREAT improvement.
Though, as soon as I do
$ cd doc-snippets
$ lilypond zither-rests.ly
Pathes are wrong again:
../zither-tab-init.ly:6:2: error: GUILE signaled an error for the
expression beginning here
#
(begin
Unable to find file "scm/markup-commands.scm" in load path
Adding (add-to-load-path "..") cures it. Though, likely it will error
again, if I move to a different, not covered folder, to compile
something there.
I could provide the absolute path to primitive-load-path (I expect it
will work for me, not tested, though), and likey I'll do so for now.
Alas, it's not unlikely noone else can use this code, meant as a
public extension to LilyPond, without adjusting those pathes.
I'll probably stay with that setup for now, and change all back to
ly-files once current development cycle is finished.
>
> Meanwhile, another option is not to use version 2.23.10 (which
> is advertised as an "unstable" version after all). If you
> don't want to go back to 2.22, you could use 2.23.6 from
> lilypond.org, which is the last released version to use Guile 1,
> and not all that old.
Yeah, last resort ...
Thanks,
Harm