[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to correctly use ly:warning-located?
From: |
David Kastrup |
Subject: |
Re: How to correctly use ly:warning-located? |
Date: |
Sun, 21 Feb 2016 15:13:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) |
Simon Albrecht <address@hidden> writes:
> Hello,
>
> the doc string for ly:warning-located says
>
> ‘Function: ly:warning-located location str rest
> A Scheme callable function to issue the warning str at the specified
> location in an input file. The message is formatted with format and
> rest.’
>
> However, with this example
>
> %%%%%%%%%%%
> \version "2.19.36"
>
> m =
> #(define-music-function ()()
> (ly:warning-located *location* "Here, \\m should be replaced with
> \\melisma.")
> #{ \melisma #})
>
> <<
> {
> c'1\m d\melismaEnd
> }
> \addlyrics { test test }
>>>
> %%%%%%%%
>
> I get
>
> document.ly:5:4: Wrong type argument in position 1 (expecting string):
> #<procedure *location* ()>
>
> What is the correct way?
*location* is a procedure (used for accessing the fluid %location local
to the guile module), not a location. So call it.
Of course, you can just pipe
m =
#(define-music-function (parser location)()
(ly:warning-located location "Replace me")
#{ \melisma #})
through
convert-ly -f 2.19.20 -t 2.19.30 -
and see what comes out.
I get
convert-ly (GNU LilyPond) 2.19.32
convert-ly: Processing `'...
Applying conversion: 2.19.22, 2.19.24, 2.19.28, 2.19.29
\version "2.19.29"
m =
#(define-music-function ()()
(ly:warning-located (*location*) "Replace me")
#{ \melisma #})
--
David Kastrup