From 50e08220c4065cec2c59e32a2a0393abeb704348 Mon Sep 17 00:00:00 2001 From: Christoph Wagner Date: Wed, 1 Jul 2026 17:58:10 +0200 Subject: [PATCH] make customEps path resolution more robust --- .../base/eps_file_from_song_dir.ily | 18 ++++++++++++++---- private_includes/book/book_include.ily | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/private_includes/base/eps_file_from_song_dir.ily b/private_includes/base/eps_file_from_song_dir.ily index cc6b3ba..b755557 100644 --- a/private_includes/base/eps_file_from_song_dir.ily +++ b/private_includes/base/eps_file_from_song_dir.ily @@ -6,10 +6,20 @@ #(define-markup-command (customEps layout props ysize filename)(number? string?) #:properties ((songfilename "")) (interpret-markup layout props - (let ((defaulttitlemarkup (ly:output-def-lookup layout 'defaultTitleMarkup)) - (filepath (if (string-null? songfilename) - filename - (ly:format "~a/~a/~a" songPath songfilename filename)))) + (let* ((defaulttitlemarkup (ly:output-def-lookup layout 'defaultTitleMarkup)) + ;; Determine the song directory to resolve the EPS relative to. + ;; In TEXT the name arrives via the markup props (\setsongfilename), + ;; but inside MUSIC (e.g. \mark) the props do not carry it, so we + ;; fall back to the value stored in the score's \layout block. + (layout-songfilename (ly:output-def-lookup layout 'songfilename #f)) + (songdir (cond ((not (string-null? songfilename)) songfilename) + ((and (string? layout-songfilename) + (not (string-null? layout-songfilename))) + layout-songfilename) + (else #f))) + (filepath (if songdir + (ly:format "~a/~a/~a" songPath songdir filename) + filename))) (if (file-exists? filepath) (make-epsfile-markup Y ysize filepath) (if defaulttitlemarkup diff --git a/private_includes/book/book_include.ily b/private_includes/book/book_include.ily index 7eb1037..cf20fad 100644 --- a/private_includes/book/book_include.ily +++ b/private_includes/book/book_include.ily @@ -205,7 +205,7 @@ songs = \bookpart { $header \headerToTOC #header #label - \score { $music \layout { $layout } } + \score { $music \layout { $layout songfilename = $(symbol->string filename) } } $(add-text-pages text-pages) } #}))))))