LilyPond and Frescobaldi act differently with include files

7 views
Skip to first unread message

Knute Snortum

unread,
Oct 4, 2021, 6:59:41 PM10/4/21
to fresc...@googlegroups.com
This is (hopefully) a continuation of a discussion on
music.stackexchange.com involving LilyPond and Frescobaldi and how
they handle include files. The question is here[1]. This is what the
user Kjara said in a reply to an answer of mine (ksnortum).

"If I have a file of a certain name X in the same folder as the file
that I'm compiling (and I'm NOT including X in the main file!), and I
use lilypond compiler, there is no problem at all. It just does not
matter that X is there. That is, in my opinion, the correct behaviour.
Frescobaldi on the other hand DOES care about the presence of X: It
simply does not compile. How can this not be a Frescobaldi issue?"

I was not able to reproduce this problem. Here's what I did:

1) I created a LilyPond file called foo.ly containing this:

%%%
\version "2.22.1"

foo = { c' c' c' c' }
%%%

2) In the same directory, I created a LilyPond file test-foo.ly that
contains this:

%%%
\version "2.22.1"

\include "foo.ly"

\score {
\new Staff \foo
}
%%%

3) Whether I compiled this in Frescobaldi or at the command line with
LilyPond, there were no errors and a PDF file was created.

I may be misunderstanding the problem Kjara is describing. In the
original question, the file "X" was init.ly. Now LilyPond contains a
file called that and if it is first in the include path, it causes an
error. I was able to avoid this by either a) giving a whole path name
to the local init.ly file, or b) making sure the local init.ly file
was first in the include path in Frescobaldi. But with foo.ly, I saw
no problems.


1. https://music.stackexchange.com/questions/117687/frescobaldi-does-not-create-files
--
Knute Snortum (ksnortum)

Federico Bruni

unread,
Oct 5, 2021, 4:20:46 AM10/5/21
to fresc...@googlegroups.com
Il giorno lun 4 ott 2021 alle 15:59:28 -0700, Knute Snortum
<ksno...@gmail.com> ha scritto:
> I may be misunderstanding the problem Kjara is describing. In the
> original question, the file "X" was init.ly. Now LilyPond contains a
> file called that and if it is first in the include path, it causes an
> error. I was able to avoid this by either a) giving a whole path name
> to the local init.ly file, or b) making sure the local init.ly file
> was first in the include path in Frescobaldi. But with foo.ly, I saw
> no problems.

This is exactly the problem and it's a known lilypond "problem"
explained in the documentation:
http://lilypond.org/doc/v2.22/Documentation/notation/including-lilypond-files

"If an included file is given a name which is the same as one in
LilyPond’s installation files, LilyPond’s file from the
installation files takes precedence."

The simple solution is using a different name, e.g. myinit.ly or def.ly
or whatever.


Reply all
Reply to author
Forward
0 new messages