Re: Where was my music-function called?

Timothy Lanfear <[email protected]> Fri, 24 Jul 2026 13:51:21 +0100
Newsgroups gmane.comp.gnu.lilypond.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------j68NtMkNWccj75oQfP0f0f24
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

On 24/07/2026 13:11, Graham King wrote:
> I'm trying to debug some Scheme code, and it would be really helpful to
> be able to make a music-function display the lilypond source-code-line-
> number where the music-function was called.
\version "2.27.1"

insertC = #(define-music-function ()()
             (ly:message "insertC called at line ~a" (*location*))
             #{ c'1 #} )

{ \repeat unfold 3 { c' d' e' f' }
   \insertC
}

-- 
Timothy Lanfear, Bristol, UK.

--------------j68NtMkNWccj75oQfP0f0f24
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">On 24/07/2026 13:11, Graham King wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:[email protected]">
      <pre wrap="" class="moz-quote-pre">I'm trying to debug some Scheme code, and it would be really helpful to
be able to make a music-function display the lilypond source-code-line-
number where the music-function was called.
</pre>
    </blockquote>
    <font face="monospace">\version "2.27.1"<br>
      <br>
      insertC = #(define-music-function ()()<br>
                  (<a class="moz-txt-link-freetext" href="ly:message">ly:message</a> "insertC called at line ~a" (*location*))<br>
                  #{ c'1 #} )<br>
      <br>
      { \repeat unfold 3 { c' d' e' f' }<br>
        \insertC<br>
      }</font><br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Timothy Lanfear, Bristol, UK.</pre>
    <div id="grammalecte_menu_main_button_shadow_host"
      style="width: 0px; height: 0px;"></div>
  </body>
</html>

--------------j68NtMkNWccj75oQfP0f0f24--