Made `this-expression-source-directory' use setup/plthome if the current path
is in the plthome tree, so that generated syntax doesn't hard-wire a plthome location. The resulting syntax will use `un-plthome-ify' in this case. original commit: 127a796f8b6f589987f435a5cdba07b7d9551846
This commit is contained in:
parent
d034e63d73
commit
98ae6cb185
|
@ -1,10 +1,12 @@
|
||||||
|
|
||||||
(module etc mzscheme
|
(module etc mzscheme
|
||||||
(require "spidey.ss")
|
(require "spidey.ss"
|
||||||
|
(lib "plthome.ss" "setup"))
|
||||||
(require-for-syntax (lib "kerncase.ss" "syntax")
|
(require-for-syntax (lib "kerncase.ss" "syntax")
|
||||||
(lib "stx.ss" "syntax")
|
(lib "stx.ss" "syntax")
|
||||||
(lib "name.ss" "syntax")
|
(lib "name.ss" "syntax")
|
||||||
(lib "context.ss" "syntax")
|
(lib "context.ss" "syntax")
|
||||||
|
(lib "plthome.ss" "setup")
|
||||||
"private/stxset.ss")
|
"private/stxset.ss")
|
||||||
|
|
||||||
(provide true false
|
(provide true false
|
||||||
|
@ -438,28 +440,23 @@
|
||||||
(define-syntax (this-expression-source-directory stx)
|
(define-syntax (this-expression-source-directory stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_)
|
[(_)
|
||||||
(let ([source (syntax-source stx)]
|
(let* ([source (syntax-source stx)]
|
||||||
[local (lambda ()
|
[local (lambda ()
|
||||||
(let ([s (or (current-load-relative-directory)
|
(or (current-load-relative-directory)
|
||||||
(current-directory))])
|
(current-directory)))]
|
||||||
(datum->syntax-object
|
[dir (plthome-ify
|
||||||
(quote-syntax 'here)
|
(or (and source (string? source) (file-exists? source)
|
||||||
s
|
(let-values ([(base file dir?) (split-path source)])
|
||||||
stx)))])
|
(and (string? base)
|
||||||
(if (and source
|
(path->complete-path
|
||||||
(string? source)
|
base
|
||||||
(file-exists? source))
|
(or (current-load-relative-directory)
|
||||||
(let-values ([(base file dir?) (split-path source)])
|
(current-directory))))))
|
||||||
(cond
|
(local)))])
|
||||||
[(string? base)
|
(if (and (pair? dir) (eq? 'plthome (car dir)))
|
||||||
(with-syntax ([base (path->complete-path
|
(with-syntax ([d dir])
|
||||||
base
|
(syntax (un-plthome-ify 'd)))
|
||||||
(or (current-load-relative-directory)
|
(datum->syntax-object (quote-syntax here) dir stx)))]))
|
||||||
(current-directory)))])
|
|
||||||
(syntax base))]
|
|
||||||
[else ; must be (eq? base 'relative)
|
|
||||||
(local)]))
|
|
||||||
(local)))]))
|
|
||||||
|
|
||||||
;; This is a macro-generating macro that wants to expand
|
;; This is a macro-generating macro that wants to expand
|
||||||
;; expressions used in the generated macro. So it's weird,
|
;; expressions used in the generated macro. So it's weird,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user