openlilylib / analysis

Graphical highlighting of musical analysis with GNU LilyPond
GNU General Public License v3.0
5 stars 3 forks source link

Guile syntax error with offset-shorten-pair function #18

Closed markk closed 1 year ago

markk commented 1 year ago

While updating frames module for LilyPond 2.23.80 (see [1]) I get the following error which I don't know how to solve.

../analysis/frames/module.ily:1154:57: error: Guile signaled an error for the expression beginning here
      \once \override HorizontalBracket.shorten-pair = #
                                                        (offset-shorten-pair props)
In procedure -: Wrong type argument in position 1: syntax

1: https://github.com/openlilylib/analysis/pull/17/commits/a134cd0868ea8a39b19db4488e29da67c3878c02

KlausBlum commented 1 year ago

Hi Mark, welcome on board! Thank you for your updates. I will completely trust you and merge your pull request. As for the error message above, I'll try to investigate, but I have no clue what's going on here.

KlausBlum commented 1 year ago

The error does not occur if the \with {...} block contains a definition for shorten-pair. If there is no such definition, a default value is used. This should be a pair (0 . 0), but with 2.23.81, you get (syntax (0 . 0)) instead (which I never heard of before).

In the definitions of the default values, it seems that removing the apostroph mark from the pair definition does the trick, i.e. (shorten-pair ,number-pair? #'(0 . 0)) should be replaced by (shorten-pair ,number-pair? (0 . 0)).

markk commented 1 year ago

Ah, thanks for tracking this down Klaus!

I'm not sure if you're a subscriber to lilypond-user, but I have initiated a discussion about the future of OpenLilyLib there. It would be good to hear your thoughts.

https://lists.gnu.org/archive/html/lilypond-user/2022-11/msg00334.html

jeanas commented 1 year ago

See https://www.gnu.org/software/guile/manual/html_node/Syntax-Case.html

This is a slightly unfortunate aspect of the transition to Guile 2. Now, #'x means something in LilyPond code (# starts a Scheme expression, and ' quotes the symbol x), and something different in Scheme code (#' is the reader extension for “syntax”, just like ' is short for “quote”, and there are also #`, #, and #,@ for “quasisyntax”, “unsyntax” and “unsyntax-splicing”, like “quasiquote”/“unquote”/“unquote-splicing”). This is the same as #f = the music variable “forte” for LilyPond vs #f = the boolean false for Scheme.

jeanas commented 1 year ago

By the way, if you make a mistake in English / ..., you can say your native language is Scheme, which has quasisyntax, and even unsyntax.