fix a problem that leads to spurious 'file has changed on disk' messages
Before this commit, autosave files would (incorrectly) contribute to the file's last modification time in a way that meant that after an autosave, the warning would start triggering when the file is saved normally original commit: 5751ebe530c9278aa5cad83e9b27205bc7bc0186
This commit is contained in:
parent
29971bb642
commit
779275c204
|
@ -174,26 +174,30 @@
|
|||
(define last-saved-file-time #f)
|
||||
|
||||
(define/augment (after-save-file success?)
|
||||
(define temp-b (box #f))
|
||||
(define filename (get-filename temp-b))
|
||||
|
||||
;; update recently opened file names
|
||||
(let* ([temp-b (box #f)]
|
||||
[filename (get-filename temp-b)])
|
||||
(unless (unbox temp-b)
|
||||
(when filename
|
||||
(handler:add-to-recent filename))))
|
||||
(unless (unbox temp-b)
|
||||
(when filename
|
||||
(handler:add-to-recent filename)))
|
||||
|
||||
;; update last-saved-file-time
|
||||
(when success?
|
||||
(let ([filename (get-filename)])
|
||||
(set! last-saved-file-time
|
||||
(and filename
|
||||
(file-exists? filename)
|
||||
(file-or-directory-modify-seconds filename)))))
|
||||
(unless (doing-autosave?)
|
||||
(unless (unbox temp-b)
|
||||
(when success?
|
||||
(set! last-saved-file-time
|
||||
(and filename
|
||||
(file-exists? filename)
|
||||
(file-or-directory-modify-seconds filename))))))
|
||||
|
||||
(inner (void) after-save-file success?))
|
||||
|
||||
(define/augment (after-load-file success?)
|
||||
(when success?
|
||||
(let ([filename (get-filename)])
|
||||
(define temp-b (box #f))
|
||||
(define filename (get-filename temp-b))
|
||||
(unless (unbox temp-b)
|
||||
(set! last-saved-file-time
|
||||
(and filename
|
||||
(file-exists? filename)
|
||||
|
@ -594,7 +598,9 @@
|
|||
autosave?
|
||||
do-autosave
|
||||
remove-autosave))
|
||||
|
||||
|
||||
(define doing-autosave? (make-parameter #f))
|
||||
|
||||
(define backup-autosave-mixin
|
||||
(mixin (basic<%>) (backup-autosave<%> autosave:autosavable<%>)
|
||||
(inherit is-modified? get-filename save-file)
|
||||
|
@ -666,7 +672,8 @@
|
|||
(when (is-a? this text%)
|
||||
(send this set-file-format orig-format))
|
||||
#f)])
|
||||
(save-file auto-name 'copy #f)
|
||||
(parameterize ([doing-autosave? #t])
|
||||
(save-file auto-name 'copy #f))
|
||||
(when (is-a? this text%)
|
||||
(send this set-file-format orig-format))
|
||||
(when old-auto-name
|
||||
|
|
Loading…
Reference in New Issue
Block a user