Hi Paul,
The other request (containing letters A, B, C ...) is not yet clear
to me - Paul, can you give an example?
These usages are for indicating modifications of a score without
changing the original bar numbers.
The usual usage for my second request is to label the first bar "A",
the 2nd bar "B", etc. and then go back to conventional bar numbering
(using Score.currentBarNumber )
The code I was given earlier was:
bnLet =
#(define-music-function
(parser location aLetter)
(string?)
#{
\once \override Score.BarNumber.stencil =
#(lambda (grob)
(let ((text (ly:grob-property grob 'text)))
(grob-interpret-markup grob
#{ \markup \sans $aLetter #})))
#})
setA = { \bnLet #"A" }
setB = { \bnLet #"B" }
etc.
Please take a look at https://lilypond.org/tiny-examples.html
Why should anybody spend their time adding the necessary material so the
code you provided actually produces a meaningful output, in order to be
even able to start working on a solution for your request? It's prudent
to make things easy for those who are willing to help.
So, in short: There's no fundamental obstacle to making a function like
bnLet auto-increase the letter. You need to use a function that converts
a numeric value to a letter; for this, take a look at the \markalphabet
or \markletter markup functions
(https://lilypond.org/doc/v2.25/Documentation/notation/other-markup-commands).
Then you can create a global numeric counter variable which bnLet reads
and increases. (A cleaner, but more complicated solution probably would
store the counter variable in a context property.)
Lukas