Lilypond source code pretty-printer

2013-05-04 Thread Jacques Menu
Hello,

I've seen various opinions expressed in this list as to how one should layout 
Lily source code.

Has there been attempts yet to produce an automatic pretty-printer?

Regards,

--

Jacques Menu
Ch. de la Pierre 12
1023 Crissier

mailto:jacques.m...@tvtmail.ch





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


Re: Lilypond source code pretty-printer

2013-05-04 Thread Noeck


Am 04.05.2013 09:08, schrieb Jacques Menu:
> Hello,
> 
> I've seen various opinions expressed in this list as to how one should layout 
> Lily source code.
> 
> Has there been attempts yet to produce an automatic pretty-printer?

Hi,

as far as indentation and syntax highlighting is concerned, Frescobaldi
does a very good job.

If you are talking about code structure, so where to use variables and
whether to state things explicitly or not, I think this depends on the
size of your project. In the examples in the docs you will often find
the following ordering, which is a good decision for a wide range of
project sizes:
% version, header, paper, …
% variables for music and lyrics
% score structure

Cheers,
Joram

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


Re: Lilypond source code pretty-printer

2013-05-04 Thread Federico Bruni
2013/5/4 Jacques Menu 

> Hello,
>
> I've seen various opinions expressed in this list as to how one should
> layout Lily source code.
>
> Has there been attempts yet to produce an automatic pretty-printer?
>
>
>
Have a look at this discussion:

http://lists.gnu.org/archive/html/lilypond-user/2012-06/msg00176.html
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: mdash in markup?

2013-05-04 Thread James Harkins
Urs Liska  openlilylib.org> writes:

> In the first line of that page you're directed 
> tohttp://lilypond.org/doc/v2.16/
Documentation/notation/special-characters#ascii-aliases
> where the first example uses\paper {
>   #(include-special-characters)
> }

I see it now. It wasn't obvious to me that the special character aliases 
wouldn't
work without enabling them in the paper block.

FWIW, I complain on the SuperCollider mailing list as well about
"documentation by example." Examples are necessary but, if it's up
to the reader to guess how something works based on an example,
it leaves room to guess wrong. I don't mean this to say that the 
Lilypond manuals are misguided -- the opposite, actually: they're
possibly the best documentation for any open source software I've
used. This is a small gap. I'm just bored waiting to see Iron Man 3 and
feel like pontificating about something :-P

hjh


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


Re: mdash in markup?

2013-05-04 Thread David Kastrup
James Harkins  writes:

> Urs Liska  openlilylib.org> writes:
>
>> In the first line of that page you're directed
>> to
>> http://lilypond.org/doc/v2.16/Documentation/notation/special-characters#ascii-aliases
>> where the first example uses\paper {
>>   #(include-special-characters)
>> }
>
> I see it now. It wasn't obvious to me that the special character
> aliases wouldn't work without enabling them in the paper block.

A list of ASCII aliases for special characters can be included:

\paper {
  #(include-special-characters)
}
[...]

It does not get much more obvious than that.

> FWIW, I complain on the SuperCollider mailing list as well about
> "documentation by example." Examples are necessary but, if it's up to
> the reader to guess how something works based on an example, it leaves
> room to guess wrong. I don't mean this to say that the Lilypond
> manuals are misguided -- the opposite, actually: they're possibly the
> best documentation for any open source software I've used. This is a
> small gap. I'm just bored waiting to see Iron Man 3 and feel like
> pontificating about something :-P

Uh, you complain about the manual containing the information you were
needing?  Are you sure this is a good choice for pontification?

-- 
David Kastrup


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


RE: Lyrics and Punctuations Alignment Issue?

2013-05-04 Thread Jun Wang
Ming and David,
I modified a bit more (see attached code), It seems to be working.
ThanksJun 
Date: Fri, 3 May 2013 22:06:22 -0500
Subject: Re: Lyrics and Punctuations Alignment Issue?
From: david.nales...@gmail.com
To: tsan...@rogers.com
CC: wj1...@hotmail.com; lilypond-user@gnu.org

Ming,



On Fri, May 3, 2013 at 9:08 PM, MING TSANG  wrote:


David, 

Thank you very much.  I try to do two punctuation to the left, but I cannot 
make it work.  Any help is appreciated.  Please refer to "a" and "c" from the 
.png

As I explained in my email, if you need additional punctuation you need to add 
it to the respective variables.
--David   

include_lyric-align.ly
Description: Binary data
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Lyrics and Punctuations Alignment Issue?

2013-05-04 Thread David Nalesnik
Ming,


On Fri, May 3, 2013 at 10:06 PM, David Nalesnik wrote:

