Subject: Re: bug#41445: 26.3; Query-replace triggers "match data clobbered by..."

From: Eli Zaretskii <[email-masked]>
Date: Fri, 22 May 2020 15:35:38 +0300

> From: Mattias Engdegård <[email-masked]>
> Date: Fri, 22 May 2020 14:21:04 +0200
> Cc: Ture Pålsson <[email-masked]>, [email-masked]
> 
> 22 maj 2020 kl. 14.07 skrev Eli Zaretskii <[email-masked]>:
> 
> > I think in ucs-normalize-hfs-nfd-post-read-conversion and
> > ucs-normalize-hfs-nfd-pre-write-conversion.  IOW, so that this only
> > affects encoding and decoding macOS file names.  WDYT?
> 
> Both of these call ucs-normalize-region, which makes it natural to save match data in that function. Conversely, anything that calls ucs-normalize-region would have to be wrapped, not just the two functions you mentioned. In other words, there seems to be no advantage in saving the match data in those functions, only disadvantages.

My line of reasoning was that only the callers of ENCODE_FILE and
DECODE_FILE will not expect the match-data to be clobbered.  Code that
calls ucs-normalize-region directly may or may not be bothered by the
clobbering, so we should leave that to the caller.

The advantage of not doing this unconditionally is that we don't
unnecessarily punishing callers that don't need match-data to be
saved.