emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

saving a buffer when the file has been modified on disk


From: Sam Steingold
Subject: saving a buffer when the file has been modified on disk
Date: Thu, 01 Oct 2009 14:19:59 -0400
User-agent: Thunderbird 2.0.0.22 (X11/20090625)

Hi
When I try to save a file which has been modified on disk by another program, basic-save-buffer asks "<file> has changed since visited or saved. Save anyway?". The most useful behavior would be to offer to merge the file on disk with my current buffer, but I am not offered such an option. Moreover, both emerge and ediff (why are there two such packages?! shouldn't emerge be removed?) offer only file+file and buffer+buffer merges, not buffer+file merges (this is, of course, only a minor nuisance, one can easily create a temp buffer, insert the file there and merge buffers).

Proposal:
1. add ediff-merge-buffer-with-file which would merge the current buffer with the file on disk if the latter has been modified.
2. remove diff-buffer-with-file.

3a. basic-save-buffer should ask "<file> has changed since visited or saved. Merge the changes?" and, if the user agrees, call, ediff-merge-buffer-with-file before proceeding to save the buffer. The current "abort" behavior will still be available via C-g

OR

3b. basic-save-buffer should recommend ediff-merge-buffer-with-file:

--- files.el    25 Sep 2009 22:04:10 -0000      1.1086
+++ files.el    1 Oct 2009 18:18:16 -0000
@@ -4194,7 +4206,7 @@ Before and after saving the buffer, this
              (yes-or-no-p
               (format "%s has changed since visited or saved.  Save anyway? "
                       (file-name-nondirectory buffer-file-name)))
-             (error "Save not confirmed"))
+ (error "Save not confirmed; use ediff-merge-buffer-with-file to merge the changes"))
          (save-restriction
            (widen)
            (save-excursion

Sam.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]