Skip to content

Commit

Permalink
adds warning to missing edition
Browse files Browse the repository at this point in the history
Not sure if this is correct, since warning message points to __main__.ily rather than line in example doc.
  • Loading branch information
jefferyshivers committed Jul 15, 2016
1 parent 3538fb2 commit ba21207
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions annotate/__main__.ily
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,17 @@
#(if (assq-ref props 'apply)
;; If set, add editorial command
(let* ((edition (string->symbol (assoc-ref props 'apply)))
(edit (getChildOption `(scholarly editorial ,edition) (car item))))
(if (ly:music-function? edit)
(edit mus)
#{ \once #edit #mus #}))
(edit (getChildOptionWithFallback
`(scholarly editorial ,edition)
(car item)
#f)))
(if (not (eq? edit #f))

This comment has been minimized.

Copy link
@uliska

uliska Jul 15, 2016

Contributor

This line can be expressed much simpler as (if edit.

edit will be either #f or any Scheme value at that point. And the if will switch to the #t branch of execution when the condition evaluates to "a true value", not necessarily #t.

(if (ly:music-function? edit)
(edit mus)
#{ \once #edit #mus #})
(begin
(oll:warn "Edition option not set: ~a (~a)" edition (car item))

This comment has been minimized.

Copy link
@uliska

uliska Jul 15, 2016

Contributor

I will have to look into that. I think the oll:XXX commands can use some improvements. I suggest to leave it like that for now until openlilylib/oll-core#10 has been resolved.

mus)))
mus)
#})
(begin
Expand Down

1 comment on commit ba21207

@uliska
Copy link
Contributor

@uliska uliska commented on ba21207 Jul 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I wanted to suggest.

Maybe "Edition option" is not what helps the user understand what has been done wrong. Maybe rather something like "Editorial command ~a not set for ~a"?

Please sign in to comment.