Urs Liska <li...@openlilylib.org> writes: > Thank you. While I had to figure out how to adapt this to 2.18 I > realized that the missing information was that I can turn the symbol > "cm" into a value through ly:parser-lookup. > > This works with 2.18, and I will further refine it (the idea is to > store several sets of paper variables and select a set with a single > function: > > \version "2.18" > > #(define paper-values > '((top-margin . (5 . cm)) > (indent . (4 . cm))))
Can you tell your mail client _not_ to replace spaces with unbreakable spaces? This makes copy&paste much less pleasant. At any rate, I'd likely go for '((top-margin . (* 5 cm)) .... instead. You can even use '((top-margin . #{ 5\cm #}) .... and either will yield to primitive-eval when in a paper module. > #(define-scheme-function (parser location val)(symbol?) > (let* > ((entry (assoc-ref paper-values val)) > (unit (ly:parser-lookup parser (cdr entry)))) > (* unit (car entry)))) > > \paper { > indent = \paperValue #'indent > top-margin = \paperValue #'top-margin > } Why not just \paper { #(for-each (lambda (p) (ly:parser-define! (car p) (primitive-eval (cdr p)))) paper-values) } or some suitably similar wrapper? -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user