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

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 01 Nov 2020 13:06:00 +0100

Eli Zaretskii <[email-masked]> writes:

> 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?

This does not unlock the file in the test case.

>> 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.

Ah, I see.  The missing piece of the puzzle was this bit, which I wasn't
aware of:

----
Setting this variable non-nil also inhibits file locks and checks
whether files are locked by another Emacs session, as well as
handling of the active region per ‘select-active-regions’.
----

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no