Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Status: Accepted Owner: Labels: Type-Defect New issue 2376 by pkx1...@gmail.com: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 Nicolas Sceaux writes: Hi, Using today's git LilyPond, the following snippet gives weird results: the footnote is printed several times in header and footer, and on several pages. \version "2.15.32" % Also occurs in 2.15.27 according to Keith (James) \paper { oddHeaderMarkup = \markup\null evenHeaderMarkup = \markup\null oddFooterMarkup = \markup\null evenFooterMarkup = \markup\null } { \footnote #'(0 . -1) #'NoteHead "a footnote" c'1 \pageBreak c'1 } When using e.g. "" instead of \markup\null then everthing seems fine. David Kastrup then writes: Automatic footnotes set the footnote mark to the null markup. It would appear that the null markup (or its stencil?) itself then gets _overwritten_ with the actual footnote mark, making it appear in several places. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Labels: Patch-new Comment #1 on issue 2376 by mts...@gmail.com: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376#c1 Makes empty stencil and point stencil functions http://codereview.appspot.com/5726053 ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #2 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 Too invasive for my taste. There is nothing wrong with having a single null stencil and/or empty stencil. What is wrong is when programs try to change them. If that is a serious concern for some reason, one can make them readonly or copy-on-write. We use techniques for that (mutable and immutable parts of properties, for example) elsewhere. It would even do to just set a flag on those that the writing routine balks at. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #3 on issue 2376 by mts...@gmail.com: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 You're right that it's invasive, but that doesn't bother me, as I think the change is more coherent w/ how LilyPond handles stencils in general. If the empty stencil can be somehow made copy-on-write. that'd be great. I'm not sure how to do that w/ Scheme objects, thus the change proposed in this patch. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #4 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 I have no clue how stencils are represented internally. And while one may have mixed feelings about point-stencil, something like the null-stencil is a basic building block like '() or "" or other null constants. If you can't start from that without repercussions, that's quite counterintuitive. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #5 on issue 2376 by mts...@gmail.com: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 This code matches up with how stencils are represented internally and how the code uses then in general. One could, for example, use the same stencil for every single whole note. However, a function is called that returns copies of this stencil. In general, stencils are always created from scratch. I don't entirely follow what you're saying as it seems like it is getting into issues of program design that are out of my league, but given how LilyPond works and what people's expectations of things are, having "empty-stencil" be a function that returns an empty-stencil seems to make more sense than using the same stencil every time (for the same reason as the whole-note example given above). ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #6 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 A whole note stencil has properties. A non-empty list has elements, a non-empty string has characters. Those can be changed and overwritten. For that reason, you need to create copies before you modify something like '(a) or "a", or things may go wrong. But you don't need to create copies before working with '() or "" since there is nothing that could be modified here. They are self-contained. It would be nice if we had an elemental entity satisfying ly:stencil? that had the same property of being a basic extensible building block without repercussions on the original. There will be lots of situations where one will want to pass a typed equivalent of "nothing", and it is a nuisance if "nothing" needs to get allocated anew every time and is not eq? to "nothing". ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #7 on issue 2376 by mts...@gmail.com: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 « There will be lots of situations where one will want to pass a typed equivalent of "nothing", and it is a nuisance if "nothing" needs to get allocated anew every time and is not eq? to "nothing". » But this why we use s.s_empty () to check for nothing and not s == EMPTY_STENCIL or scm_eqv (s.smobbed_copy (), EMPTY_STENCIL.smobbed_copy ()). What you're talking about is a major architecture change. The first note in stencil.hh is: * Because of the way that Stencil is implemented, it is the most efficient to add "fresh" stencils to what you're going to build. The entire stencil architecture revolves around this principle. I think it's important to fix this issue using the current architecture (meaning adding "fresh" stencils, as the header file suggests). If you want to change it from the ground up, then a new issue can be opened to explore that, but I think that should be separate from this issue. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Labels: Patch-review Comment #8 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376#c8 Patchy the autobot says: LGTM. But I don't like all that performance hit just because footnotes are missing a copy-stencil call. Would you be ok with constant stencils if one had a way to mark them readonly and/or copy-on-write? Which of the two would you prefer? ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #9 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 I've taken a look at the Scheme functions for stencils, and they basically _all_ create copies whenever they operate on a stencil. It appears that stencils are simple smobs (you don't work with self_scm () but rather smobbed_copy). So it does not really make sense to have constants like the null and the empty stencil be functions: all of the Scheme-level accessors create their own copies. If the footnote code does not do this (and presumably it uses C++ for wreaking its havoc), that is the fault of the footnote code for not keeping with the design principles of stencils. We should fix it there instead of causing unnecessary pain everywhere else. It does not appear to me like stencils are intended to be modifiable objects in the first place. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #10 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 To quote from stencil.hh: * Do not create Stencil objects on the heap. That includes passing around Stencil* which are produced by unsmob_stencil(). Either copy Stencil objects, or use SCM references. It turns out that unsmob_stencil objects _are_ at several places in the LilyPond source (mostly in the page layout stuff) modified instead of copied. This is not intended usage. As simple smobs, they are intended to be entities like numbers: if you want to add to them, create a copy. Your patch tries to change that design. I don't consider that the correct fix. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Owner: mts...@gmail.com Labels: -Patch-review Patch-needs_work Comment #11 on issue 2376 by colinpkc...@gmail.com: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 There seems to be quite divergent views on this one, so it should be set to "needs-work". ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #12 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 There is little enough reason to diverge, actually. page-layout-problem.cc is a total mess indiscriminately passing around pointers to Stencil and modifying them. As a result, there are not even enough physical Stencil objects to pass around for all the supposedly independent operations happening on them. I am currently cleaning this up as a diversion from the note collision programming. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Labels: Patch-new Comment #13 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376#c13 Issue 2376: Automatic footnotes on \null markups causes unexpected results The page layout routines passed around pointers to stencils rather indiscriminately and worked on them rather than on stencil copies. Sort of copy-on-write without the copy. This tries working on actual copies where appropriate. http://codereview.appspot.com/5755058 ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Labels: Patch-review Comment #14 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376#c14 Patchy the autobot says: LGTM. 3 lines add whitespace errors, but I trust you will fix this before committing. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #15 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 Issue 2369 has been merged into this issue. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Labels: Patch-new Comment #16 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376#c16 Issue 2376: Automatic footnotes on \null markups causes unexpected results The page layout routines passed around pointers to stencils rather indiscriminately and worked on them rather than on stencil copies. Sort of copy-on-write without the copy. This tries working on actual copies where appropriate. http://codereview.appspot.com/5755058 ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Labels: Patch-review Comment #17 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376#c17 Patchy the autobot says: LGTM. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Labels: -Patch-countdown Patch-push Comment #19 on issue 2376 by colinpkc...@gmail.com: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 Counted down to 20120311, please push. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Status: Fixed Owner: d...@gnu.org Labels: -Patch-push Fixed_2_15_34 Comment #20 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 Pushed as b0a0b0da364a2379e3a26a0cd6af87fece1594fb to staging. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Updates: Status: Verified Comment #21 on issue 2376 by elu...@gmail.com: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 (No comment was entered for this change.) ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #22 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 Issue 1788 has been merged into this issue. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Issue 2376 in lilypond: Automatic footnotes on \null markups causes unexpected results
Comment #23 on issue 2376 by d...@gnu.org: Automatic footnotes on \null markups causes unexpected results http://code.google.com/p/lilypond/issues/detail?id=2376 Issue 1559 has been merged into this issue. ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond