lilypond-user
[Top][All Lists]
Advanced

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

Re: \override and \revert


From: David Kastrup
Subject: Re: \override and \revert
Date: Sun, 11 Jul 2021 19:11:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Timothy Lanfear <timothy@lanfear.me> writes:

> https://lilypond.org/doc/v2.22/Documentation/extending/intermediate-substitution-functions
> describes \temporary \override and \revert as push/pop pair operating
> on a stack of grob properties so the previous value of the property
> can be recovered. On the other hand, the example of \revert in
> http://lilypond.org/doc/v2.22/Documentation/notation/the-override-command
> does not use \temporary. It does seem that the default value of the
> property is restored if the stack becomes empty. Is it true that the
> default is restored?

No.  Every context has its own property stack.  When it's empty, the
properties of the parent context shine through.  Ultimately, the Global
context may provide some score-wide fallback.  If you revert in the
Global context, the default value is gone.

> Is there any advice on the best way to use \revert?

It is usual to use \override / \revert when your intent is to return to
defaults, mainly to avoid stackup of unreverted overrides.  Inside of
your own music functions intended to temporarily work with some
different property values, you'd use \temporary\override / \revert in
order to leave things as they were before (since then forgetting to
revert is taken care of by the code only being written once).  In that
case the pairing is "automatic" and you cannot really make a mistake
(well, you can when user-provided code does some unbalanced stuff in the
middle, but that aside).

-- 
David Kastrup



reply via email to

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