A-ha! That makes sense and works great, thanks David. On Sat, May 4, 2024 at 1:54 AM David Kastrup <d...@gnu.org> wrote:
> Alec Bartsch <alec.bart...@gmail.com> writes: > > > I'm attempting to write a markup command that, in addition to other > > formatting, strips a trailing # or b character off the end of the text > > argument and replaces it with the appropriate accidental markup. I think > > I'm super-close but stuck on the proper syntax for passing a markup list > to > > the concat. Here's what I've got so far: > > > > #(define-markup-command (page-header layout props text) (markup?) > > "Page header style including optional trailing accidental" > > (let* ( > > (last-char (string-ref text (1- (string-length text)))) > > (prefix (substring text 0 (1- (string-length text)))) > > ) > > (interpret-markup layout props > > (markup #:override '(font-name . "Avenir Heavy") #:fontsize 5 > > (make-concat-markup (cond > > ((char=? last-char #\#) (list prefix #:hspace 0.2 > > #:fontsize -2.5 #:raise 0.6 #:sharp)) > > ((char=? last-char #\b) (list prefix #:hspace 0.2 > > #:fontsize -2.5 #:raise 0.6 #:flat)) > > (else (list text)) > > )) > > ) > > ) > > ) > > ) > > > > \markup \page-header "Key of Bb" > > The markup macro is something that works so-soish. As a macro, it > doesn't wait for its arguments to be evaluated but looks at them before > they are being evaluated. It (hopefully) won't look inside a function > call like make-concat-markup. #{ \markup ... #} tends to behave more > predictable if slower. Fixing this up for your use case you'd write > something akin to > > > > -- > David Kastrup >