Re: \unset with modified default properties

2018-07-02 Thread Saul Tobin
Sure, define-music-function works fine. That part I just copied from the
earlier snippet. That's a side issue, though.

On Mon, Jul 2, 2018 at 2:36 PM David Kastrup  wrote:

> Saul Tobin  writes:
>
> > Indeed, or StaffGroup level if I'm following correctly.
>
> And there is a StaffGroup.
>
> > My issue is that I want to change the default keepAliveInterfaces for
> > one staff within a StaffGroup. (Probably should have just posted this
> > as my initial example, I suppose.)
> >
> > \version "2.19.82"
> >
> > targetstaff = #(define-scheme-function (ctx) (string?)
> >  #{
> >  \set Staff.keepAliveInterfaces = #'()
> >  \context Staff = #ctx { \unset Staff.keepAliveInterfaces }
> >  #})
>
> Why not define-music-function?  This seems like asking for trouble
> unnecessarily.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \unset with modified default properties

2018-07-02 Thread David Kastrup
Saul Tobin  writes:

> Indeed, or StaffGroup level if I'm following correctly.

And there is a StaffGroup.

> My issue is that I want to change the default keepAliveInterfaces for
> one staff within a StaffGroup. (Probably should have just posted this
> as my initial example, I suppose.)
>
> \version "2.19.82"
>
> targetstaff = #(define-scheme-function (ctx) (string?)
>  #{
>  \set Staff.keepAliveInterfaces = #'()
>  \context Staff = #ctx { \unset Staff.keepAliveInterfaces }
>  #})

Why not define-music-function?  This seems like asking for trouble
unnecessarily.

-- 
David Kastrup

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


Re: \unset with modified default properties

2018-07-02 Thread Saul Tobin
Indeed, or StaffGroup level if I'm following correctly. My issue is that I
want to change the default keepAliveInterfaces for one staff within a
StaffGroup. (Probably should have just posted this as my initial example, I
suppose.)

\version "2.19.82"

targetstaff = #(define-scheme-function (ctx) (string?)
 #{
 \set Staff.keepAliveInterfaces = #'()
 \context Staff = #ctx { \unset Staff.keepAliveInterfaces }
 #})

music = {
  \targetstaff "2"
  c'1 d' e' d'
  \break
  \targetstaff "1"
  R1*4
}

\new StaffGroup <<
  \new Staff = "1" \with {
\override VerticalAxisGroup.remove-empty = ##t
\override VerticalAxisGroup.remove-first = ##t
instrumentName = "1"
shortInstrumentName = "1"
  } \music
  \new Staff = "2" \with {
\override VerticalAxisGroup.remove-empty = ##t
\override VerticalAxisGroup.remove-first = ##f
instrumentName = "2"
shortInstrumentName = "2"
keepAliveInterfaces = #'(
  bass-figure-interface
  chord-name-interface
  cluster-beacon-interface
  fret-diagram-interface
  lyric-syllable-interface
  note-head-interface
  tab-note-head-interface
  lyric-interface
  percent-repeat-item-interface
  percent-repeat-interface
  ;; need this, as stanza numbers are items,
and appear only once.
  stanza-number-interface
  ;; all the normal stuff ^
  ;; new stuff v
  multi-measure-rest-interface
  )
  } \music
>>

This is adapted from a snippet posted a while ago on the mailing list:
https://www.mail-archive.com/lilypond-user@gnu.org/msg125650.html.

Does this clarify what I'm trying to do with \unset?

Thanks!

Saul

On Mon, Jul 2, 2018 at 12:24 AM David Kastrup  wrote:

> Saul Tobin  writes:
>
> > Interesting. So if the default property is set at the Staff level, for
> > instance, then changed and \unset at the Voice level, it goes back to the
> > default for the higher-level context. But if in the example \new Staff
> > \with... is changed to \new Voice \with... the original problem arises
> > where \unset reverts to the built-in default.
> >
> > Didn't realize about the \tuplet syntax. That's quite useful. Thanks for
> > the tip!
> >
> > Actually, I just used tupletSpannerDuration because it was convenient to
> > write a tiny example. My practical use case is changing the default
> > keepAliveInterfaces for certain staves.
>
> Ah, that is read at Staff level.  You could set your score-wide default
> at, well, Score level then.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \unset with modified default properties

2018-07-02 Thread David Kastrup
Saul Tobin  writes:

> Interesting. So if the default property is set at the Staff level, for
> instance, then changed and \unset at the Voice level, it goes back to the
> default for the higher-level context. But if in the example \new Staff
> \with... is changed to \new Voice \with... the original problem arises
> where \unset reverts to the built-in default.
>
> Didn't realize about the \tuplet syntax. That's quite useful. Thanks for
> the tip!
>
> Actually, I just used tupletSpannerDuration because it was convenient to
> write a tiny example. My practical use case is changing the default
> keepAliveInterfaces for certain staves.

Ah, that is read at Staff level.  You could set your score-wide default
at, well, Score level then.

-- 
David Kastrup

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


Re: \unset with modified default properties

2018-07-01 Thread Saul Tobin
Interesting. So if the default property is set at the Staff level, for
instance, then changed and \unset at the Voice level, it goes back to the
default for the higher-level context. But if in the example \new Staff
\with... is changed to \new Voice \with... the original problem arises
where \unset reverts to the built-in default.

Didn't realize about the \tuplet syntax. That's quite useful. Thanks for
the tip!

Actually, I just used tupletSpannerDuration because it was convenient to
write a tiny example. My practical use case is changing the default
keepAliveInterfaces for certain staves.

On Sun, Jul 1, 2018 at 1:00 AM David Kastrup  wrote:

> Saul Tobin  writes:
>
> > In both 2.18 and 2.19, \unset appears to set a context property to the
> > built-in default, rather than the default set in the \with {} block:
> >
> > music = \relative c' {
> >   \tuplet 3/2 {
> > c8 c c d d d e e e f f f |
> >   }
> >   \set Staff.tupletSpannerDuration = #(ly:make-moment 1/2)
> >   \tuplet 3/2 {
> > c8 c c d d d e e e f f f |
> >   }
> >   \unset Staff.tupletSpannerDuration
> >   \tuplet 3/2 {
> > c8 c c d d d e e e f f f |
> >   }
> > }
> >
> > \new Staff \with {
> >   tupletSpannerDuration = #(ly:make-moment 1/4)
> > } \music
> >
> > In cases like this, I would find it useful to reset the property to the
> > custom default value without having to explicitly \set it every time. Is
> > there a way to do this? Also, is this the most useful behavior of \unset?
>
> There are several approaches.  The tupletSpannerDuration is actually
> interpreted at Voice level, so if you set/unset the Voice level value,
> it remains dominant while set and can be unset nicely:
>
> music = \relative c' {
>   \tuplet 3/2 {
> c8 c c d d d e e e f f f |
>   }
>   \set tupletSpannerDuration = #(ly:make-moment 1/2)
>   \tuplet 3/2 {
> c8 c c d d d e e e f f f |
>   }
>   \unset tupletSpannerDuration
>   \tuplet 3/2 {
> c8 c c d d d e e e f f f |
>   }
> }
>
> \new Staff \with {
>   tupletSpannerDuration = #(ly:make-moment 1/4)
> } \music
>
> But of course for this functionality in particular, use the optional
> tuplet spanner duration argument to the \tuplet music function:
>
> music = \relative c' {
>   \tuplet 3/2 {
> c8 c c d d d e e e f f f |
>   }
>   \tuplet 3/2 2 {
> c8 c c d d d e e e f f f |
>   }
>   \tuplet 3/2 {
> c8 c c d d d e e e f f f |
>   }
> }
>
> \new Staff \with {
>   tupletSpannerDuration = #(ly:make-moment 1/4)
> } \music
>
> In fact, I'd lean towards using it always and not even bother setting
> tupletSpannerDuration at all.  So basically:
>
> music = \relative c' {
>   \tuplet 3/2 4 {
> c8 c c d d d e e e f f f |
>   }
>   \tuplet 3/2 2 {
> c8 c c d d d e e e f f f |
>   }
>   \tuplet 3/2 4 {
> c8 c c d d d e e e f f f |
>   }
> }
>
> \music
>
> It's minimal writing effort and keeps the information where it belongs.
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \unset with modified default properties

2018-07-01 Thread David Kastrup
Saul Tobin  writes:

> In both 2.18 and 2.19, \unset appears to set a context property to the
> built-in default, rather than the default set in the \with {} block:
>
> music = \relative c' {
>   \tuplet 3/2 {
> c8 c c d d d e e e f f f |
>   }
>   \set Staff.tupletSpannerDuration = #(ly:make-moment 1/2)
>   \tuplet 3/2 {
> c8 c c d d d e e e f f f |
>   }
>   \unset Staff.tupletSpannerDuration
>   \tuplet 3/2 {
> c8 c c d d d e e e f f f |
>   }
> }
>
> \new Staff \with {
>   tupletSpannerDuration = #(ly:make-moment 1/4)
> } \music
>
> In cases like this, I would find it useful to reset the property to the
> custom default value without having to explicitly \set it every time. Is
> there a way to do this? Also, is this the most useful behavior of \unset?

