David Kastrup schrieb:
Marc Hohl <m...@hohlart.de> writes:
Hello list,
after having written mails way too early to this list recently
while overlooking the obvious, I think I stumbled upon a *real*
problem now :-/
Please have a look at the attached file. This is not the real world problem,
but I boiled it down to a nearly minimal example.
Only version 3 is giving the desired output in standard notation,
but ignoring the \override.
What am I doing wrong here?
Thanks in advance!
Marc
\version "2.13.32"
% thanks to Neil for this function
#(define (make-harmonic mus)
(let ((elts (ly:music-property mus 'elements))
(elt (ly:music-property mus 'element)))
(cond
((pair? elts)
(map make-harmonic elts))
((ly:music? elt)
(make-harmonic elt))
((music-is-of-type? mus 'note-event)
(set! (ly:music-property mus 'articulations)
(append
(ly:music-property mus 'articulations)
(list (make-music 'HarmonicEvent))))))
mus))
harmonicTestOne = #(define-music-function (parser location music) (ly:music?)
(let* ((test 2)
(result (/ test 2)))
#{
\override TabNoteHead #'transparent = ##t
#}
(make-harmonic music)
(display "\nDummy output to check the let-block: ")(display result)
#{
\revert TabNoteHead #'transparent
#}))
Hi David,
Uh, #{ #} creates and returns a value. Only the last value in a Scheme
function is the return value of the function.
I thought I had memorized that, but the whole #{ ...#} stuff
confused me.
[...]
Uh, you need $result here, or the global result will be used. Also, a #
expression is evaluated when it is encountered. That may be before the
\override is considered complete.
[...]
You don't return your override as the resulting music function
expression. Expressions in #{ ... #} don't "happen" when encountered.
They "happen" by returning them to the music function caller. So the #{
#} is a do-nothing here.
Thanks for your explanations - if I had a simple scheme-ish
method at hand to do the override and revert, then it would
have been easier for me, I assume. No, probably not. The
return code would have been still the revert ... ;-)
Marc
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user