lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile and i10n


From: Nicolas Sceaux
Subject: Re: guile and i10n
Date: Thu, 1 Jan 2009 17:39:16 +0100

Le 1 janv. 09 à 16:23, Han-Wen Nienhuys a écrit :

On Wed, Dec 31, 2008 at 10:01 PM, Nicolas Sceaux <address@hidden > wrote:
If anything, this is not a GUILE problem, but a lilypond one.
define-music-function as _i are Scheme macros.  It could be that the
expansion does not occur correctly, but I know too little of macros to
say something useful about this.

Nicolas?

Huh, the only definition of _i that I find in the sources is
(defmacro-public _i (x) x)
What is the point of that? Shouldn't it expand into the result of a call
to gettext?

The string needs to be marked so it can be extracted form the source
code by other tools.

oops ok.

The following is an ugly hack, but seems to do the job:

(defmacro-public define-music-function (args signature . body)
 (if (and (pair? body) (pair? (car body)) (eqv? '_i (caar body)))
     (let ((docstring (gettext (cadar body)))
           (body (cdr body)))
       `(ly:make-music-function (list ,@signature)
                                (lambda (,@args)
                                  ,docstring
                                  ,@body)))
     `(ly:make-music-function (list ,@signature)
                              (lambda (,@args)
                                ,@body))))

(macroexpand '(define-music-function (parser location) ()
                (_i "new tremolo format")
                (make-music 'Music))))
==>
(ly:make-music-function (list)
  (lambda (parser location)
    "nouveau format de tremolo"
    (make-music (quote Music))))

nicolas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]