Re: Macro or abbreviation

2015-08-09 Thread David Kastrup
Andrew Bernard  writes:

> Hello Ponderers,
>
> It seems the topic of macros and abbreviations in lilypond source
> comes up from time to time and engenders all sorts of complex debate,
> so I am slightly wary of asking this question.
>
> I need to say:
>
> \tweak Accidental.stencil ##f

Well, it's the same as

\single \omit Accidental

which is not really shorter but more idiomatic.  The point to note is
that either way this phrase is not complete without a following music
expression with which it will then form a new, tweaked music expression.

> in a very large number of chords, and often several times in one chord
> in my current large and complex score. The score is becoming cluttered
> with this repeated command, and it’s quite a lot of typing when you
> have so many to type. I naively tried to make this an event function,
> but that does not work inside a chord.

Please, please, please _always_ back up any such statements by including
a minimal example that you would have expected to work.  Event functions
work perfectly well inside of a chord.  They are however near useless
for tweaking accidentals either in- or outside of chords since
accidentals don't, as a rule, occur in post-events (one rather obscure
exception being pitched trills).

And tweaks _also_ work perfectly well inside of a chord.  So it is not
clear just what problem you were experiencing here.

> [As an aside, it’s not a matter of changing the accidental style in
> use, dodecaphonic. I need to turn off selected accidentals in the
> dodecaphonic style when I join notes using a custom grace note slur
> function I have, that does not behave the same way as ‘proper’ slurs
> do.]

A more "correct" fix might be to teach LilyPond about your "custom grace
note slur" actually being a slur.  That might be preferable to applying
tweaks everywhere, even with a simpler way of doing the tweaks (there
are several other replies already covering that angle exhaustively).

It might be more technically involved but would likely keep your source
code cleaner and the MIDI matching the intent.

But this would actually require an example of what you are trying to do
with what code.

-- 
David Kastrup

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Macro or abbreviation

2015-08-09 Thread Andrew Bernard
Dear Thomas,

This is absolutely precisely what I have been looking for. So it was not 
entirely a stupid question of mine after all!

Many sincere thanks to David Kastrup for his continuing supreme efforts in 
lilypond development.

Andrew


On 9 August 2015 at 19:20:24, Thomas Morley (thomasmorle...@gmail.com) wrote

Thanks David Kastrup 2.19.24 allows for: 

omitAcc = \tweak Accidental.stencil ##f \etc 
{ < \omitAcc cis' ces'' > } 

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Macro or abbreviation

2015-08-09 Thread Jacques Menu
Hello Andrew,

You can get inspiration from the following.

JM


%1
Uncomment the second line to let LP do the line breaking by itself. The first 
definition is useful to keep line breaks as in the original score, useful to 
control your work:

myBreak = {\break}
%myBreak = {}


%2
I use such variables for custom fingerings for the bass guitar, including the 
caret to simplify the typing:

UN_B = ^\tweak self-alignment-X #CENTER -\markup\large\bold\with-color 
#magenta "1B"
UN_B_PAR = ^\tweak self-alignment-X #CENTER -\markup\large\bold\with-color 
#magenta "(1B)"

{ \clef "bass" c \UN_B_PAR }


> Le 9 août 2015 à 10:52, Andrew Bernard  a écrit :
> 
> Hello Ponderers,
> 
> It seems the topic of macros and abbreviations in lilypond source comes up 
> from time to time and engenders all sorts of complex debate, so I am slightly 
> wary of asking this question.
> 
> I need to say:
> 
> \tweak Accidental.stencil ##f
> 
> in a very large number of chords, and often several times in one chord in my 
> current large and complex score. The score is becoming cluttered with this 
> repeated command, and it’s quite a lot of typing when you have so many to 
> type. I naively tried to make this an event function, but that does not work 
> inside a chord. [As an aside, it’s not a matter of changing the accidental 
> style in use, dodecaphonic. I need to turn off selected accidentals in the 
> dodecaphonic style when I join notes using a custom grace note slur function 
> I have, that does not behave the same way as ‘proper’ slurs do.]
> 
> Is there a way to make this into a macro, or abbreviate it in some way? I am 
> not referring to making a keystroke macro in Frescobaldi, but a language 
> level shorter form, for convenience. I hope this question does not trigger a 
> torrent of comments saying this is a Bad Thing (TM).
> 
> Andrew
> 
> 
> 
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org 
> https://lists.gnu.org/mailman/listinfo/lilypond-user 
> 
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Macro or abbreviation

2015-08-09 Thread Thomas Morley
2015-08-09 10:52 GMT+02:00 Andrew Bernard :
> Hello Ponderers,
>
> It seems the topic of macros and abbreviations in lilypond source comes up
> from time to time and engenders all sorts of complex debate, so I am
> slightly wary of asking this question.
>
> I need to say:
>
> \tweak Accidental.stencil ##f
>
> in a very large number of chords, and often several times in one chord in my
> current large and complex score. The score is becoming cluttered with this
> repeated command, and it’s quite a lot of typing when you have so many to
> type. I naively tried to make this an event function, but that does not work
> inside a chord. [As an aside, it’s not a matter of changing the accidental
> style in use, dodecaphonic. I need to turn off selected accidentals in the
> dodecaphonic style when I join notes using a custom grace note slur function
> I have, that does not behave the same way as ‘proper’ slurs do.]
>
> Is there a way to make this into a macro, or abbreviate it in some way? I am
> not referring to making a keystroke macro in Frescobaldi, but a language
> level shorter form, for convenience. I hope this question does not trigger a
> torrent of comments saying this is a Bad Thing (TM).
>
> Andrew



Hi Andrew,

you post your request on the user-list, thus I assume you don't ask
for extending the source code but for a custom solution.

In 2.18.2 you can do

omitAcc =
  #(define-music-function (parser location music) (ly:music?)
 #{ \tweak Accidental.stencil ##f $music #})

Thanks David Kastrup 2.19.24 allows for:

omitAcc = \tweak Accidental.stencil ##f \etc
{ < \omitAcc cis' ces'' > }


Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Macro or abbreviation

2015-08-09 Thread Andrew Bernard
Hello Ponderers,

It seems the topic of macros and abbreviations in lilypond source comes up from 
time to time and engenders all sorts of complex debate, so I am slightly wary 
of asking this question.

I need to say:

\tweak Accidental.stencil ##f

in a very large number of chords, and often several times in one chord in my 
current large and complex score. The score is becoming cluttered with this 
repeated command, and it’s quite a lot of typing when you have so many to type. 
I naively tried to make this an event function, but that does not work inside a 
chord. [As an aside, it’s not a matter of changing the accidental style in use, 
dodecaphonic. I need to turn off selected accidentals in the dodecaphonic style 
when I join notes using a custom grace note slur function I have, that does not 
behave the same way as ‘proper’ slurs do.]

Is there a way to make this into a macro, or abbreviate it in some way? I am 
not referring to making a keystroke macro in Frescobaldi, but a language level 
shorter form, for convenience. I hope this question does not trigger a torrent 
of comments saying this is a Bad Thing (TM).

Andrew



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user