GNU bug report logs - #21612
24.5; Configuration variable to delete auto-save file when intentionally killing buffer

Previous Next

Package: emacs;

Reported by: Marcus <mrok4a <at> gmail.com>

Date: Sat, 3 Oct 2015 16:37:01 UTC

Severity: wishlist

Tags: moreinfo

Found in version 24.5

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: mrok4a <at> gmail.com, "Richard M. Stallman" <rms <at> gnu.org>, 21612 <at> debbugs.gnu.org
Subject: bug#21612: 24.5; Configuration variable to delete auto-save file when intentionally killing buffer
Date: Wed, 18 Aug 2021 14:45:21 +0200
Argh!

I now implemented this...  but then I discovered the
delete-auto-save-files variable, which seems to be providing just what
was requested here, just about.

And it worked in the initial revision:

commit 1ab256cb9997cf15983abc63310cdf32f0533bca
Author:     Roland McGrath <roland <at> gnu.org>
AuthorDate: Mon Jul 15 21:27:11 1991 +0000

    Initial revision

diff --git a/src/buffer.c b/src/buffer.c
--- /dev/null
+++ b/src/buffer.c
@@ -0,0 +678,9 @@
+  /* Delete any auto-save file.  */
+  if (XTYPE (b->auto_save_file_name) == Lisp_String)
+    {
+      Lisp_Object tem;
+      tem = Fsymbol_value (intern ("delete-auto-save-files"));
+      if (! NULL (tem))
+	unlink (XSTRING (b->auto_save_file_name)->data);
+    }
+

But Richard changed this in 2001:

commit 9cf712eb57c0a1fef56487508e89d08c91f98db1
Author:     Richard M. Stallman <rms <at> gnu.org>
AuthorDate: Tue Nov 6 04:48:15 2001 +0000

    (Fkill_buffer): Don't delete auto save file if buffer is modified.

diff --git a/src/buffer.c b/src/buffer.c
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1370,11 +1370,13 @@
-  /* Delete any auto-save file, if we saved it in this session.  */
+  /* Delete any auto-save file, if we saved it in this session.
+     But not if the buffer is modified.  */
   if (STRINGP (b->auto_save_file_name)
       && b->auto_save_modified != 0
-      && BUF_SAVE_MODIFF (b) < b->auto_save_modified)
+      && BUF_SAVE_MODIFF (b) < b->auto_save_modified
+      && BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
     {
       Lisp_Object tem;
       tem = Fsymbol_value (intern ("delete-auto-save-files"));
       if (! NILP (tem))
 	internal_delete_file (b->auto_save_file_name);
     }
 
No now this option is basically pointless (when killing buffers) -- the
only reason we'd want to delete an auto-save file is if the buffer is
modified.  Otherwise there won't be an auto-save file.  (Except when
it's made by a different Emacs, and in that case, we really shouldn't be
deleting it anyway.)

The commit message or the comments don't explain what the reasoning
behind changing the semantics here were.

Richard, do you have any recollection why you made these changes 20
years ago?  They seem to make the delete-auto-save-files variable in a
kill-buffer context pointless.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

Previous Next


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