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 01:01:01 +0100

Le 31 déc. 08 à 19:02, Han-Wen Nienhuys a écrit :

Hi,

I think GUILE (like other LISPS) do not evaluate the

On Wed, Dec 31, 2008 at 2:10 PM, Werner LEMBERG <address@hidden> wrote:

I see the following remark in a recent git commit:

Scrap localization wrapper around music functions docstrings.

The l10n wrapper _i seems to prevent GUILE from recognizing the
docstrings as such.

Looks like a bug or a bad `feature'.  Have you already contacted the
GUILE people for a workaround?


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?

Anyway, it seems that even with the current definition of _i, it cannot
be used for docstrings (I don't understand why).

guile> (macroexpand '(define-music-function (parser location) ()
                       (_i "blahblah")
                       (make-music 'Music)))
  (ly:make-music-function (list)
     (lambda (parser location)
       (_i "blahblah")
       (make-music (quote Music))))

Currently, no literal string is found after the arguments of lambda, so
no docstring is detected.

However, it is possible to call gettext during the expansion of
define-music-function, for instance:

guile> (defmacro-public define-music-function (args signature . body)
  (if (and (pair? body) (string? (car body)))
      (let ((docstring (gettext (car body)))
            (body (cdr body)))
        `(ly:make-music-function (list ,@signature)
                                 (lambda (,@args)
                                   ,docstring
                                   ,@body)))
      `(ly:make-music-function (list ,@signature)
                               (lambda (,@args)
                                 ,@body))))
guile> (macroexpand '(define-music-function (parser location) ()
                       "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]