[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anybody invested in ly:make-simple-closure?
From: |
David Kastrup |
Subject: |
Re: Anybody invested in ly:make-simple-closure? |
Date: |
Thu, 24 Sep 2015 12:18:08 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Han-Wen Nienhuys <address@hidden> writes:
> IIRC, it was introduced to compose offset callbacks,
Oh, it's still being used for that as far as I can tell. Just not from
Scheme.
> but a quick check doesn't reveal any historical uses.
The last Scheme use of chain-grob-member-functions was likely removed
with
commit 1d9a73b13ee576d28c0f41f5b243f2ebb1ff9fcf
Author: Mike Solomon <address@hidden>
Date: Fri Oct 21 09:03:43 2011 +0200
Implements consistent beam slopes across line breaks.
This is a mostly an internal reorganization of the beam code that
has several concrete impacts on the way beam slopes are calculated:
* ly:beam::calc-least-squares-positions, ly:beam::calc-slope-damping,
and ly:beam::shift-region-to-valid are now all instance methods of
Beam_scoring_problem and thus no longer open to the users.
* by being internal methods, these functions all use the same information
(x positions of stems, stem infos, etc.) stored in private variables.
* this sharing of information allows for broken beams to share information
between their parts, which leads to the consistent slope calculation
Additionally, ly:beam::quanting, which used to take the arguments of
a grob and a pair of positions, now only takes the grob, as it is
the sole generator of positions. All of the functions in layout-beam.scm
that relied on multiple Scheme callbacks being chained now only use this
function.
To turn on this feature, use \override Beam #'consistent-slope = ##t.
and one extract of the diff would be
diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm
index 05ba013..acea431 100644
--- a/scm/define-grobs.scm
+++ b/scm/define-grobs.scm
@@ -383,15 +383,7 @@
(gap . 0.8)
(neutral-direction . ,DOWN)
- (positions . ,(ly:make-simple-closure
- (ly:make-simple-closure
- (list chain-grob-member-functions
- `(,cons 0 0)
- ly:beam::calc-least-squares-positions
- ly:beam::slope-damping
- ly:beam::shift-region-to-valid
- ly:beam::quanting
- ))))
+ (positions . ,ly:beam::quanting)
And I am quite happy that I don't need to replace that code myself any
more.
--
David Kastrup