emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: backup method


From: Stefan Monnier
Subject: Re: backup method
Date: Tue, 01 Feb 2005 09:09:53 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> Simply writing a file in such a directory would raise the same issue,
> right?  If so, it really has nothing to do with backups.

Agreed.

> I think the fix is to treat files in such directories as precious.
> Not because they really are precious, but because the handling of a
> precious file might avoid the problem.

OK.

> !               (set-default-file-modes ?\700)
> !               ;; Try various temporary names.
> !               ;; This code follows the example of make-temp-file,
> !               ;; but it calls write-region in the appropriate way
> !               ;; for saving the buffer.
> !               (while (condition-case ()
> !                          (progn
> !                            (setq tempname
> !                                  (make-temp-name
> !                                   (expand-file-name "tmp" dir)))
> !                            (write-region (point-min) (point-max)
> !                                          tempname nil  realname
> !                                          buffer-file-truename 'excl)
> !                            nil)
> !                        (file-already-exists t))
> !                 ;; The file was somehow created by someone else between
> !                 ;; `make-temp-name' and `write-region', let's try again.
> !                 nil)

Any reason why you didn't use make-temp-file?


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]