Closed shhyou closed 5 months ago
It looks to me like the right change here is to simply catch and discard any errors that happen while saving due to the tab switch. That is, the diff below. Does this seem right to you?
$ git diff
diff --git a/drracket/drracket/private/unit.rkt b/drracket/drracket/private/unit.rkt
index a41942cc..059ac15a 100644
--- a/drracket/drracket/private/unit.rkt
+++ b/drracket/drracket/private/unit.rkt
@@ -3001,7 +3001,13 @@
(let/ec k
(for ([tab (in-list (get-unsaved-candidate-tabs #f))])
(parameterize ([editor:silent-cancel-on-save-file-out-of-date? #t])
- (unless (send (send tab get-defs) save-file #f 'same #f)
+ (unless (with-handlers ([exn:fail? (λ (x) #t)])
+ ;; catch errors during saving and discard them so
+ ;; that we don't end up in an infinite loop of errors.
+ ;; when this happens, the autosave will probably also
+ ;; error, which will give the user some information
+ ;; about what's going on here.
+ (send (send tab get-defs) save-file #f 'same #f))
(k (void))))))
(update-tabs-labels))
That seems good. After the change, no error shows up and the file is not saved until I explicitly press cmd-s or click the save icon.
Yeah, and you get the nice error message when you try to explicitly save and you do see the diamond in the tab. So hopefully folks won't get too confused.
Thanks!
Is this fix going to be a part of 8.12?
This is an old bug and while I feel prettt good about the fix I would feel even better if we have a release cycle. This part of drr is hard to get right.
On Thu, Jan 11, 2024 at 4:07 PM sorawee @.***> wrote:
Is this fix going to be a part of 8.12?
— Reply to this email directly, view it on GitHub https://github.com/racket/drracket/issues/658#issuecomment-1888045433, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADBNMGH6KBSKXJBIGBXJVDYOBPCXAVCNFSM6AAAAABBWRKFYOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBYGA2DKNBTGM . You are receiving this because you modified the open/close state.Message ID: @.***>
To be fair, continuing users probably won't exercise that code path for otherwise this bug would have been reported. I noticed this when interacting with new DrRacket users.
The following steps trigger a continuous error in DrRacket.
Steps to reproduce:
A/f.rkt
A
toB
.f.rkt
in DrRacket and switch to a different tab.Expected behavior: I don't know. Maybe a different error message and bringing up the "Save as..." dialog?