make DrRacket syntax coloring use a custom command character (closes #103)

pull/105/head
Matthew Butterick 9 years ago
parent 0cc56ffd3a
commit bdd5282477

@ -7,5 +7,6 @@
(define scribblings '(("scribblings/pollen.scrbl" (multi-page)))) (define scribblings '(("scribblings/pollen.scrbl" (multi-page))))
(define raco-commands '(("pollen" (submod pollen/command raco) "issue Pollen command" #f))) (define raco-commands '(("pollen" (submod pollen/command raco) "issue Pollen command" #f)))
(define compile-omit-paths '("test" "tools" "server-extras" "scribblings/third-tutorial-files")) (define compile-omit-paths '("test" "tools" "server-extras" "scribblings/third-tutorial-files"))
(define test-omit-paths '("test/data" "tools" "server-extras" "scribblings/third-tutorial-files")) ;; it's redundant to test "pollen.scrbl" because it incorporates the other scribble sources by reference
(define test-omit-paths '("test/data" "tools" "server-extras" "scribblings/third-tutorial-files" "scribblings/pollen.scrbl"))
(define module-suffixes '(#"pp" #"pm" #"pmd" #"ptree")) (define module-suffixes '(#"pp" #"pm" #"pmd" #"ptree"))

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require racket/syntax syntax/strip-context) (require racket/syntax syntax/strip-context racket/class)
(require (only-in scribble/reader make-at-reader) pollen/world pollen/project racket/list) (require (only-in scribble/reader make-at-reader) pollen/file pollen/world pollen/project racket/list)
(provide define+provide-reader-in-mode (all-from-out pollen/world)) (provide define+provide-reader-in-mode (all-from-out pollen/world))
@ -58,7 +58,6 @@
'module-language 'module-language
`#(pollen/language-info get-language-info ,reader-here-path)))) ; reader-here-path acts as "top" runtime config `#(pollen/language-info get-language-info ,reader-here-path)))) ; reader-here-path acts as "top" runtime config
(define-syntax-rule (define+provide-reader-in-mode mode) (define-syntax-rule (define+provide-reader-in-mode mode)
(begin (begin
(define reader-mode mode) (define reader-mode mode)
@ -68,10 +67,17 @@
(λ (key default) (λ (key default)
(case key (case key
[(color-lexer) [(color-lexer)
(define make-scribble-inside-lexer2 (define my-make-scribble-inside-lexer
(dynamic-require 'syntax-color/scribble-lexer 'make-scribble-inside-lexer (λ () #f))) (dynamic-require 'syntax-color/scribble-lexer 'make-scribble-inside-lexer (λ () #f)))
(cond [make-scribble-inside-lexer2 (cond [my-make-scribble-inside-lexer
(make-scribble-inside-lexer2 #:command-char #\◊)] (define definitions-frame (object-name in))
(define maybe-source-path (with-handlers ([exn:fail? (λ(exn) #f)])
(send definitions-frame get-filename))) ; will be #f if unsaved file
(define my-command-char (if maybe-source-path
(parameterize ([current-directory (dirname maybe-source-path)])
(world:current-command-char))
world:command-char))
(my-make-scribble-inside-lexer #:command-char my-command-char)]
[else default])] [else default])]
[else default]))) [else default])))
(provide (rename-out [custom-read read] [custom-read-syntax read-syntax]) get-info))) (provide (rename-out [custom-read read] [custom-read-syntax read-syntax]) get-info)))
Loading…
Cancel
Save