lilypond-user
[Top][All Lists]
Advanced

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

Re: Remove given tagged expression from given context


From: Simon Albrecht
Subject: Re: Remove given tagged expression from given context
Date: Wed, 19 Jul 2017 01:47:54 +0200

On 19.07.2017 01:02, Pierre-Luc Gauthier wrote:
Hello there,

I know it may sound silly but :
Is it possible to remove tagged expression from a whole context?
Or does it not make sense at all?

The example below does indeed not make sense, because \removeWithTag and its friends are music functions. You can of course enclose the entire music expression inside a score with \removeWithTag, or you can even trick around with toplevel-music-functions to use it on _all_ the music any following score:

%%%%%%%%%%%%%%%%%%%%%
\version "2.19.64"
musicFunctionDummy = #(define-music-function (mus) (ly:music?) mus)
addToplevelMusicFunctions =
#(define-scheme-function (names) (symbol-list-or-symbol?)
   (let* ((name-list (if (list? names) names (list names)))
(lookup-function (lambda (name) (let ((fn (ly:parser-lookup name)))
                                            (if (equal? fn '())
                                                musicFunctionDummy
                                                fn))))
          (fn-list (map lookup-function name-list)))
(set! toplevel-music-functions (append fn-list toplevel-music-functions))))

removeTagged = \removeWithTag tagged \etc
removeOther = \removeWithTag other \etc

\addToplevelMusicFunctions removeTagged,removeOther

% insert music here ;-)

%%%%%%%%%%%%%%%%%%%%%%

But the first question should be: what are you trying to do?

Best, Simon



MWE :

\version "2.19.64"

\score {
   \relative c' {
     \tag #'tagged \clef alto
     c4 d e f g
   }
   \layout {
     \context {
       \Staff
       %\removeWithTag #'tagged …plox?
     }
   }
}


Thanks




reply via email to

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