[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: accessing current file name in markup function
From: |
Jean Abou Samra |
Subject: |
Re: accessing current file name in markup function |
Date: |
Wed, 06 Dec 2023 23:10:11 +0100 |
User-agent: |
Evolution 3.50.1 (3.50.1-1.fc39) |
> How can I access the current LilyPond input file name from within a
> markup command? Or do I have to use the (undocumented)
> `delay-stencil-evaluation` functionality?
If you mean the name of the file from which the command is called
(vs. defined), you can't — markups don't store location info,
unfortunately. If you really need a workaround, you can make
your markup command require a ly:music? argument and give {{}}
for this argument when calling it. Then you can use the 'origin
property of that music object, e.g.,
\version "2.24.2"
#(define-markup-command (foo layout props loc-provider) (ly:music?)
(display (ly:input-file-line-char-column (ly:music-property loc-provider
'origin)))
empty-stencil)
\markup \foo {{}}
signature.asc
Description: This is a digitally signed message part