Hi Orm,

On Wed, Sep 17, 2014 at 7:57 AM, Orm Finnendahl <
orm.finnend...@selma.hfmdk-frankfurt.de> wrote:

> Am Mittwoch, den 17. September 2014 um 07:53:48 Uhr (+0100) schrieb James:
> > Do you have any other suggestions we could improve the documentation
> > with perhaps?
>
> The main problem in this special case for me is the fact, that David's
> code suggests that the first three elements of the prop argument of a
> define-markup-command are alists which contain mutable properties,
> immutable properties and font-defaults (in that order).


Yes, you unknowingly corrected me!  Mutable, immutable, font-defaults is
the correct order.


>
> In addition, I don't know:
>
> 1. Which properties of layout objects are mutable/immutable?
>

Immutable properties are stored for all grobs in the variable
'all-grob-descriptions' in the file scm/define-grobs.scm.  You can obtain
them for a specific type of grob with the function
ly:grob-basic-properties, which takes a grob as argument.

Immutable properties are common to all grobs of a particular type, so
you'll see many properties set to procedures.

Mutable properties hold the results of applying those functions to
individual grobs.  You can read them for a grob with ly:grob-properties.

An override adds a (property . value) pair to the head of the _immutable_
properties alist.  (So, of course, that's exactly what I was doing in the
function earlier in the thread.  The procedure acons would be what I would
have liked to use, since overrides add a new pair, leaving the older
setting of the property intact in the tail of the list--but I couldn't
manage to reset the variable that way.  Don't understand why.)


> 2. Although David's set! instruction to reassign the props symbol
>    makes that improbable: Could there be other elems at the end of the
>    prop list (and which, if there are)?
>

I'm not sure I follow.

If you do this to the function above, you get a result of #t.  (I'm
including the whole with the variable naming fixed.)

\version "2.19.5"

#(define-markup-command (secs layout props numsecs)
   (string?)
   (let* ((mutable (car props))
          (immutable (cadr props))
          (font-defaults (caddr props)))

     (display (equal? props (list mutable immutable font-defaults)))

     (set! immutable (assoc-set! immutable 'self-alignment-X -0.5))
     (set! immutable (assoc-set! immutable 'padding 4))
     (set! props (list mutable immutable font-defaults))

     (interpret-markup layout props
       (markup
        #:fontsize -1
        #:bold numsecs))))

%%%%%%%%%

Hope this is helpful.

--David
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to