Hi,

When you edit and save a writable file in a non writable dir, and you
use `backup-by-copying' to nil (the default), backup-buffer fails to
make a backup in the place you define with `backup-directory-alist'
(because you cannot move files that are in a not writable dir), so it
copies it to file "~/%backup%~".

[ I know this is not very usual, but I have to edit some conf files in
  such directories and I got this ~/%backup%~ file around all the time ]

IMHO this one-liner patch solves the problem, by detecting this
situation as one of the cases where a copy should be used to backup
the file. You may want to review and/or apply it.

Regards
juanleon

--- files.el.ori        Thu Mar 10 09:29:31 2005
+++ files.el    Thu Mar 10 10:02:00 2005
@@ -2686,6 +2686,7 @@
                              backup-by-copying
                              ;; Don't rename a suid or sgid file.
                              (and modes (< 0 (logand modes #o6000)))
+                             (not (file-writable-p (file-name-directory 
real-file-name)))
                              (and backup-by-copying-when-linked
                                   (> (file-nlinks real-file-name) 1))
                              (and (or backup-by-copying-when-mismatch


_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to