bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#44303: 28.0.50; json-pretty-print-buffer creates spurious lock file


From: Eli Zaretskii
Subject: bug#44303: 28.0.50; json-pretty-print-buffer creates spurious lock file
Date: Fri, 30 Oct 2020 15:34:51 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Fri, 30 Oct 2020 14:28:59 +0100
> Cc: 44303@debbugs.gnu.org
> 
> > The buffer stays unchanged as expected since the pretty printed content
> > is identical to the original. The buffer is not marked as modified (also
> > expected), but a spurious lock file '.#test.json' has been created.
> 
> Yup.  It's this code in Freplace_buffer_contents:
> 
>   if (!inhibit_modification_hooks)
>     {
>       prepare_to_modify_buffer (BEGV, ZV, NULL);
>       specbind (Qinhibit_modification_hooks, Qt);
>       modification_hooks_inhibited = true;
>     }
> 
> prepare_to_modify_buffer creates the backup file.

But we then have this:

  if (modification_hooks_inhibited)
    {
      signal_after_change (BEGV, size_a, ZV - BEGV);
      update_compositions (BEGV, ZV, CHECK_INSIDE);
    }

Does this not work, or fail to unlock the file?

> But is that even needed here?  Don't the later
> Finsert_buffer_substring/del_range_both functions do the necessary
> bookkeeping?

We disable that by binding inhibit_modification_hooks, and we do that
for speed, see the comment before that code.





reply via email to

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