bugGNU Zile (Zile is Lossy Emacs) - Bugs: bug #34046, Zile overwrites externally changed...

 
 

bug #34046: Zile overwrites externally changed file

Submitter:  Gary V. Vaughan <gary>
Submitted:  Thu 18 Aug 2011 11:05:00 AM UTC
   
 
Category:  None Severity:  3 - Normal
Status:  None Assigned to:  None
Open/Closed:  Open Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 21 Feb 2012 07:19:23 PM UTC, comment #3: 

Thanks very much for the patch.

This sort of thing is fine for Zi, but won't do for Zile, which must behave like Emacs. Emacs notifies the user when the buffer changes. So you have two options: detect file changes more regularly (as Emacs), or rewrite the patch for the Zi branch (in Lua).

Sorry to be awkward, but Zile strives never to behave differently from Emacs.

Reuben Thomas <rrt>
Group administrator
Tue 21 Feb 2012 04:56:28 PM UTC, comment #2: 

A quick solution to this can be seen in my attached patch.
At any time a buffer should be written to disk the modification time of the corresponding file is checked. If a difference occurs, a message is printed in the minibuffer.

I know, that this is probably not the cleanest way to implement this.

(file #25100)

Anonymous
Thu 18 Aug 2011 07:45:26 PM UTC, comment #1: 

Agreed that this should be implemented. I don't propose to do it immediately.

Reuben Thomas <rrt>
Group administrator
Thu 18 Aug 2011 11:05:00 AM UTC, original submission:  

Technically this is a new feature, but since in involves data loss, I think it's important enough to consider to be a bug... same for C and Lua branches:

    $ echo foo > y
    $ zile y
    ^Z
    $ echo bar > y
    $ fg
    xxx^X^S^X^C
    $ cat y
    xxxfoo

Where did the 'bar' go?

With emacs, at the point you press the first 'x' it says:

    y changed on disk, really edit the buffer? (y, n, r, C-h) _

and if you accept by pressing y:

    File on disk will now become a backup file if you save these changes

and then when you actually try to save:

    y has changed since visited or saved. Save anyway? (yes or no)

Dunno if we need to go quite that far, but we definitely need to spot files that have been externally changed before saving over them.

Aside: For zi (at least), I much prefer TextMate's handling of external edits: it quietly updates the buffer with the new contents of the file if the buffer has not been edited yet, or else asks whether to revert to the disk contents, or keep the buffer intact.

Gary V. Vaughan <gary>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #25100:  change_notification.patch added by None (3KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rrt (Posted a comment)
  • -email is unavailable- added by gary (Submitted the item)
  •  

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-02-21 None Attached File- Added change_notification.patch, #25100

    Back to the top

    Powered by Savane 3.13-cf05.
    Corresponding source code