When file is written for the first time, mark the buffer as having
authorChris Hanson <org/chris-hanson/cph>
Fri, 6 Jul 2001 21:14:38 +0000 (21:14 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 6 Jul 2001 21:14:38 +0000 (21:14 +0000)
been backed up.

v7/src/edwin/fileio.scm

index a4c6ad78bb6a7cc7189dd581846507dd5db00796..c6b2ac988edb7b641a62537edd97fde762f28a8e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: fileio.scm,v 1.154 2001/05/10 18:22:31 cph Exp $
+;;; $Id: fileio.scm,v 1.155 2001/07/06 21:14:38 cph Exp $
 ;;;
 ;;; Copyright (c) 1986, 1989-2001 Massachusetts Institute of Technology
 ;;;
@@ -503,7 +503,8 @@ Otherwise, a message is written both before and after long file writes."
 \f
 (define (write-buffer-interactive buffer backup-mode)
   (let ((pathname (buffer-pathname buffer)))
-    (let ((writeable? (file-writeable? pathname)))
+    (let ((writeable? (file-writeable? pathname))
+         (exists? (file-exists? pathname)))
       (if (or writeable?
              (prompt-for-yes-or-no?
               (string-append "File "
@@ -513,9 +514,11 @@ Otherwise, a message is written both before and after long file writes."
               "Attempt to save to a file which you aren't allowed to write"))
          (begin
            (if (not (or (verify-visited-file-modification-time? buffer)
-                        (not (file-exists? pathname))
+                        (not exists?)
                         (prompt-for-yes-or-no?
-                         "Disk file has changed since visited or saved.  Save anyway")))
+                         (string-append
+                          "Disk file has changed since visited or saved."
+                          "  Save anyway"))))
                (editor-error "Save not confirmed"))
            (let ((modes (backup-buffer! buffer pathname backup-mode)))
              (require-newline buffer)
@@ -564,6 +567,9 @@ Otherwise, a message is written both before and after long file writes."
                               (os/set-file-modes-writeable! pathname)
                               (set! modes m)))))
                     (write-buffer buffer)))
+             (if (and (not exists?)
+                      (file-exists? pathname))
+                 (set-buffer-backed-up?! buffer #t))
              (if modes
                  (catch-file-errors
                   (lambda (condition) condition unspecific)