> Ming,
>
>
>
>
> On Fri, May 3, 2013 at 9:08 PM, MING TSANG  wrote:
>
>> David,
>>
>> Thank you very much.  I try to do two punctuation to the left, but I
>> cannot make it work.  Any help is appreciated.  Please refer to "a" and "c"
>> from the .png
>>
>
> As I explained in my email, if you need additional punctuation you need to
> add it to the respective variables.
>
> --David
>

Ah, OK--you didn't mention that you had adapted the functions dealing with
left punctuation.

Unfortunately, I'm having trouble with the glyphs you're using, so I can't
run your file.

>From looking it over, I can see a number of problems, though.

In "drop-punctuation-left"
--replace string-suffix? with string-prefix?
--string-drop-left is not a command; it's string-drop

In the function "align"
--the functions dealing with left punctuation are never called; make this
change:

(text-R (drop-punctuation-left text))

Other than this, all appears OK. Hopefully this will do.  With the glyph
problems, I think that this is all the help I can offer.

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


Re: Lyrics and Punctuations Alignment Issue?

2013-05-04 Thread David Nalesnik
Hi Jun.


On Sat, May 4, 2013 at 6:28 AM, Jun Wang  wrote:

> Ming and David,
>
> I modified a bit more (see attached code), It seems to be working.
>
> Thanks
> Jun
>

Just got your mail.  Yup--those are the changes I made to the Scheme, but I
couldn't get it to work because of the way the characters in the lists were
encoded.  Tried yours--it works perfectly!

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


Re: Glissando to a rest

2013-05-04 Thread TaoCG
This should work. You just have to make sure the space between the two notes
isn't too tight or the glissando won't print. In this case it happens if you
omit the \break.

\relative c''
{
  es4*1/2->\glissando
  \hideNotes
  es,
  \unHideNotes
  r4 r2 | \break
  es1
}

HTH,
Tao



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Glissando-to-a-rest-tp145286p145451.html
Sent from the User mailing list archive at Nabble.com.

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


Re: Lyrics and Punctuations Alignment Issue?

2013-05-04 Thread MING TSANG
Jun, Thank you.  I add a few punctuation to your code.

David,  I don't know scheme. That's why I did a lousy job. I add few more 
punctuation to the Jun's latest code.  It works.

Thank you both. I have been looking this for a long time.

Ming.



>
> From: Jun Wang 
>To: David Nalesnik ; MING TSANG  
>Cc: "lilypond-user@gnu.org"  
>Sent: Saturday, May 4, 2013 7:28:46 AM
>Subject: RE: Lyrics and Punctuations Alignment Issue?
> 
>
>
> 
>Ming and David,
>
>
>I modified a bit more (see attached code), It seems to be working.
>
>
>Thanks
>Jun 
>
>
>
>
>Date: Fri, 3 May 2013 22:06:22 -0500
>Subject: Re: Lyrics and Punctuations Alignment Issue?
>From: david.nales...@gmail.com
>To: tsan...@rogers.com
>CC: wj1...@hotmail.com; lilypond-user@gnu.org
>
>
>Ming,
>
>
>
>
>
>
>
>On Fri, May 3, 2013 at 9:08 PM, MING TSANG  wrote:
>
>David, 
>>
>>
>>Thank you very much.  I try to do two punctuation to the left, but I cannot 
>>make it work.  Any help is appreciated.  Please refer to "a" and "c" from the 
>>.png
>
>
>As I explained in my email, if you need additional punctuation you need to add 
>it to the respective variables.
>
>
>--David
>
>%
\version "2.16"

