Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions editorial-functions/config.ily
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Global boolean to toggle editorial functions
%%%% Global options to toggle editorial functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% By detault, scholarLY applies editorial functions when set.
\registerOption scholarly.editorial.functions.apply ##t
\registerOption scholarly.editorial-functions.apply ##t


% By detault, scholarLY doesn't ignore any types.
\registerOption scholarly.editorial-functions.ignored-types #`()




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand All @@ -29,15 +35,14 @@

% NOTE. these are *not* real suggestions, but placeholders for now.

\registerOption scholarly.editorial.functions.addition
\registerOption scholarly.editorial-functions.addition
#`((NoteHead . ,parenthesize)
(Slur . ,slurDashed))

\registerOption scholarly.editorial.functions.deletion
\registerOption scholarly.editorial-functions.deletion
#`((NoteHead . ,parenthesize)
(Slur . ,slurDotted))

\registerOption scholarly.editorial.functions.emendation
\registerOption scholarly.editorial-functions.emendation
#`((NoteHead . ,parenthesize)
(Slur . ,slurDashed))

21 changes: 13 additions & 8 deletions editorial-functions/module.ily
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ editorialFunction =
#(define-music-function (type item mus)
(symbol? symbol-list? ly:music?)
(let ((edit (getChildOptionWithFallback
`(scholarly editorial functions ,type)
(last item)
#f)))
(if (and edit
(getOption `(scholarly editorial functions apply)))
(if (ly:music-function? edit)
(edit mus)
#{ \once #edit #mus #})
`(scholarly editorial-functions ,type)
(last item)
#f))
(apply-edits (getOption `(scholarly editorial-functions apply)))
(ignored-type (memq type (getOption
`(scholarly editorial-functions ignored-types)))))
(if edit
(if (and apply-edits
(not ignored-type))
(if (ly:music-function? edit)
(edit mus)
#{ \once #edit #mus #})
mus)
(begin
(oll:warn "Editorial command ~a not set for ~a." edit (car item))
mus))))
Expand Down
8 changes: 4 additions & 4 deletions usage-examples/editorial-commands.ly
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
modules = annotate
} scholarly

% \setOption scholarly.editorial.functions.apply ##f
% \setOption scholarly.editorial-functions.apply ##f


%{
% editorial options can be set:
% (commented out to verify that options load
% from editorial-functions/config [y])

\setOption scholarly.editorial.functions.addition #`(
\setOption scholarly.editorial-functions.addition #`(
(Slur . ,slurDashed)
(NoteHead . ,parenthesize))
%}
Expand All @@ -25,15 +25,15 @@ longerfunction =
#(define-music-function (mus) (ly:music?)
#{ \once \set fontSize = -4 \parenthesize #mus #})

\setOption scholarly.editorial.functions.deletion #`(
\setOption scholarly.editorial-functions.deletion #`(
(NoteHead . ,longerfunction))



% options can also be expressed in lilypond code blocks
% (if they don't contain music functions):

\setOption scholarly.editorial.functions.emendation #`(
\setOption scholarly.editorial-functions.emendation #`(
(Slur .
,#{
\slurDotted \shape #'((0 . -0.5) (0 . -1.5) (0 . -3.5) (0 . -0.5)) Slur
Expand Down