Autosaving when Scribble buttons are clicked
This commit is contained in:
parent
7190d423f7
commit
bd14fbb4ee
|
@ -24,7 +24,9 @@
|
||||||
(λ (drs-frame)
|
(λ (drs-frame)
|
||||||
(let* ([t (send drs-frame get-definitions-text)]
|
(let* ([t (send drs-frame get-definitions-text)]
|
||||||
[fn (send t get-filename)])
|
[fn (send t get-filename)])
|
||||||
(if (and fn (not (send t is-modified?)))
|
(if fn
|
||||||
|
(begin
|
||||||
|
(send t save-file fn)
|
||||||
(let-values ([(p) (open-output-string)]
|
(let-values ([(p) (open-output-string)]
|
||||||
[(base name dir?) (split-path fn)])
|
[(base name dir?) (split-path fn)])
|
||||||
(parameterize ([current-namespace (make-base-namespace)]
|
(parameterize ([current-namespace (make-base-namespace)]
|
||||||
|
@ -46,8 +48,8 @@
|
||||||
(system (format "open ~s" (path->string (path-replace-suffix fn suffix))))]))
|
(system (format "open ~s" (path->string (path-replace-suffix fn suffix))))]))
|
||||||
(let ([s (get-output-string p)])
|
(let ([s (get-output-string p)])
|
||||||
(unless (equal? s "")
|
(unless (equal? s "")
|
||||||
(message-box "Scribble" s drs-frame))))
|
(message-box "Scribble" s drs-frame)))))
|
||||||
(message-box "Not Named" "Cannot render unsaved file"))))))
|
(message-box "Scribble" "Cannot render buffer without filename"))))))
|
||||||
|
|
||||||
(define drracket-buttons
|
(define drracket-buttons
|
||||||
(let ([html-button
|
(let ([html-button
|
||||||
|
|
Loading…
Reference in New Issue
Block a user