Subject: Re: bug#35497: [PATCH] Don't rewrite buffer contents after saving by rename

From: Michael Albinus <[email-masked]>
Date: Tue, 30 Apr 2019 09:18:18 +0200

Jonathan Tomer <[email-masked]> writes:

Hi Jonathan,

Thanks for the patch.

> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -340,6 +340,13 @@ longer.
>  ** Multicolor fonts such as "Noto Color Emoji" can be displayed on
>  Emacs configured with Cairo drawing and linked with cairo >= 1.16.0.
>
> +---
> +** The file-precious-flag is now respected correctly.
> +A bug previously caused files to be saved twice when
> +`file-precious-flag' or `break-hardlinks-on-save' were specified: once
> +by renaming a temporary file to the destination name, and then again
> +by truncating and rewriting the file, which is exactly what
> +`file-precious-flag' is supposed to avoid.
>  
>  * Editing Changes in Emacs 27.1

We don't describe bug fixes in etc/NEWS.

> +(ert-deftest files-tests-dont-rewrite-precious-files ()
> +  "Test that `file-precious-flag' forces files to be saved by
> +renaming only, rather than modified in-place."

I haven't checked the situation with Tramp. It cares also for
file-precious-flag, bug I don't remember whether it behaves as strict as
you have tested here. Do you want to write a Tramp test for this? It
would fit into tramp-tests.el.

Best regards, Michael.