diff options
author | IOhannes m zmölnig <zmoelnig@umlautQ.umlaeute.mur.at> | 2016-05-17 12:21:04 +0200 |
---|---|---|
committer | IOhannes m zmölnig <zmoelnig@umlautQ.umlaeute.mur.at> | 2016-05-17 12:21:04 +0200 |
commit | 248790aca5d5b6dc9a8edeea1abed0195ac1338e (patch) | |
tree | c473c68af2ab5d091d7035fa1b539cbaf2ac2e4f /autosave.scm | |
parent | 110d59c341b8c50c04f30d90e85e9b8f6f329a0e (diff) |
Imported Upstream version 16.5~dfsg
Diffstat (limited to 'autosave.scm')
-rw-r--r-- | autosave.scm | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/autosave.scm b/autosave.scm index f8c5aeb..2d78052 100644 --- a/autosave.scm +++ b/autosave.scm @@ -20,20 +20,9 @@ "") "#" (short-file-name snd) "#")) - (define (unsaved-edits snd) - (or (sound-property 'auto-save snd) - 0)) - (define (clear-unsaved-edits snd) (set! (sound-property 'auto-save snd) 0)) - (define (increment-unsaved-edits snd) - (set! (sound-property 'auto-save snd) (+ 1 (sound-property 'auto-save snd)))) - - (define (upon-edit snd) - (lambda () - (increment-unsaved-edits snd))) - (define (auto-save-open-func snd) (let ((temp-file (auto-save-temp-name snd))) (if (and (file-exists? temp-file) @@ -44,7 +33,9 @@ (do ((i 0 (+ 1 i))) ((= i (channels snd))) (if (null? (hook-functions (edit-hook snd i))) - (hook-push (edit-hook snd i) (lambda (hook) (upon-edit (hook 'snd)))))) + (hook-push (edit-hook snd i) (lambda (hook) + (let ((snd (hook 'snd))) + (set! (sound-property 'auto-save snd) (+ 1 (sound-property 'auto-save snd)))))))) (clear-unsaved-edits snd))) (define (auto-save-done snd) @@ -57,14 +48,14 @@ (if auto-saving (begin (for-each (lambda (snd) - (if (> (unsaved-edits snd) 0) + (if (positive? (or (sound-property 'auto-save snd) 0)) (let ((save-name (auto-save-temp-name snd))) (status-report (string-append "auto-saving as " save-name "...") snd) - (in (* 1000 3) (lambda () (status-report "" snd))) + (in 3000 (lambda () (status-report "" snd))) (save-sound-as save-name snd) (clear-unsaved-edits snd)))) (sounds)) - (in (* 1000 auto-save-interval) auto-save-func)))) + (in (floor (* 1000 auto-save-interval)) auto-save-func)))) (if (not (member auto-save-done (hook-functions close-hook))) (begin |