[Top][All Lists]

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

Re: markup->string and user markup commands

From: Thomas Morley
Subject: Re: markup->string and user markup commands
Date: Fri, 9 Nov 2018 00:23:52 +0100

Am Do., 8. Nov. 2018 um 21:00 Uhr schrieb Jérôme Plût <address@hidden>:
> #(begin
> ; after
> (define-markup-command (with-background layout props color arg) (color? 
> markup?)
>    (let* ((stencil (interpret-markup layout props arg))
>           (X-ext (ly:stencil-extent stencil X))
>           (Y-ext (ly:stencil-extent stencil Y)))
>      (ly:stencil-add (ly:make-stencil
>                       (list 'color color
>                         (ly:stencil-expr (ly:round-filled-box X-ext Y-ext 0))
>                         X-ext Y-ext)) stencil)))
> (display "\"")
> (display (markup->string (markup #:with-background `(1. 0. 0.) "something")))
> (display "\"")
> )
> This should display "something". However it displays an empty string.
> How could I fix this?
> (I tried to manually debug markup->string (in scm/markup.scm): as I
> understand it, the problem is likely that with-background does not
> belong to the 'lily module. However, I am completely unfamiliar with
> guile's module system, so I don't have the slightest idea about how to
> fix this).
> Thanks,
> --
>         Jérôme

You could do

    (define all-relevant-markup-commands
      ;; Returns a list containing the names of all markup-commands and
      ;; markup-list-commands with predicate @code{cheap-markup?} or
      ;; @code{markup-list?} in their @code{markup-command-signature}.
      ;; @code{table-of-contents} is not caught, same for user-defined commands.
      ;; markup-commands from @code{markup-commands-to-ignore} are removed.
      (lset-difference eq?
        (map car
            (lambda (x)
              (let* ((predicates (markup-command-signature (cdr x))))
                (and predicates
                         (lset-intersection eq?
                           '(cheap-markup? markup-list?)
                           (map procedure-name predicates)))))))
;;;; !!!!!!!!!!!!!!
           (ly:module->alist (current-module))
           (ly:module->alist (resolve-module '(lily))))))

in markup->string from markup.scm

Not sure about unwished side-effects, though.


reply via email to

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