]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4474/5: Provide with-location macro
authorDavid Kastrup <dak@gnu.org>
Sat, 27 Jun 2015 11:34:36 +0000 (13:34 +0200)
committerDavid Kastrup <dak@gnu.org>
Wed, 8 Jul 2015 05:15:00 +0000 (07:15 +0200)
scm/lily.scm

index 90e85c8db1ea0716e408d92558124e8ed5f7fd9f..ff5d66dfeda1ca70294b161031d538d6815b16bf 100644 (file)
@@ -51,6 +51,9 @@
 ;; No public setters: should not get overwritten in action
 (define-public (*parser*) (fluid-ref %parser))
 (define-public (*location*) (fluid-ref %location))
+;; but properly scoped location should be fine
+(defmacro-public with-location (loc . body)
+  `(with-fluids ((,%location ,loc)) ,@body))
 
 ;; It would be nice to convert occurences of parser/location to
 ;; (*parser*)/(*location*) using the syncase module but it is utterly