better behavior with unsaved DrRacket files

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

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

@ -213,10 +213,14 @@
#:replace any/c #:replace any/c
#:compress any/c) . ->* . (or/c void? bytes?)) #:compress any/c) . ->* . (or/c void? bytes?))
(define base-dir (match base-dir-arg (match-define-values (base-dir _ _) (split-path
[#false (current-directory)] (match base-dir-arg
[path (define-values (dir name _) (split-path path)) [#false (current-directory)]
dir])) ;; 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)) (define pdf-path (setup-pdf-path pdf-path-arg))
(unless replace-existing-file? (unless replace-existing-file?

Loading…
Cancel
Save