Matthew Butterick 9 years ago
parent c26838cd6c
commit cdc408340c

@ -1,7 +1,7 @@
#lang racket/base
(require racket/syntax syntax/strip-context racket/class)
(require (only-in scribble/reader make-at-reader) pollen/setup "project.rkt" racket/function)
(provide define+provide-reader-in-mode (all-from-out pollen/setup))
(require racket/syntax syntax/strip-context racket/class (for-syntax racket/base racket/syntax))
(require (only-in scribble/reader make-at-reader) "../setup.rkt" "project.rkt" racket/function)
(provide define+provide-reader-in-mode (all-from-out "../setup.rkt"))
(define current-reader-mode (make-parameter #f))
@ -55,7 +55,7 @@
'module-language
`#(pollen/private/language-info get-language-info ,reader-here-path))) ; reader-here-path acts as "top" runtime config
(define (get-info in mod line col pos)
(define (custom-get-info in mod line col pos)
;; DrRacket caches source file information per session,
;; so we can do the same to avoid multiple searches for the command char.
(let ([command-char-cache (make-hash)])
@ -81,7 +81,15 @@
(my-make-drracket-buttons my-command-char)])]
[else default]))))
(define-syntax-rule (define+provide-reader-in-mode mode)
(begin
(define-syntax (define+provide-reader-in-mode stx)
(syntax-case stx ()
[(_ mode)
(with-syntax ([cr (generate-temporary)]
[crs (generate-temporary)]
[cgi (generate-temporary)])
#'(begin
(current-reader-mode mode)
(provide (rename-out [custom-read read] [custom-read-syntax read-syntax]) get-info)))
(define cgi custom-get-info)
(define cr custom-read)
(define crs custom-read-syntax)
(provide (rename-out [cr read][crs read-syntax][cgi get-info]))))]))
Loading…
Cancel
Save