christophe.scholliers
2018-4-8 11:10:47

@christophe.scholliers has joined the channel


ben
2018-4-9 00:14:45

scribble problem: I want something like codeblock, but that typesets the contents of a file. The attachment here has a macroracketfile that gets close, but doesn’t get links right (i.e. if you unzip and run make, the first + in main.html isn’t blue). Any ideas on how to get it working?


blerner
2018-4-9 00:20:20

I seem to have the following macro in my Fundies utilities file; it might help? (define-syntax (scheme-from-file stx) (syntax-case stx () [(_ fname #:start start #:end end) (let* ([l (extract-from-file (syntax-e #'fname) (syntax-e #'start) (if (eq? (syntax-e #'end) 'same) (syntax-e #'start) (syntax-e #'end)))]) #`(scr:codeblock #:indent 0 #,(datum->syntax stx (car l)) #,@(cdr l)))]))


blerner
2018-4-9 00:21:03

with, evidently, this as a helper: (define-for-syntax (extract-from-file filename start end) (parameterize ([read-accept-reader #t]) (call-with-input-file filename (λ (port) (let loop ([in? #f]) (let ([l (read-line port 'any)]) (cond [(eof-object? l) '()] [(and (not in?) (regexp-match start l) (regexp-match end l)) (list l "\n")] [(and (not in?) (regexp-match start l)) (check-tab l filename) (list* l "\n" (loop #t))] [(and in? (regexp-match end l)) (check-tab l filename) (list l "\n")] [in? (check-tab l filename) (list* l "\n" (loop #t))] [else (loop #f)])))))))


blerner
2018-4-9 00:21:45

(check-tab is boring, and just complains if there are tabs in the file. you could simplify that extract-from-file by a lot, I’m guessing)


ben
2018-4-9 01:50:46

Thank you! (Changing my code from (codeblock #,@stuff) to (codeblock #,(datum->syntax stx (car stuff)) #,@(cdr stuff)) fixed it)


felix
2018-4-9 03:19:11

@felix has joined the channel


lexi.lambda
2018-4-9 03:51:20

@mflatt @michael.ballantyne I think I may have found a case in which implementing syntax parameters using phase 1 parameters + local expansion causes my code to work on Racket 6.12 but not Racket 7.



lexi.lambda
2018-4-9 04:21:29

Full disclosure, I only wrote the program that Racket 7 breaks tonight, so it’s not like I have existing code that was broken by the change. It seems unlikely much code that depends on the old behavior exists, but I’d still like to be able to use syntax-parameterize here, so if it isn’t valid as a bug report, consider it a feature request.