There are several approaches.  The tupletSpannerDuration is actually
interpreted at Voice level, so if you set/unset the Voice level value,
it remains dominant while set and can be unset nicely:

music = \relative c' {
  \tuplet 3/2 {
c8 c c d d d e e e f f f |
  }
  \set tupletSpannerDuration = #(ly:make-moment 1/2)
  \tuplet 3/2 {
c8 c c d d d e e e f f f |
  }
  \unset tupletSpannerDuration
  \tuplet 3/2 {
c8 c c d d d e e e f f f |
  }
}

\new Staff \with {
  tupletSpannerDuration = #(ly:make-moment 1/4)
} \music

But of course for this functionality in particular, use the optional
tuplet spanner duration argument to the \tuplet music function:

music = \relative c' {
  \tuplet 3/2 {
c8 c c d d d e e e f f f |
  }
  \tuplet 3/2 2 {
c8 c c d d d e e e f f f |
  }
  \tuplet 3/2 {
c8 c c d d d e e e f f f |
  }
}

\new Staff \with {
  tupletSpannerDuration = #(ly:make-moment 1/4)
} \music

In fact, I'd lean towards using it always and not even bother setting
tupletSpannerDuration at all.  So basically:

music = \relative c' {
  \tuplet 3/2 4 {
c8 c c d d d e e e f f f |
  }
  \tuplet 3/2 2 {
c8 c c d d d e e e f f f |
  }
  \tuplet 3/2 4 {
c8 c c d d d e e e f f f |
  }
}

\music

It's minimal writing effort and keeps the information where it belongs.

-- 
David Kastrup

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


Re: \unset with modified default properties

2018-06-30 Thread Saul Tobin
Unfortunately, for my use case, \once\set and \once\unset aren't enough.

On Sat, Jun 30, 2018 at 8:31 PM Aaron Hill  wrote:

> On 2018-06-30 17:50, Saul Tobin wrote:
> > In both 2.18 and 2.19, \unset appears to set a context property to the
> > built-in default, rather than the default set in the \with {} block:
> >
> > [ . . . ]
> >
> > In cases like this, I would find it useful to reset the property to the
> > custom default value without having to explicitly \set it every time.
> > Is
> > there a way to do this? Also, is this the most useful behavior of
> > \unset?
>
> While not a completely general solution, you may be able to use \once:
>
> 
>music = \relative c' {
>  \tuplet 3/2 {
>c8 c c d d d e e e f f f |
>  }
>  \once \set Staff.tupletSpannerDuration = #(ly:make-moment 1/2)
>  \tuplet 3/2 {
>c8 c c d d d e e e f f f |
>  }
>  \tuplet 3/2 {
>c8 c c d d d e e e f f f |
>  }
>}
> 
>
> -- Aaron Hill
>
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: \unset with modified default properties

2018-06-30 Thread Aaron Hill

On 2018-06-30 17:50, Saul Tobin wrote:

In both 2.18 and 2.19, \unset appears to set a context property to the
built-in default, rather than the default set in the \with {} block:

[ . . . ]

In cases like this, I would find it useful to reset the property to the
custom default value without having to explicitly \set it every time. 
Is
there a way to do this? Also, is this the most useful behavior of 
\unset?


While not a completely general solution, you may be able to use \once:


  music = \relative c' {
\tuplet 3/2 {
  c8 c c d d d e e e f f f |
}
\once \set Staff.tupletSpannerDuration = #(ly:make-moment 1/2)
\tuplet 3/2 {
  c8 c c d d d e e e f f f |
}
\tuplet 3/2 {
  c8 c c d d d e e e f f f |
}
  }


-- Aaron Hill

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


\unset with modified default properties

2018-06-30 Thread Saul Tobin
In both 2.18 and 2.19, \unset appears to set a context property to the
built-in default, rather than the default set in the \with {} block:

music = \relative c' {
  \tuplet 3/2 {
c8 c c d d d e e e f f f |
  }
  \set Staff.tupletSpannerDuration = #(ly:make-moment 1/2)
  \tuplet 3/2 {
c8 c c d d d e e e f f f |
  }
  \unset Staff.tupletSpannerDuration
  \tuplet 3/2 {
c8 c c d d d e e e f f f |
  }
}

\new Staff \with {
  tupletSpannerDuration = #(ly:make-moment 1/4)
} \music

In cases like this, I would find it useful to reset the property to the
custom default value without having to explicitly \set it every time. Is
there a way to do this? Also, is this the most useful behavior of \unset?

Saul
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user