all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* saving a buffer when the file has been modified on disk
@ 2009-10-01 18:19 Sam Steingold
  0 siblings, 0 replies; only message in thread
From: Sam Steingold @ 2009-10-01 18:19 UTC (permalink / raw)
  To: emacs-devel

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.





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-01 18:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-01 18:19 saving a buffer when the file has been modified on disk Sam Steingold

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.