GNU bug report logs - #13522
24.2; save-buffer removes edited file under some conditions

Previous Next

Package: emacs;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Tue, 22 Jan 2013 01:49:02 UTC

Severity: normal

Tags: confirmed

Found in versions 25.1, 23.2, 23.1, 24.1, 24.4, 23.4, 24.2, 23.3

Full log


Message #30 received at 13522 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13522 <at> debbugs.gnu.org, vincent <at> vinc17.net
Subject: Re: bug#13522: 24.2;
	save-buffer removes edited file under some conditions
Date: Fri, 25 Jan 2013 03:07:57 -0500
Eli Zaretskii wrote:

> I can't.  Moreover, the recipe says "Type C-c in the terminal to kill
> Emacs", but C-c does not kill Emacs, only C-x C-c does. 

C-c *in the shell* from which Emacs was started in the foreground, not
from in Emacs; ie interrupt it from outside.

Or even: do C-x C-s, and leave the coding prompt unanswered. You will
find the original file missing until you answer, or quit, the coding
question!

Looks like it has been this way since the unicode merge.
basic-save-buffer-2 calls backup-buffer, which may rename the original
file. It then calls write-region. This may call
select-safe-coding-system, so there can be an arbitrarily long interval
between the original file being renamed to the backup, and the new file
being written.

If you interrupt the coding prompt with C-g, the unwind-protect in
basic-save-buffer-2 puts back the original file. I suppose the problem
could maybe be papered over by adding something equivalent to
kill-emacs-hook, but it's still very far from ideal.

Maybe the right solution is to have the select-safe-coding-system check
in basic-save-buffer-2 before backup-buffer, then pass the resulting
coding system to write-region somehow so it does not need to query
again.




This bug report was last modified 3 years and 46 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.