better behavior with unsaved DrRacket files

main
Matthew Butterick 5 years ago
parent 03d2c721a7
commit 343235335f

@ -74,19 +74,19 @@
[else (error "Unknown platform. Don't know how to view PDF.")]))
(void (system (format open-string pdf-path)))))
(define (make-pdf [pdf-path #false])
(define (make-pdf [the-pdf-path #false])
(with-logging-to-port
(current-output-port)
(λ () (with-logging-to-port
(current-output-port)
(λ () (render-pdf DOC pdf-path))
(λ () (render-pdf DOC the-pdf-path))
#:logger quadwriter-logger
'debug))
#:logger quad-logger
'debug))
(module+ pdf
(define pdf (make-pdf))
(define pdf (make-pdf pdf-path))
(provide pdf))
(module+ main

@ -213,10 +213,14 @@
#:replace any/c
#:compress any/c) . ->* . (or/c void? bytes?))
(define base-dir (match base-dir-arg
[#false (current-directory)]
[path (define-values (dir name _) (split-path path))
dir]))
(match-define-values (base-dir _ _) (split-path
(match base-dir-arg
[#false (current-directory)]
;; for reasons unclear, DrRacket sometimes sneaks
;; an "unsaved editor" into this arg, despite efforts to prevent
;; probably
["unsaved editor" pdf-path-arg]
[path path])))
(define pdf-path (setup-pdf-path pdf-path-arg))
(unless replace-existing-file?

Loading…
Cancel
Save