Re: accessing current file name in markup function

2023-12-08 Thread Werner LEMBERG
>> The name "sip" is a bit weird; looking in the commit that added the >> code 19 years ago, it looks like it was meant as "smob input" >> (where smob = Scheme object = LilyPond C++ object made available to >> Scheme). Quickly written documentation by an insider. It should be eventually

Re: accessing current file name in markup function

2023-12-08 Thread Jeff Olson
On 12/7/2023 12:21 PM, Jean Abou Samra wrote: Documentation question from trying to understand *location* in David's solution: Guessing, is sip a stream input pointer? _Where would I look to find the definition/example of sip?_  *location* doesn't return a string but a special type

Re: accessing current file name in markup function

2023-12-07 Thread Jean Abou Samra
> Documentation question from trying to understand *location* in David's > solution: > > I found that function in the IR documentation[1], but I could not find the > definition of a sip: > > > > Function: ly:input-file-line-char-column sip > > Return input location in sip as (file-name line

Re: accessing current file name in markup function

2023-12-07 Thread Jeff Olson
On 12/6/2023 3:48 PM, David Kastrup wrote: \version "2.24.2" locationOf = #(define-scheme-function () () (apply format #f "~a:~a:~a:~a" (ly:input-file-line-char-column (*location* \markup { \locationOf } Documentation question from trying to understand *location* in David's

Re: accessing current file name in markup function

2023-12-07 Thread Werner LEMBERG
>> Thanks! However, Jean's statement >> >> > markups don't store location info, unfortunately. >> >> is still true, which means that you can't access the current input >> location within `define-markup-command`. > > Yes, sure, but you could inject this during parsing. [...] I'm doing very

Re: accessing current file name in markup function

2023-12-07 Thread Valentin Petzel
Am Donnerstag, 7. Dezember 2023, 06:47:56 CET schrieb Werner LEMBERG: > >> Maybe a bit less esoteric: > > Or even less esoteric: > Thanks! However, Jean's statement > > > markups don't store location info, unfortunately. > > is still true, which means that you can't access the current input >

Re: accessing current file name in markup function

2023-12-06 Thread Werner LEMBERG
>> Maybe a bit less esoteric: > > Or even less esoteric: Thanks! However, Jean's statement > markups don't store location info, unfortunately. is still true, which means that you can't access the current input location within `define-markup-command`. Werner

Re: accessing current file name in markup function

2023-12-06 Thread David Kastrup
Valentin Petzel writes: > Am Mittwoch, 6. Dezember 2023, 23:10:11 CET schrieb Jean Abou Samra: >> \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)))

Re: accessing current file name in markup function

2023-12-06 Thread Valentin Petzel
Am Mittwoch, 6. Dezember 2023, 23:10:11 CET schrieb Jean Abou Samra: > \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 {{}} Maybe

Re: accessing current file name in markup function

2023-12-06 Thread Jean Abou Samra
> OK, thanks.  But what about accessing the `input-file-name` variable? > Shouldn't this work within `delay-stencil-evaluation`? delay-stencil-evaluation or not, during backend processing, input-file-name is set to the filename of the main file, not the filename of the file where the markup

Re: accessing current file name in markup function

2023-12-06 Thread Werner LEMBERG
>> 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

Re: accessing current file name in markup function

2023-12-06 Thread Jean Abou Samra
> 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

accessing current file name in markup function

2023-12-06 Thread Werner LEMBERG
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? Werner