lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible feature request for 'q' shorthand or tie syntax


From: David Kastrup
Subject: Re: Possible feature request for 'q' shorthand or tie syntax
Date: Fri, 21 Sep 2012 06:55:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

Jim Long <address@hidden> writes:

> On Fri, Sep 21, 2012 at 01:32:57AM +0200, David Kastrup wrote:
>> 
>> Pitches can also be put into a variable, like
>> tonic=f
>> 
>> { \tonic 2 }
>> 
>> So you want to force writing \tonic2 as well, I assume?  We can also
>> place them into variables.  Few minutes ago, someone else proposed a
>> function
>> 
>> av = #(define-music-function (parser location x) (ly:pitch?)
>>    #{
>>      $x 8 ~ $x 4
>>    #})
>> 
>> Now you can't write $x8 here since then Scheme would look for an
>> identifier x8.
>
> As I'm sure you're aware, in bash/sh scripts, many folks write
>
> echo $x
>
> when it is more correct to say
>
> echo ${x}

Uh no, it isn't "more correct".  It is often "more correct" to write
echo "$x"
or actually,
printf '%s\n' "$x"
since the command line processing of echo might react disfavorable,
depending on the sh version, when $x looks like an option.

> This eliminates the mistake of $x8 when the programmer really
> meant ${x}8

$x and $x8 are different uses.

> Is there a similar construct in Scheme?  Just guessing, but would
>
> ($x)8 ~ ($x)4
>
> be valid (and functionally correct) syntax?

It wouldn't, but in any case you surely realize that we have by far left
the region where the proposed cure has worse consequences than the
purported problem it is supposed to address.

> I have no real clue
> what to do about your example of
>
> { \tonic 2 }
>
> Do I understand correctly that these sorts of lilypond-isms
> operate as plain text substitution?

No.

> Is this a job for a function
> akin to \concat, like '\concat { \tonic 2 }'?

No.

> And:
>
> \tonic\tonic 2
>
> yields 'ff 2', yes?

No.

> While
>
> \tonic \tonic 2
>
> yields 'f f 2' I presume.

Like \tonic\tonic2 would.

> So one has lots of control
> concatenating variables, but less with literals?

No.

> How does one concatenate a variable substitution and a literal in such
> a way that there is no space between them, such as to get 'f2' or
> 'ff2'?

There is no concept of "concatenation" involved here.  Spaces are not
significant between separate syntactic elements.  Not even in lyrics.
If you write
xxx="text"
then \lyricmode{\xxx\xxx} and \lyricmode { \xxx \xxx } are both
equivalent to \lyricmode { text text } or \lyricmode{text   text}.

> I once had a piece in 6 flats, and wondered whether it would look
> better in 6 sharps, and search and replace (at least in vi!)
> doesn't quite cut it for safely changing all the gis'es to aes'es
> and the e's to fes'es, etc.

Why didn't you put

\transpose ges fis { ... }

around the passage?

> A melody that had a lot of tied notes made the work harder than it
> would have been if I hadn't had to change each of the multiple notes
> in the ties.  It would have been so much nicer to change only the
> first note in the tie, and have the remaining consecutively tied notes
> inherit their pitch automatically.  Having a p shortcut (where p is
> the old q) to repeat tied figures (either notes or chords) would have
> sufficed in that instance.

Wrong tool.  You could have also written

\displayLilyMusic \transpose ges fis { ... }

on the passage, then cut and paste the output back into your file if you
really wanted the _input_ to be changed.

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]