#(define (drop-punctuation-right str)
  (let ((punct-right '("." "," ";" ":" "?" "!" "\"" "'" "。" "]" ")" "?" "!" "," ":" ";")))
(let loop ((elt punct-right))
  (if (null? elt)
  #f
  (if (string-suffix? (car elt) str)
  (string-drop-right str (string-length (car elt)))
  (loop (cdr elt)))

#(define (drop-all-punctuation-right str)
  (let ((core (drop-punctuation-right str)))
(if core
(drop-all-punctuation-right core)
str)))

#(define (drop-punctuation-left str)
  (let ((punct-left '("\"" "“" "[" "(")))
(let loop ((elt punct-left))
  (if (null? elt)
  #f
  (if (string-prefix? (car elt) str)
  (string-drop str (string-length (car elt)))
  (loop (cdr elt)))

#(define (drop-all-punctuation-left str)
  (let ((core (drop-punctuation-left str)))
(if core
(drop-all-punctuation-left core)
str)))


#(define (align grob)
  (let* ((stil (ly:grob-property grob 'stencil))
 (stil-X (ly:stencil-extent stil X))
 (text (ly:grob-property grob 'text))
 ; determine X-extent of text stencil without punctuation at end
 (text-L (drop-all-punctuation-right text))
 (text-L-stil (grob-interpret-markup grob text-L))
 (text-L-stil-X (ly:stencil-extent text-L-stil X))
 (displacement (/ (- (cdr text-L-stil-X) (cdr stil-X)) 2))
 ; determine X-extent of text stencil without punctuation at start
 (text-R (drop-all-punctuation-left text))
 (text-R-stil (grob-interpret-markup grob text-R))
 (text-R-stil-X (ly:stencil-extent text-R-stil X))
 (displacement (+ displacement
  (/ (- (cdr stil-X) (cdr text-R-stil-X)) 2

 (- (ly:self-alignment-interface::aligned-on-x-parent grob)
displacement)))

\paper {
  ragged-right = ##f
}

\relative c' {
  \time 3/4 e4 e4. e8
  d4 e d c d e
}

\addlyrics { \set stanza = "1. "
  \override LyricText #'X-offset = #align
  "\"I" am so lone -- "ly,\"" said she
}
\addlyrics { \set stanza = "2. "
  \override LyricText #'X-offset = #align
  [樂  極] (寶  名) 貝?  名。 啊:  明;  天!
}
\addlyrics { \set stanza = "3. "
  \override LyricText #'X-offset = #align
  a b c d e f g h i
}
\addlyrics { \set stanza = "4. "
  \override LyricText #'X-offset = #align
  (樂  極) "\"寶"  名 貝  名. 啊,  明?  天!
}___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Lyrics and Punctuations Alignment Issue?

2013-05-04 Thread David Nalesnik
Ming,


On Sat, May 4, 2013 at 11:16 AM, MING TSANG  wrote:

> Jun, Thank you.  I add a few punctuation to your code.
>
> David,  I don't know scheme. That's why I did a lousy job. I add few more
> punctuation to the Jun's latest code.  It works.
>
> Thank you both. I have been looking this for a long time.
>

Nice to hear!  By the way, did you mean to add the parentheses at "a" and
:b" to your lists?

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


Re: Lyrics and Punctuations Alignment Issue?

2013-05-04 Thread MING TSANG
David, 

Yes, left and right  UTF-8 parenthese - UTF-8.

Thanks,
Ming



>
> From: David Nalesnik 
>To: MING TSANG  
>Cc: Jun Wang ; "lilypond-user@gnu.org" 
> 
>Sent: Saturday, May 4, 2013 4:05:37 PM
>Subject: Re: Lyrics and Punctuations Alignment Issue?
> 
>
>
>Ming,
>
>
>
>
>On Sat, May 4, 2013 at 11:16 AM, MING TSANG  wrote:
>
>Jun, Thank you.  I add a few punctuation to your code.
>>
>>
>>David,  I don't know scheme. That's why I did a lousy job. I add few more 
>>punctuation to the Jun's latest code.  It works.
>>
>>
>>Thank you both. I have been looking this for a long time.
>
>
>Nice to hear!  By the way, did you mean to add the parentheses at "a" and :b" 
>to your lists?
>
>
>-David 
>
>___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: cre - - sen - - do

2013-05-04 Thread Keith OHara
Derek  shmerek.com> writes:

> I tried within my dymanic stave and this was the result:
> s4 s8 {s8-\tweak#'text"cre"\cresc s4 s8-\tweak#'text"scen"\cresc s8%|28
> s4 s8-\tweak#'text"do"\cresc s8 s4 -\tweak#'text"molto"\cresc s4%|29
> s4\f} s4 s4 s4%|30
>  
> 

There was a bug that \tweak failed to work in Dynamics.
The repair for the bug was done two years ago and made it into version 2.14


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


Re: is MultiMeasureRest breakable?

2013-05-04 Thread Keith OHara
Kieren MacMillan  sympatico.ca> writes:

> Is there a way to break MultiMeasureRests in the voice, so that
> the piano part is spaced "naturally" (as
> opposed to breaking the piano part in order to fit the voice's MMRs)?
> 

Possibly nobody understands the context.  Multi-measure rests are
always breakable.

theVoice = {R1* 7}
\score {{\time 7/4 \theVoice}} % printed as four bars of rest


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


Re: is MultiMeasureRest breakable?

2013-05-04 Thread Kieren MacMillan
Hi Keith,

>> Is there a way to break MultiMeasureRests in the voice, so that
>> the piano part is spaced "naturally" (as
>> opposed to breaking the piano part in order to fit the voice's MMRs)?
> 
> Possibly nobody understands the context.

Good point.
I was wondering why my last few posts have received no responses from this 
normally responsive list — I never doubted it was my fault!  :)

> Multi-measure rests are always breakable.
> theVoice = {R1* 7}
> \score {{\time 7/4 \theVoice}} % printed as four bars of rest

What I mean is, if the barline in another [polymetric] staff falls in the 
middle of a MultiMeasureRest, could Lilypond [automatically] split the measure, 
perhaps putting a parenthesized MMR on the following system? The following 
snippet shouldn't have to run off the end of the page, since there are ample 
opportunities to put a system break:

\version "2.17"
\language "english"

\layout {
  \context {
\Score
\remove "Timing_translator"
\remove "Default_bar_line_engraver"
  }
  \context {
\Staff
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
  }
}

theVoice = {
  \time 4/4
  R1*7 
}

thePiano = \relative c' {
  \time 7/8
  \repeat "unfold" 56 { c8 }
}

\score {
  <<
\new Staff \theVoice
\new Staff \thePiano
  >>
}

It would be great if I could (e.g.) \override MultiMeasureRest.breakable = ##t, 
and it would end up like this (but with the after-line-breaking MMR 
parenthesized):

\version "2.17"
\language "english"

\layout {
  \context {
\Score
\remove "Timing_translator"
\remove "Default_bar_line_engraver"
  }
  \context {
\Staff
\consists "Timing_translator"
\consists "Default_bar_line_engraver"
  }
}

theVoice = {
  \time 4/4
  \repeat "unfold" 7 { R1*1/8 \repeat "unfold" 7 { \bar "" s8 } } 
}

thePiano = \relative c' {
  \time 7/8
  \repeat "unfold" 56 { c8 }
}

\score {
  <<
\new Staff \theVoice
\new Staff \thePiano
  >>
}

I could do this manually (or set up a function), but I was just wondering if 
Lily had it in her to do this automagically…  =)

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


Re: mdash in markup?

2013-05-04 Thread James Harkins
David Kastrup  gnu.org> writes:

> > I see it now. It wasn't obvious to me that the special character
> > aliases wouldn't work without enabling them in the paper block.
> 
> A list of ASCII aliases for special characters can be included:
> 
> \paper {
>   #(include-special-characters)
> }
> [...]
> 
> It does not get much more obvious than that.

It can.

My real point is about the styles in which people approach documentation. My 
complaint comes up in SuperCollider-land because, more often than I'd like) a 
method's documentation consists of one sentence (or sometimes just a sentence 
fragment) that barely says more than you could guess from the method's name. 
Then there's one example, from which the reader is supposed to infer the 
relationship between the input and output, and anticipate corner cases (in the 
absence of any hints that corner cases could even exist). This bugs me because 
a/ I tend to read text and skim examples and (more importantly) b/ it's 
imprecise. Here, I was left to guess about the criticality of include-special-
characters, and I guessed wrong. My point is, why should I have had to guess 
in the first place?

Lilypond's documentation is generally better than that. But here is a case 
where a feature is entirely inactive without a statement, placed earlier in 
the document (possibly even in a different file, if the markup appears in an 
included file), and nothing in the text says that these aliases will fail 
otherwise. Sure, the manual "contains" the information, but neither does it 
call attention to the complete failure of this feature (admittedly, a marginal 
feature...). As a general rule of thumb in documentation, I tend to think, if 
something will break completely without special preparation, that warrants a 
NOTE or WARNING in the text.

I can send a doc patch, if you like. Fixing is better than complaining.

hjh


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


Re: is MultiMeasureRest breakable?

2013-05-04 Thread Keith OHara

On Sat, 04 May 2013 19:21:23 -0700, Kieren MacMillan 
 wrote:


What I mean is, if the barline in another [polymetric] staff falls in the 
middle of a MultiMeasureRest, could Lilypond [automatically] split the measure, 
perhaps putting a parenthesized MMR on the following system?


This came up not very long ago, but I had forgotten
http://code.google.com/p/lilypond/issues/detail?id=2863

So it is not the rests that are refusing to break across lines, but the bars 
themselves.

The Bar_line_engraver does two jobs, printing barlines at the right places, and 
forbidding line-breaks at all other places.  You only want the first job.  The 
rule now is that a line can break when every staff has a bar (more 
specifically, whenever every Bar_line_engraver says it is okay); maybe that 
should be when *any* staff has a bar.


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


Re: mdash in markup?

2013-05-04 Thread Werner LEMBERG

> I can send a doc patch, if you like. Fixing is better than
> complaining.

Please do so!  Usually, developers don't have a good sense for
documentation :-)


Werner

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