How does a macro properly expand to a define-runtime-path? The documentation for define-runtime-path says this:
If the form has a source module according to syntax-source-module <file:///Applications/Racket/2017-10-29/Racket%20v6.11.0.2/doc/reference/stxops.html#%28def._%28%28quote._~23~25kernel%29._syntax-source-module%29%29>, then the source location is determined by preserving the original expression as a syntax object, extracting its source module path at run time (again using syntax-source-module <file:///Applications/Racket/2017-10-29/Racket%20v6.11.0.2/doc/reference/stxops.html#%28def._%28%28quote._~23~25kernel%29._syntax-source-module%29%29>), and then resolving the resulting module path index. If the expression has no source module, the syntax-source <file:///Applications/Racket/2017-10-29/Racket%20v6.11.0.2/doc/reference/stxops.html#%28def._%28%28quote._~23~25kernel%29._syntax-source%29%29> location associated with the form is used, if is a string or path. If no source module is available, and syntax-source <file:///Applications/Racket/2017-10-29/Racket%20v6.11.0.2/doc/reference/stxops.html#%28def._%28%28quote._~23~25kernel%29._syntax-source%29%29> produces no path, then current-load-relative-directory <file:///Applications/Racket/2017-10-29/Racket%20v6.11.0.2/doc/reference/eval.html#%28def._%28%28quote._~23~25kernel%29._current-load-relative-directory%29%29> is used if it is not #f. Finally, current-directory <file:///Applications/Racket/2017-10-29/Racket%20v6.11.0.2/doc/reference/Filesystem.html#%28def._%28%28quote._~23~25kernel%29._current-directory%29%29> is used if all else fails. This tells me that if I want to specify the path it uses to anchor relative paths, I should give the define-runtime-path form a source location from the file I want it to use. (define-syntax-parser macro [(_ name path-expr) (quasisyntax/loc #'name (define-runtime-path name path-expr))]) However, this doesn't work. It finds paths relative to the macro's source file instead of the file that `name` came from. What is the proper way to do this? (Going through the steps from the documentation: * syntax-source-module returns #<module-path-index:()>, which I assume it doesn't use. * syntax-source returns #<path:/Users/Alex/Desktop/try-runtime-path/use.rkt>, which I assume it should use. I want it to use the use.rkt path as the anchor, but instead define-runtime-path is using the macro path. Why? What am I doing wrong?) Alex Knauth -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.