From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#18141: 24.4.50; saving .gz file breaks file coding Date: Wed, 06 Aug 2014 22:45:22 +0300 Message-ID: <83oavxo10t.fsf@gnu.org> References: <9pzjfrwvsl.fsf@fencepost.gnu.org> <83iom5ptwv.fsf@gnu.org> <20140806164316.GK4813@xvii.vinc17.org> <831tstplqs.fsf@gnu.org> <20140806190825.GL4813@xvii.vinc17.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1407354383 14216 80.91.229.3 (6 Aug 2014 19:46:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 6 Aug 2014 19:46:23 +0000 (UTC) Cc: 18141@debbugs.gnu.org, yamaoka@jpl.org To: Vincent Lefevre Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 06 21:46:17 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XF7A8-00052r-IM for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Aug 2014 21:46:16 +0200 Original-Received: from localhost ([::1]:40712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF7A8-0003ES-2a for geb-bug-gnu-emacs@m.gmane.org; Wed, 06 Aug 2014 15:46:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF79z-0003DQ-R5 for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2014 15:46:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XF79u-0002iX-Rj for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2014 15:46:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53844) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XF79u-0002iS-OK for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2014 15:46:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XF79u-0001fr-48 for bug-gnu-emacs@gnu.org; Wed, 06 Aug 2014 15:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Aug 2014 19:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18141 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18141-submit@debbugs.gnu.org id=B18141.14073543216371 (code B ref 18141); Wed, 06 Aug 2014 19:46:02 +0000 Original-Received: (at 18141) by debbugs.gnu.org; 6 Aug 2014 19:45:21 +0000 Original-Received: from localhost ([127.0.0.1]:60787 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XF79E-0001eg-9O for submit@debbugs.gnu.org; Wed, 06 Aug 2014 15:45:20 -0400 Original-Received: from mtaout24.012.net.il ([80.179.55.180]:38761) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XF79A-0001eM-Lu for 18141@debbugs.gnu.org; Wed, 06 Aug 2014 15:45:18 -0400 Original-Received: from conversion-daemon.mtaout24.012.net.il by mtaout24.012.net.il (HyperSendmail v2007.08) id <0N9W00M00H47N100@mtaout24.012.net.il> for 18141@debbugs.gnu.org; Wed, 06 Aug 2014 22:40:59 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout24.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N9W00AVRHCBB450@mtaout24.012.net.il>; Wed, 06 Aug 2014 22:40:59 +0300 (IDT) In-reply-to: <20140806190825.GL4813@xvii.vinc17.org> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92219 Archived-At: > Date: Wed, 6 Aug 2014 21:08:25 +0200 > From: Vincent Lefevre > Cc: rgm@gnu.org, 18141@debbugs.gnu.org, yamaoka@jpl.org > > On 2014-08-06 20:32:27 +0300, Eli Zaretskii wrote: > > > (Emacs seems to be confused on files that have several encodings, > > > such as mailboxes) > > > > It does? I didn't see that since Emacs 23.1 at the least. > > Things may have been fixed. I don't remember exactly. There's also > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13505 that was fixed > not so long ago. So I think you are talking about a problem that largely doesn't exist, perhaps at all. > > > and I sometimes hit Ctrl-C in the terminal (from which Emacs was > > > started) to discard any change. > > > > Then don't do that, if it hurts. > > Ctrl-C is standard to interrupt a foreground process. If the process > can't handle that, it should trap SIGINT. Ditto for SIGQUIT. But > processes must handle SIGHUP and SIGTERM gracefully, ditto for various > errors, like an X server crash. Be that as it may, it is still unjustified to use such drastic measures where safer ones are available. > > C-g or M-~ or C-/ in Emacs will discard changes (in different > > scenarios) without any adverse effects, as will killing the buffer > > that visits the modified file. Why brutally abort Emacs by a signal, > > when Emacs gives you better ways to do that? > > I haven't see any better way. My goal is to quit Emacs, discarding any > change. My point is that you can easily discard changes without quitting Emacs. If you do, the problem you raised would not have existed. > Ctrl-C in the terminal is the fastest way to do that. I don't see why the speed is relevant here. > > > And that's not OK to only leave the backup file, > > > since it can be removed or overwritten pretty quickly, before > > > I notice that the original file is gone. > > > > Removed or overwritten by whom or what? > > By me. I sometimes get rid of all the backup files because I don't need > them, since the original file should have been kept. Again, then don't do that. Disk space is cheap nowadays, whereas data in our files is precious. > A backup file is overwritten if I edit a file of the same name in > another directory ??? Then your make-backup-file function (or whatever other method you use to put backup files in a special directory) needs to be improved, so that files in different directories don't overwrite each other's backups. Really this sounds more and more like a series of problems with your personal configuration and setup, which is unlikely to be seen on someone else's machine. I see no reason to make non-trivial changes to Emacs due problems that might not be rare with your peculiar setup, but are otherwise quite unlikely. > > > But why isn't the backup done just before the file is actually > > > written? > > > > It _is_ done "just before", see basic-save-buffer-2. > > No, not without r111638: the backup is done before the user is asked > to the provide an encoding, thus not just before the file is written. Please see the code, which speaks for itself. basic-save-buffer-2 calls backup-buffer and after that calls write-region, which writes the new contents. Before r111638, the prompt to select a suitable encoding was issued from inside write-region. After r111638, the prompt is issued before backing up the file. That's all the difference introduced by r111638. There's still a window of opportunity between backing up and writing the new contents; if Emacs is killed during that window, you get your disappearing file again. IOW, the window didn;t disappear, it just got smaller in those rare cases where Emacs needs to ask the user about encoding.