Thank you so much Aaron,

How could I have *never* used chain-assoc-get. I've read the docs about it
since then. I also used (display props) to know what was available (which
by itself was instructing).

Again, I'm very grateful for your help.

Le lun. 29 avr. 2024, à 12 h 43, Aaron Hill <lilyp...@hillvisions.com> a
écrit :

> On 2024-04-29 7:50 am, Pierre-Luc Gauthier wrote:
> > Can a markup command introspect its direction ?
> >
> > Is it possible to set in a markup command some conditionals (not paper
> > related) ?
> >
> > \version "2.25.15"
> >
> > #(define-markup-command (conditionalMrkp layout props)
> >    ()
> >    (interpret-markup layout props #{
> >      \markup {
> >        %\if #DOWN
> >        "↑"
> >        %\if #UP
> >        "↓"
> >                      }#}))
> >
> > {b'^\markup \conditionalMrkp b'_\markup \conditionalMrkp}
>
>
> %%%%
> \version "2.24.3"
>
> is-directional =
> #(lambda (layout props)
>    (number? (chain-assoc-get 'direction props #f)))
>
> is-upward =
> #(lambda (layout props)
>    (eq? UP (chain-assoc-get 'direction props #f)))
>
> is-downward =
> #(lambda (layout props)
>    (eq? DOWN (chain-assoc-get 'direction props #f)))
>
> asdf = \markup \circle \overlay {
>    \if \is-upward ↑ \if \is-downward ↓
>    \unless \is-directional \pad-around #0.25 *
> }
>
> \layout { indent = 0 }
> \asdf
> { b'4-\asdf 4_\asdf 2^\asdf }
> %%%%
>
>
> -- Aaron Hill



-- 
*Pierre-Luc Gauthier*

Reply via email to