GNU bug report logs - #3702
Emacs fails to respect the intent in `C-u C-u C-x C-s' of making a backup

Previous Next

Package: emacs;

Reported by: Taylor R Campbell <campbell <at> mumble.net>

Date: Sun, 28 Jun 2009 18:20:03 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3702 in the body.
You can then email your comments to 3702 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#3702; Package emacs. (Sun, 28 Jun 2009 18:20:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Taylor R Campbell <campbell <at> mumble.net>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 28 Jun 2009 18:20:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Taylor R Campbell <campbell <at> mumble.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Emacs fails to respect the intent in `C-u C-u C-x C-s' of making a backup
Date: Sun, 28 Jun 2009 14:13:16 -0400
Often, when saving a file, I want to make a backup.  The only way I
know to express this intent is `C-u C-u C-x C-s'.  When I type `C-u
C-u C-x C-s', I mean to tell Emacs:  `I want you to make a backup and
then save this file.'  The documentation for the `save-buffer' command
says:

   Prefixed by two C-u's,
    unconditionally makes the previous version into a backup file.
    ^^^^^^^^^^^^^^^
Unfortunately, Emacs fails to respect my intent in many circumstances.
First, I set `version-control' to t in order to keep numbered backups.
Then in order to make backups in directories such as /tmp, I set
`backup-enable-predicate' to be a function that always returns t.
Next, in order to make backups when `vc' is involved, I set
`vc-make-backup-files' to t, which confused me because it didn't take
effect immediately -- I had to reload all my buffers before it did.
This is because some vc hook set another variable, `backup-inhibited',
when I first loaded those buffers.

There are plenty of other documented ways for arbitrary modes to
interfere with my intent when I type `C-u C-u' -- there are several
hooks that are run during `save-buffer' before `backup-buffer' and
conditions under which backups will be made.  This contradicts the
documentation of `save-buffer' which explicitly says that `C-u C-u'
means a backup will be made *unconditionally*.  I don't mind that
there may be various heuristics for choosing whether to make a backup
file when the user has not indicated a preference either way (by
typing `C-u 0' or `C-u C-u' or whatnot), but it is very frustrating
when the documentation says `unconditionally' and the implementation
has many documented ways to interfere and add conditions.  Of course,
the documentation could simply omit the word `unconditionally', but I
don't want that either -- I want it really to be unconditional (as far
as the documented hooks in Emacs go; of course someone could redefine
`save-buffer', but it's the documented hooks and conditions such as
`backup-inhibited' that bother me).

I am using

GNU Emacs 22.2.1 (i386-apple-darwin8.11.1, GTK+ Version 2.10.13) of 2008-07-06 on Oberon.local.

In my .emacs file, relevant to backups, I have

(defun always-backup (filename) filename t)
(setq-default backup-enable-predicate 'always-backup)
(setq-default version-control t)
(setq-default vc-make-backup-files t)
(setq-default backup-inhibited nil)
(setq-default make-backup-files t)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3702; Package emacs. (Sat, 18 Jun 2016 03:38:02 GMT) Full text and rfc822 format available.

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

From: Andrew Hyatt <ahyatt <at> gmail.com>
To: Taylor R Campbell <campbell <at> mumble.net>
Cc: 3702 <at> debbugs.gnu.org
Subject: Re: bug#3702: Emacs fails to respect the intent in `C-u C-u C-x C-s'
 of making a backup
Date: Fri, 17 Jun 2016 23:37:28 -0400
Sorry for the late reply on this one.  This problem still exists in
Emacs 25.  I agree that the current behavior doesn't match up with the
documentation.

This probably is fixable by adding another free variable set by
save-buffer and read in various functions, but there's a lot of those
kind of variables already - the logic here, IMHO, could use a rewrite to
make the interactions clear.  Maybe someone familiar with this code
might give their opinion.

Taylor R Campbell <campbell <at> mumble.net> writes:

> Often, when saving a file, I want to make a backup.  The only way I
> know to express this intent is `C-u C-u C-x C-s'.  When I type `C-u
> C-u C-x C-s', I mean to tell Emacs:  `I want you to make a backup and
> then save this file.'  The documentation for the `save-buffer' command
> says:
>
>    Prefixed by two C-u's,
>     unconditionally makes the previous version into a backup file.
>     ^^^^^^^^^^^^^^^
> Unfortunately, Emacs fails to respect my intent in many circumstances.
> First, I set `version-control' to t in order to keep numbered backups.
> Then in order to make backups in directories such as /tmp, I set
> `backup-enable-predicate' to be a function that always returns t.
> Next, in order to make backups when `vc' is involved, I set
> `vc-make-backup-files' to t, which confused me because it didn't take
> effect immediately -- I had to reload all my buffers before it did.
> This is because some vc hook set another variable, `backup-inhibited',
> when I first loaded those buffers.
>
> There are plenty of other documented ways for arbitrary modes to
> interfere with my intent when I type `C-u C-u' -- there are several
> hooks that are run during `save-buffer' before `backup-buffer' and
> conditions under which backups will be made.  This contradicts the
> documentation of `save-buffer' which explicitly says that `C-u C-u'
> means a backup will be made *unconditionally*.  I don't mind that
> there may be various heuristics for choosing whether to make a backup
> file when the user has not indicated a preference either way (by
> typing `C-u 0' or `C-u C-u' or whatnot), but it is very frustrating
> when the documentation says `unconditionally' and the implementation
> has many documented ways to interfere and add conditions.  Of course,
> the documentation could simply omit the word `unconditionally', but I
> don't want that either -- I want it really to be unconditional (as far
> as the documented hooks in Emacs go; of course someone could redefine
> `save-buffer', but it's the documented hooks and conditions such as
> `backup-inhibited' that bother me).
>
> I am using
>
> GNU Emacs 22.2.1 (i386-apple-darwin8.11.1, GTK+ Version 2.10.13) of 2008-07-06 on Oberon.local.
>
> In my .emacs file, relevant to backups, I have
>
> (defun always-backup (filename) filename t)
> (setq-default backup-enable-predicate 'always-backup)
> (setq-default version-control t)
> (setq-default vc-make-backup-files t)
> (setq-default backup-inhibited nil)
> (setq-default make-backup-files t)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#3702; Package emacs. (Sat, 18 Jun 2016 08:14:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrew Hyatt <ahyatt <at> gmail.com>
Cc: campbell <at> mumble.net, 3702 <at> debbugs.gnu.org
Subject: Re: bug#3702: Emacs fails to respect the intent in `C-u C-u C-x C-s'
 of making a backup
Date: Sat, 18 Jun 2016 11:14:34 +0300
> From: Andrew Hyatt <ahyatt <at> gmail.com>
> Date: Fri, 17 Jun 2016 23:37:28 -0400
> Cc: 3702 <at> debbugs.gnu.org
> 
> 
> Sorry for the late reply on this one.  This problem still exists in
> Emacs 25.  I agree that the current behavior doesn't match up with the
> documentation.
> 
> This probably is fixable by adding another free variable set by
> save-buffer and read in various functions, but there's a lot of those
> kind of variables already - the logic here, IMHO, could use a rewrite to
> make the interactions clear.  Maybe someone familiar with this code
> might give their opinion.

It sounds like this report boils down to interpreting the single word
"unconditionally" in the doc string of save-buffer.  All the rest is
actually a request for a feature that never existed in Emacs.  (FWIW,
I don't object to adding such a feature, if someone submits patches to
that effect.)




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 09 Jul 2016 11:20:01 GMT) Full text and rfc822 format available.

Notification sent to Taylor R Campbell <campbell <at> mumble.net>:
bug acknowledged by developer. (Sat, 09 Jul 2016 11:20:02 GMT) Full text and rfc822 format available.

Message #16 received at 3702-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Andrew Hyatt <ahyatt <at> gmail.com>
Cc: 3702-done <at> debbugs.gnu.org
Subject: Re: bug#3702: Emacs fails to respect the intent in `C-u C-u C-x C-s'
 of making a backup
Date: Sat, 09 Jul 2016 14:19:08 +0300
> From: Andrew Hyatt <ahyatt <at> gmail.com>
> Date: Sat, 25 Jun 2016 23:22:42 -0400
> 
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> >> From: Andrew Hyatt <ahyatt <at> gmail.com>
> >> Date: Fri, 17 Jun 2016 23:37:28 -0400
> >> Cc: 3702 <at> debbugs.gnu.org
> >> 
> >> 
> >> Sorry for the late reply on this one.  This problem still exists in
> >> Emacs 25.  I agree that the current behavior doesn't match up with the
> >> documentation.
> >> 
> >> This probably is fixable by adding another free variable set by
> >> save-buffer and read in various functions, but there's a lot of those
> >> kind of variables already - the logic here, IMHO, could use a rewrite to
> >> make the interactions clear.  Maybe someone familiar with this code
> >> might give their opinion.
> >
> > It sounds like this report boils down to interpreting the single word
> > "unconditionally" in the doc string of save-buffer.  All the rest is
> > actually a request for a feature that never existed in Emacs.  (FWIW,
> > I don't object to adding such a feature, if someone submits patches to
> > that effect.)
> 
> Maybe the solution then is just to change the wording in the
> documentation?  But it might take someone who is very familiar with the
> various exceptions to craft the new wording.

OK, I modified the doc string to the above effect on the emacs-25
branch, and I'm marking this bug done.

Thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 06 Aug 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 313 days ago.

Previous Next


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