|
|
|
@ -4,7 +4,6 @@
|
|
|
|
|
racket/class
|
|
|
|
|
racket/string
|
|
|
|
|
racket/runtime-path
|
|
|
|
|
racket/match
|
|
|
|
|
setup/getinfo
|
|
|
|
|
sugar/file
|
|
|
|
|
(for-syntax racket/base)
|
|
|
|
@ -19,14 +18,15 @@
|
|
|
|
|
((if (syntax? source-name) syntax-source values) source-name))
|
|
|
|
|
|
|
|
|
|
(define (infer-parser-mode reader-mode reader-here-path)
|
|
|
|
|
(match reader-mode
|
|
|
|
|
[(== default-mode-auto eq?)
|
|
|
|
|
(match (cond [(get-ext reader-here-path) => string->symbol])
|
|
|
|
|
[(== (setup:pagetree-source-ext) eq?) default-mode-pagetree]
|
|
|
|
|
[(== (setup:markup-source-ext) eq?) default-mode-markup]
|
|
|
|
|
[(== (setup:markdown-source-ext) eq?) default-mode-markdown]
|
|
|
|
|
[_ default-mode-preproc])]
|
|
|
|
|
[_ reader-mode]))
|
|
|
|
|
(cond
|
|
|
|
|
[(eq? reader-mode default-mode-auto)
|
|
|
|
|
(let ([val (cond [(get-ext reader-here-path) => string->symbol])])
|
|
|
|
|
(cond
|
|
|
|
|
[(eq? val (setup:pagetree-source-ext)) default-mode-pagetree]
|
|
|
|
|
[(eq? val (setup:markup-source-ext)) default-mode-markup]
|
|
|
|
|
[(eq? val (setup:markdown-source-ext)) default-mode-markdown]
|
|
|
|
|
[else default-mode-preproc]))]
|
|
|
|
|
[else reader-mode]))
|
|
|
|
|
|
|
|
|
|
(define (custom-read p) (syntax->datum (custom-read-syntax (object-name p) p)))
|
|
|
|
|
|
|
|
|
@ -88,12 +88,16 @@
|
|
|
|
|
(hash-ref! command-char-cache maybe-source-path (λ () (setup:command-char maybe-source-path))))
|
|
|
|
|
(case key
|
|
|
|
|
[(color-lexer)
|
|
|
|
|
(match (dynamic-require 'syntax-color/scribble-lexer 'make-scribble-inside-lexer (λ () #false))
|
|
|
|
|
[(? procedure? make-lexer) (make-lexer #:command-char my-command-char)]
|
|
|
|
|
[_ default])]
|
|
|
|
|
(define maybe-lexer
|
|
|
|
|
(dynamic-require 'syntax-color/scribble-lexer 'make-scribble-inside-lexer (λ () #false)))
|
|
|
|
|
(cond
|
|
|
|
|
[(procedure? maybe-lexer) (maybe-lexer #:command-char my-command-char)]
|
|
|
|
|
[else default])]
|
|
|
|
|
[(drracket:toolbar-buttons)
|
|
|
|
|
(match (dynamic-require 'pollen/private/drracket-buttons 'make-drracket-buttons (λ () #false))
|
|
|
|
|
[(? procedure? make-buttons) (make-buttons my-command-char)])])]
|
|
|
|
|
(define maybe-button-maker
|
|
|
|
|
(dynamic-require 'pollen/private/drracket-buttons 'make-drracket-buttons (λ () #false)))
|
|
|
|
|
(when (procedure? maybe-button-maker)
|
|
|
|
|
(maybe-button-maker my-command-char))])]
|
|
|
|
|
[(drracket:indentation)
|
|
|
|
|
(λ (text pos)
|
|
|
|
|
(define line-idx (send text position-line pos))
|
|
|
|
@ -103,23 +107,23 @@
|
|
|
|
|
(or
|
|
|
|
|
(for/first ([pos (in-range line-start-pos line-end-pos)]
|
|
|
|
|
#:unless (char-blank? (send text get-character pos)))
|
|
|
|
|
pos)
|
|
|
|
|
pos)
|
|
|
|
|
line-start-pos))
|
|
|
|
|
(- first-vis-pos line-start-pos))]
|
|
|
|
|
[(drracket:default-filters)
|
|
|
|
|
;; derive this from `module-suffixes` entry in main info.rkt file
|
|
|
|
|
(define module-suffixes ((get-info/full info-dir) 'module-suffixes))
|
|
|
|
|
(define filter-strings (for/list ([suffix (in-list module-suffixes)])
|
|
|
|
|
(format "*.~a" suffix)))
|
|
|
|
|
(format "*.~a" suffix)))
|
|
|
|
|
(list (list "Pollen sources" (string-join filter-strings ";")))]
|
|
|
|
|
[(drracket:default-extension)
|
|
|
|
|
(symbol->string
|
|
|
|
|
(match mode
|
|
|
|
|
[(== default-mode-auto eq?) (setup:preproc-source-ext)]
|
|
|
|
|
[(== default-mode-preproc eq?) (setup:preproc-source-ext)]
|
|
|
|
|
[(== default-mode-markdown eq?) (setup:markdown-source-ext)]
|
|
|
|
|
[(== default-mode-markup eq?) (setup:markup-source-ext)]
|
|
|
|
|
[(== default-mode-pagetree eq?) (setup:pagetree-source-ext)]))]
|
|
|
|
|
(cond
|
|
|
|
|
[(eq? mode default-mode-auto) (setup:preproc-source-ext)]
|
|
|
|
|
[(eq? mode default-mode-preproc) (setup:preproc-source-ext)]
|
|
|
|
|
[(eq? mode default-mode-markdown) (setup:markdown-source-ext)]
|
|
|
|
|
[(eq? mode default-mode-markup) (setup:markup-source-ext)]
|
|
|
|
|
[(eq? mode default-mode-pagetree) (setup:pagetree-source-ext)]))]
|
|
|
|
|
[else default])))
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (reader-module-begin mode . _)
|
|
|
|
|