summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kastrup <dak@gnu.org>2015-02-19 13:37:37 +0100
committerDavid Kastrup <dak@gnu.org>2015-03-03 23:38:55 +0100
commit5acdb37da47bf85c010e072b6e0dcdd1dfaf9c1f (patch)
tree82ec5aada7de379858b503ac32d786a3a06c3ac6
parent30773c8a2cca86f5f4a6d3c4e0ba4359e5d05f91 (diff)
Issue 4296: Let \displayLilyMusic print even repeated durations
\displayLilyMusic { c4 c c c } now produces { c4 c4 c4 c4 } in order to better match the content of the music rather than the shortest possible input representation.
-rw-r--r--Documentation/changes.tely9
-rw-r--r--Documentation/extending/scheme-tutorial.itely2
-rw-r--r--Documentation/notation/input.itely2
-rw-r--r--input/regression/display-lily-tests.ly172
-rw-r--r--scm/define-music-display-methods.scm57
-rw-r--r--scm/display-lily.scm15
-rw-r--r--scm/music-functions.scm3
7 files changed, 127 insertions, 133 deletions
diff --git a/Documentation/changes.tely b/Documentation/changes.tely
index a90f386485..46675428be 100644
--- a/Documentation/changes.tely
+++ b/Documentation/changes.tely
@@ -518,6 +518,15 @@ examples where this makes for readable input:
@end lilypond
@item
+@code{\displayLilyMusic} and its underlying Scheme functions no
+longer omit redundant note durations. This makes it easier to
+reliably recognize and format standalone durations in expressions
+like
+@example
+@{ c4 d4 8 @}
+@end example
+
+@item
Beaming exceptions can now be constructed using the
@code{\beamExceptions} scheme function. One can now write
diff --git a/Documentation/extending/scheme-tutorial.itely b/Documentation/extending/scheme-tutorial.itely
index fc2eba1c6d..a399570dec 100644
--- a/Documentation/extending/scheme-tutorial.itely
+++ b/Documentation/extending/scheme-tutorial.itely
@@ -1264,7 +1264,7 @@ The note pitch can be changed by setting this @code{'pitch} property,
(ly:make-pitch 0 1 0)) ;; set the pitch to d'.
\displayLilyMusic \someNote
===>
-d'
+d'4
@end example
diff --git a/Documentation/notation/input.itely b/Documentation/notation/input.itely
index 8cede953f0..ad827e0e36 100644
--- a/Documentation/notation/input.itely
+++ b/Documentation/notation/input.itely
@@ -3413,7 +3413,7 @@ line. For example,
will display
@example
-@{ a,4 cis e fis g @}
+@{ a,4 cis4 e4 fis4 g4 @}
@end example
By default, LilyPond will print these messages to the console
diff --git a/input/regression/display-lily-tests.ly b/input/regression/display-lily-tests.ly
index b14fa52090..cbbebd6539 100644
--- a/input/regression/display-lily-tests.ly
+++ b/input/regression/display-lily-tests.ly
@@ -48,24 +48,24 @@ stderr of this run."
}
%% Sequential music
-\test ##[ { { a b } { c d } } #] % SequentialMusic
-\test ##[ << { a b } { c d } >> #] % SimultaneousMusic
-\test ##[ << { a b } \\ { c d } >> #] % VoiceSeparator
+\test ##[ { { a4 b4 } { c4 d4 } } #] % SequentialMusic
+\test ##[ << { a4 b4 } { c4 d4 } >> #] % SimultaneousMusic
+\test ##[ << { a4 b4 } \\ { c4 d4 } >> #] % VoiceSeparator
%% Chords and Notes
-\test ##[ { ceses ces c cis cisis } #] % NoteEvent
-\test ##[ { deses des d dis disis } #]
-\test ##[ { eeses ees e eis eisis } #]
-\test ##[ { feses fes f fis fisis } #]
-\test ##[ { geses ges g gis gisis } #]
-\test ##[ { aeses aes a ais aisis } #]
-\test ##[ { beses bes b bis bisis } #]
-\test ##[ { c,, d' } #]
-\test ##[ { c' d'=' } #]
-\test ##[ { c! c? } #]
+\test ##[ { ceses4 ces4 c4 cis4 cisis4 } #] % NoteEvent
+\test ##[ { deses4 des4 d4 dis4 disis4 } #]
+\test ##[ { eeses4 ees4 e4 eis4 eisis4 } #]
+\test ##[ { feses4 fes4 f4 fis4 fisis4 } #]
+\test ##[ { geses4 ges4 g4 gis4 gisis4 } #]
+\test ##[ { aeses4 aes4 a4 ais4 aisis4 } #]
+\test ##[ { beses4 bes4 b4 bis4 bisis4 } #]
+\test ##[ { c,,4 d'4 } #]
+\test ##[ { c'4 d'='4 } #]
+\test ##[ { c!4 c?4 } #]
\test ##[ r1.*4/3 #] % RestEvent
\test ##[ c1\rest #] % RestEvent
-\test ##[ s2..*3/4 #] % SkipEvent
+\test ##[ s2..*3/4 #] % SkipEvent
\test ##[ R1.*2/3 #] % MultiMeasureRestMusicGroup, MultiMeasureRestEvent
\test ##[ \skip 2.*3/4 #] % SkipMusic
\test ##[ < c\1 e\3 >4.*3/4-. #] % EventChord, NoteEvent, StringNumberEvent, ArticulationEvent
@@ -73,22 +73,22 @@ stderr of this run."
\test ##[ { < c e g c' >4 q8-. } #] % RepeatedChord
%% tags
-\test ##[ { \tag #'foo { c4 d } } #]
-\test ##[ c-\tag #'foo -\tag #'baz -^-. #]
+\test ##[ { \tag #'foo { c4 d4 } } #]
+\test ##[ c4-\tag #'foo -\tag #'baz -^-. #]
%% Graces
\test ##[ { \grace c8 d2 } #] % GraceMusic
\test ##[ { \appoggiatura c8 d2 } #]
\test ##[ { \acciaccatura c8 d2 } #]
-\test ##[ { c1 \afterGrace { b,16 c } d2 } #]
+\test ##[ { c1 \afterGrace { b,16 c16 } d2 } #]
%% Clusters
-\test ##[ { \makeClusters { c4 g } } #] % ClusterNoteEvent
+\test ##[ { \makeClusters { c4 g4 } } #] % ClusterNoteEvent
%% Figured bass
-\test ##[ \figures { < 6 > } #] % BassFigureEvent
-\test ##[ \figuremode { < 1-- 3- > < 2+ 4++ > < _! 7! > } #]
-\test ##[ \figuremode { < [6 > < 5] > } #]
+\test ##[ \figures { < 6 >4 } #] % BassFigureEvent
+\test ##[ \figuremode { < 1-- 3- >4 < 2+ 4++ >4 < _! 7! >4 } #]
+\test ##[ \figuremode { < [6 >4 < 5] >4 } #]
%% Lyrics
\test ##[ \lyrics { a b } #]
@@ -96,53 +96,53 @@ stderr of this run."
\test ##[ \lyricmode { a __ b } #] % ExtenderEvent
\test ##[ \lyricmode { "a " } #] % LyricEvent
\test ##[ \lyricsto "foo" { bla bla } #] % LyricCombineMusic
-\test ##[ { { c d }
+\test ##[ { { c4 d4 }
\addlyrics { bla bla } } #]
%% Drums
-\test ##[ \drums { hihat } #]
+\test ##[ \drums { hihat4 } #]
\test ##[ \drummode { hihat4.*3/4 } #]
%% Expressive marks
\test ##[ c4 ~ #] % TieEvent
-\test ##[ c\noBeam #] % BeamForbidEvent
-\test ##[ c\1 #] % StringNumberEvent
-\test ##[ { c:8 c:1 } #] % TremoloEvent
-\test ##[ { c-^ c^^ c_^ } #] % ArticulationEvent
-\test ##[ { c-+ c^+ c_+ } #]
-\test ##[ { c-- c^- c_- } #]
-\test ##[ { c-! c^! c_! } #]
-\test ##[ { c-> c^> c_> } #]
-\test ##[ { c-. c^. c_. } #]
-\test ##[ { c-_ c^_ c__ } #]
-\test ##[ { c\trill c^\trill c_\trill } #]
-\test ##[ { c-1 c^2 c_3 } #] % FingerEvent
-\test ##[ { c-"foo" c^"foo" c_"foo" } #] % TextScriptEvent
-\test ##[ { R1*4-"foo" R^"foo" R_"foo" } #] % MultiMeasureTextEvent
-\test ##[ { < c\harmonic >4 < c e\harmonic > } #] % HarmonicEvent
-\test ##[ { c\glissando c^\glissando c_\glissando } #] % GlissandoEvent
-\test ##[ { c\arpeggio c^\arpeggio c_\arpeggio } #] % ArpeggioEvent
-\test ##[ { c\p c^\ff c_\sfz } #] % AbsoluteDynamicEvent
-\test ##[ { c[ c] c^[ c^] c_[ c_] } #] % BeamEvent
-\test ##[ { c( c) c^( c^) c_( c_) } #] % SlurEvent
-\test ##[ { c\< c\! c^\< c^\! c_\< c_\! } #] % CrescendoEvent
-\test ##[ { c\> c\! c^\> c^\! c_\> c_\! } #] % DecrescendoEvent
-\test ##[ { c\episemInitium c\episemFinis } #] % EpisemaEvent
-\test ##[ { c\( c\) c^\( c^\) c_\( c_\) } #] % PhrasingSlurEvent
-\test ##[ { c\sustainOn c\sustainOff } #] % SustainEvent
-\test ##[ { c\sostenutoOn c\sostenutoOff } #] % SostenutoEvent
+\test ##[ c4\noBeam #] % BeamForbidEvent
+\test ##[ c4\1 #] % StringNumberEvent
+\test ##[ { c4:8 c4:1 } #] % TremoloEvent
+\test ##[ { c4-^ c4^^ c4_^ } #] % ArticulationEvent
+\test ##[ { c4-+ c4^+ c4_+ } #]
+\test ##[ { c4-- c4^- c4_- } #]
+\test ##[ { c4-! c4^! c4_! } #]
+\test ##[ { c4-> c4^> c4_> } #]
+\test ##[ { c4-. c4^. c4_. } #]
+\test ##[ { c4-_ c4^_ c4__ } #]
+\test ##[ { c4\trill c4^\trill c4_\trill } #]
+\test ##[ { c4-1 c4^2 c4_3 } #] % FingerEvent
+\test ##[ { c4-"foo" c4^"foo" c4_"foo" } #] % TextScriptEvent
+\test ##[ { R1*4-"foo" R1*4^"foo" R1*4_"foo" } #] % MultiMeasureTextEvent
+\test ##[ { < c\harmonic >4 < c e\harmonic >4 } #] % HarmonicEvent
+\test ##[ { c4\glissando c4^\glissando c4_\glissando } #] % GlissandoEvent
+\test ##[ { c4\arpeggio c4^\arpeggio c4_\arpeggio } #] % ArpeggioEvent
+\test ##[ { c4\p c4^\ff c4_\sfz } #] % AbsoluteDynamicEvent
+\test ##[ { c4[ c4] c4^[ c4^] c4_[ c4_] } #] % BeamEvent
+\test ##[ { c4( c4) c4^( c4^) c4_( c4_) } #] % SlurEvent
+\test ##[ { c4\< c4\! c4^\< c4^\! c4_\< c4_\! } #] % CrescendoEvent
+\test ##[ { c4\> c4\! c4^\> c4^\! c4_\> c4_\! } #] % DecrescendoEvent
+\test ##[ { c4\episemInitium c4\episemFinis } #] % EpisemaEvent
+\test ##[ { c4\( c4\) c4^\( c4^\) c4_\( c4_\) } #] % PhrasingSlurEvent
+\test ##[ { c4\sustainOn c4\sustainOff } #] % SustainEvent
+\test ##[ { c4\sostenutoOn c4\sostenutoOff } #] % SostenutoEvent
\test ##[ \melisma #]
\test ##[ \melismaEnd #]
-\test ##[ { c\startTextSpan c\stopTextSpan } #] % TextSpanEvent
-\test ##[ { c\startTrillSpan c\stopTrillSpan } #] % TrillSpanEvent
-\test ##[ { c \startStaff c \stopStaff } #] % StaffSpanEvent
-\test ##[ { c\startGroup c\stopGroup c^\startGroup c^\stopGroup c_\startGroup c_\stopGroup } #] % NoteGroupingEvent
-\test ##[ { c\unaCorda c\treCorde } #] % UnaCordaEvent
+\test ##[ { c4\startTextSpan c4\stopTextSpan } #] % TextSpanEvent
+\test ##[ { c4\startTrillSpan c4\stopTrillSpan } #] % TrillSpanEvent
+\test ##[ { c4 \startStaff c4 \stopStaff } #] % StaffSpanEvent
+\test ##[ { c4\startGroup c4\stopGroup c4^\startGroup c4^\stopGroup c4_\startGroup c4_\stopGroup } #] % NoteGroupingEvent
+\test ##[ { c4\unaCorda c4\treCorde } #] % UnaCordaEvent
\test ##[ \breathe #]
-\test ##[ { c \[ c \] } #] % LigatureEvent
+\test ##[ { c4 \[ c4 \] } #] % LigatureEvent
\test ##[ \~ #] % PesOrFlexaEvent
-\test ##[ c\bendAfter #3 #] % BendAfterEvent
-\test ##[ c\rightHandFinger #1 #] % StrokeFingerEvent
+\test ##[ c4\bendAfter #3 #] % BendAfterEvent
+\test ##[ c4\rightHandFinger #1 #] % StrokeFingerEvent
\test ##[ \break #]
\test ##[ \noBreak #]
@@ -176,41 +176,41 @@ stderr of this run."
\test ##[ \bar "|." #]
%% staff switches
-\test ##[ \autochange { c d } #] % AutoChangeMusic
-\test ##[ { \change Staff = "up" { c d } } #] % ContextChange
+\test ##[ \autochange { c4 d4 } #] % AutoChangeMusic
+\test ##[ { \change Staff = "up" { c4 d4 } } #] % ContextChange
%% Tuplets
-\test ##[ \tuplet 3/2 { c8 d e } #] % TimeScaledMusic
-\test ##[ \tuplet 6/4 { c16 d e f g a } #]
-\test ##[ \tuplet 3/2 { c4 d e \tuplet 5/2 { f4 e d2 d4 } c4 } #]
-\test ##[ \tuplet 3/2 2 { c4 d e \tuplet 5/2 2 { f4 e d2 d4 } c4 } #]
+\test ##[ \tuplet 3/2 { c8 d8 e8 } #] % TimeScaledMusic
+\test ##[ \tuplet 6/4 { c16 d16 e16 f16 g16 a16 } #]
+\test ##[ \tuplet 3/2 { c4 d4 e4 \tuplet 5/2 { f4 e4 d2 d4 } c4 } #]
+\test ##[ \tuplet 3/2 2 { c4 d4 e4 \tuplet 5/2 2 { f4 e4 d2 d4 } c4 } #]
%% pure rhythm
\test ##[ { 4 4 8 \tuplet 3/2 { 8[ 16] } 16 } #]
%% \relative and \tranpose
-\test #"NOT A BUG" ##[ \relative c' { c b } #] % RelativeOctaveMusic
-\test #"NOT A BUG" ##[ \transpose c d { c d } #] % TransposedMusic
+\test #"NOT A BUG" ##[ \relative c' { c4 b4 } #] % RelativeOctaveMusic
+\test #"NOT A BUG" ##[ \transpose c d { c4 d4 } #] % TransposedMusic
%% Repeats
-\test ##[ \repeat volta 2 { c d } #] % VoltaRepeatedMusic
-\test ##[ \repeat unfold 2 { c d } #] % UnfoldedRepeatedMusic
-\test ##[ \repeat percent 2 { c d } #] % PercentRepeatedMusic
-\test ##[ \repeat tremolo 4 { c16 d } #] % TremoloRepeatedMusic
-\test ##[ \repeat tremolo 7 { c''32 b' } #]
-\test ##[ \repeat tremolo 15 { c''16 b' } #]
-\test ##[ \repeat volta 2 { c4 d } \alternative { { c d } { e f } } #] %
+\test ##[ \repeat volta 2 { c4 d4 } #] % VoltaRepeatedMusic
+\test ##[ \repeat unfold 2 { c4 d4 } #] % UnfoldedRepeatedMusic
+\test ##[ \repeat percent 2 { c4 d4 } #] % PercentRepeatedMusic
+\test ##[ \repeat tremolo 4 { c16 d16 } #] % TremoloRepeatedMusic
+\test ##[ \repeat tremolo 7 { c''32 b'32 } #]
+\test ##[ \repeat tremolo 15 { c''16 b'16 } #]
+\test ##[ \repeat volta 2 { c4 d4 } \alternative { { c4 d4 } { e4 f4 } } #] %
%% Context creation
-\test ##[ \new Staff { c d } #] % ContextSpeccedMusic
-\test ##[ \new Staff = "up" { c d } #] % ContextSpeccedMusic
-\test ##[ \context Staff { c d } #]
-\test ##[ \context Staff = "up" { c d } #]
+\test ##[ \new Staff { c4 d4 } #] % ContextSpeccedMusic
+\test ##[ \new Staff = "up" { c4 d4 } #] % ContextSpeccedMusic
+\test ##[ \context Staff { c4 d4 } #]
+\test ##[ \context Staff = "up" { c4 d4 } #]
\test ##[
\new Staff \with {
\consists "Timing_engraver"
\remove "Clef_engraver"
-} { c d } #]
+} { c4 d4 } #]
%% Context properties
\test ##[ \once \set Score . skipBars = ##t #] % PropertySet
\test ##[ \set autoBeaming = ##f #]
@@ -236,22 +236,22 @@ stderr of this run."
\test ##[ \partial 4*2/3 #]
%% \partcombine
-\test ##[ \partcombine { c e }
-{ d f } #] % PartCombineMusic UnrelativableMusic
+\test ##[ \partcombine { c4 e4 }
+{ d4 f4 } #] % PartCombineMusic UnrelativableMusic
%% Cue notes
-\test ##[ \cueDuring #"foo" #1 { c d } #]
-\test ##[ \quoteDuring #"foo" { c d } #]
+\test ##[ \cueDuring #"foo" #1 { c4 d4 } #]
+\test ##[ \quoteDuring #"foo" { c4 d4 } #]
%% \ottava
\test ##[ \ottava #1 #] % OttavaMusic
%% \tweak
-\test ##[ < \tweak duration-log #2 c > #]
-\test ##[ < c \tweak transparent ##t e > #]
-\test ##[ < \tweak color #'(1.0 0.0 0.0) \tweak duration-log #2 c > #]
-\test ##[ c-\tweak font-size #3 -> #]
-\test ##[ < \tweak Accidental.color #'(1.0 0.0 0.0) cis eis g > #]
+\test ##[ < \tweak duration-log #2 c >4 #]
+\test ##[ < c \tweak transparent ##t e >4 #]
+\test ##[ < \tweak color #'(1.0 0.0 0.0) \tweak duration-log #2 c >4 #]
+\test ##[ c4-\tweak font-size #3 -> #]
+\test ##[ < \tweak Accidental.color #'(1.0 0.0 0.0) cis eis g >4 #]
%% end test.
diff --git a/scm/define-music-display-methods.scm b/scm/define-music-display-methods.scm
index 845b514f44..ca532c5029 100644
--- a/scm/define-music-display-methods.scm
+++ b/scm/define-music-display-methods.scm
@@ -105,15 +105,13 @@ expression."
;;;
;;; durations
;;;
-(define*-public (duration->lily-string ly-duration #:key (prev-duration (*previous-duration*))
- (force-duration (*force-duration*))
- (time-scale (*time-scale*))
- remember)
- (if remember (*previous-duration* ly-duration))
+(define*-public (duration->lily-string ly-duration #:key
+ (force-duration #f)
+ (time-scale (*time-scale*)))
(let ((log2 (ly:duration-log ly-duration))
(dots (ly:duration-dot-count ly-duration))
(scale (ly:duration-scale ly-duration)))
- (if (or force-duration (not prev-duration) (not (equal? ly-duration prev-duration)))
+ (if (or force-duration (not (*omit-duration*)))
(string-append (case log2
((-1) "\\breve")
((-2) "\\longa")
@@ -429,14 +427,15 @@ Otherwise, return #f."
;; '<' (notepitch | drumpitch)* '>" duration post_events
(let ((duration (duration->lily-string (ly:music-property
(car chord-elements)
- 'duration)
- #:remember #t)))
+ 'duration))))
;; Format duration first so that it does not appear on
;; chord elements
(format #f "< ~{~a ~}>~a~:{~:[-~;~]~a~^ ~}"
- (map-in-order (lambda (music)
- (music->lily-string music parser))
- chord-elements)
+ (parameterize ((*omit-duration* #t))
+ (map-in-order
+ (lambda (music)
+ (music->lily-string music parser))
+ chord-elements))
duration
(map-in-order (lambda (music)
(list
@@ -444,8 +443,7 @@ Otherwise, return #f."
(music->lily-string music parser)))
other-elements))))
((ly:duration? chord-repeat)
- (let ((duration (duration->lily-string chord-repeat
- #:remember #t)))
+ (let ((duration (duration->lily-string chord-repeat)))
(format #f "q~a~:{~:[-~;~]~a~^ ~}"
duration
(map-in-order (lambda (music)
@@ -467,8 +465,7 @@ Otherwise, return #f."
(define-display-method MultiMeasureRestMusic (mmrest parser)
(format #f "R~a~{~a~^ ~}"
- (duration->lily-string (ly:music-property mmrest 'duration)
- #:remember #t)
+ (duration->lily-string (ly:music-property mmrest 'duration))
(map-in-order (lambda (music)
(music->lily-string music parser))
(ly:music-property mmrest 'articulations))))
@@ -504,8 +501,7 @@ Otherwise, return #f."
(make-string (1- (* -1 octave-check)) #\,))
(else "")))
""))
- (duration->lily-string (ly:music-property event 'duration)
- #:remember #t)
+ (duration->lily-string (ly:music-property event 'duration))
(if ((make-music-type-predicate 'RestEvent) event)
"\\rest" "")
(map-in-order (lambda (event)
@@ -519,19 +515,15 @@ Otherwise, return #f."
(simple-note->lily-string note parser))
((not (null? (ly:music-property note 'drum-type))) ;; drum
(format #f "~a~a~{~a~}" (ly:music-property note 'drum-type)
- (duration->lily-string (ly:music-property note 'duration)
- #:remember #t)
+ (duration->lily-string (ly:music-property note 'duration))
(map-in-order (lambda (event)
(music->lily-string event parser))
(ly:music-property note 'articulations))))
(else
;; pure duration
- ;; FIXME: { c4 c4 4 4 } must not be output as { c4 c 4 4 }
- ;; quite tricky to do. Do it when outputting sequences?
(format #f "~a~{~a~}"
(duration->lily-string (ly:music-property note 'duration)
- #:force-duration #t
- #:remember #t)
+ #:force-duration #t)
(map-in-order (lambda (event)
(music->lily-string event parser))
(ly:music-property note 'articulations))))))
@@ -543,20 +535,17 @@ Otherwise, return #f."
(if (not (null? (ly:music-property rest 'pitch)))
(simple-note->lily-string rest parser)
(format #f "r~a~{~a~}"
- (duration->lily-string (ly:music-property rest 'duration)
- #:remember #t)
+ (duration->lily-string (ly:music-property rest 'duration))
(map-in-order (lambda (event)
(music->lily-string event parser))
(ly:music-property rest 'articulations)))))
(define-display-method MultiMeasureRestEvent (rest parser)
- (string-append "R" (duration->lily-string (ly:music-property rest 'duration)
- #:remember #t)))
+ (string-append "R" (duration->lily-string (ly:music-property rest 'duration))))
(define-display-method SkipEvent (rest parser)
(format #f "s~a~{~a~}"
- (duration->lily-string (ly:music-property rest 'duration)
- #:remember #t)
+ (duration->lily-string (ly:music-property rest 'duration))
(map-in-order (lambda (event)
(music->lily-string event parser))
(ly:music-property rest 'articulations))))
@@ -631,7 +620,7 @@ Otherwise, return #f."
(if (null? bracket-stop) "" "]"))))
(define-display-method LyricEvent (lyric parser)
- (format "~a~{~a~^ ~}"
+ (format #f "~a~{~a~^ ~}"
(let ((text (ly:music-property lyric 'text)))
(if (or (string? text)
(eqv? (first text) simple-markup))
@@ -674,7 +663,6 @@ Otherwise, return #f."
(and span (duration->lily-string span #:force-duration #t)))
(scale (/ num den))
(time-scale (*time-scale*)))
- (*previous-duration* #f)
(let ((result
(parameterize ((*force-line-break* #f)
(*time-scale* (* time-scale scale)))
@@ -683,7 +671,6 @@ Otherwise, return #f."
num
formatted-span
(music->lily-string (ly:music-property times 'element) parser)))))
- (*previous-duration* #f)
result)))
(define-display-method RelativeOctaveMusic (m parser)
@@ -1104,7 +1091,8 @@ Otherwise, return #f."
(define-display-method LyricCombineMusic (expr parser)
(format #f "\\lyricsto ~s ~a"
(ly:music-property expr 'associated-context)
- (parameterize ((*explicit-mode* #f))
+ (parameterize ((*explicit-mode* #f)
+ (*omit-duration* #t))
(music->lily-string (ly:music-property expr 'element) parser))))
;; \addlyrics
@@ -1124,7 +1112,8 @@ Otherwise, return #f."
(format #f "~a~a \\addlyrics ~a"
(music->lily-string ?note-sequence parser)
(new-line->lily-string)
- (parameterize ((*explicit-mode* #f))
+ (parameterize ((*explicit-mode* #f)
+ (*omit-duration* #t))
(music->lily-string ?lyric-sequence parser)))
#f)))
diff --git a/scm/display-lily.scm b/scm/display-lily.scm
index 6d38fff784..8d8645b36b 100644
--- a/scm/display-lily.scm
+++ b/scm/display-lily.scm
@@ -11,10 +11,10 @@
;;; Display methods are stored in the `display-methods' property of each music
;;; type.
;;;
-;;; - `music->lily-string' return a string describing a music expression using
-;;; LilyPond notation. The special variables *indent*, *previous-duration*,
-;;; and *force-duration* influence the indentation level and the display of
-;;; music durations.
+;;; - `music->lily-string' return a string describing a music
+;;; expression using LilyPond notation. The special variables *indent*
+;;; and *omit-duration* influence the indentation level and the
+;;; display of music durations.
;;;
;;; - `with-music-match' can be used to destructure a music expression, extracting
;;; some interesting music properties.
@@ -282,11 +282,8 @@ inside body."
;;; indentation
(define-public *indent* (make-parameter 0))
-;;; set to #t to force duration printing
-(define-public *force-duration* (make-parameter #f))
-
-;;; last duration found
-(define-public *previous-duration* (make-parameter (ly:make-duration 2)))
+;;; set to #t to omit duration printing
+(define-public *omit-duration* (make-parameter #f))
;;; Set to #t to force a line break with some kinds of expressions (eg sequential music)
(define *force-line-break* (make-parameter #t))
diff --git a/scm/music-functions.scm b/scm/music-functions.scm
index 1b679a7228..611879ae8b 100644
--- a/scm/music-functions.scm
+++ b/scm/music-functions.scm
@@ -234,8 +234,7 @@ which often can be read back in order to generate an equivalent expression."
"Display the music expression using LilyPond syntax"
(memoize-clef-names supported-clefs)
(parameterize ((*indent* 0)
- (*previous-duration* (ly:make-duration 2))
- (*force-duration* force-duration))
+ (*omit-duration* #f))
(display (music->lily-string expr parser) port)
(newline port)))