Subject: bug#20975: Replacing text add also the comma

From: Artur Malabarba <[email-masked]>
Date: Sat, 4 Jul 2015 22:31:45 +0100

On Jul 4, 2015 10:07 PM, "Juri Linkov" <[email-masked]> wrote:
>
> >
> '8' matches the adjacent comma because (character-fold-to-regexp "8")
> contains "8[,.]"
>
> The culprit is #x1f109 “DIGIT EIGHT COMMA” with decomposition: (compat
> '8' ',') and #x248f “DIGIT EIGHT FULL STOP” with decomposition: (compat
> '8' '.')
>
> We don't need to match the decomposition “8,” when searching for “8”.
> We only need to match the char #x1f109 when searching for “8”.
>
> Maybe Artur has an idea how to fix this regexp?

Yes, it's simple enough to fix.
The reason why we set characters to also match the decomposition of other
unicode characters is that this lets us match a letter combined with a non
spacing accent.
Within that, I've already added a clause to avoid matching when the
decomposition has more than one letter (this prevents "a" from matching
"am").

Clearly, we need another clause to avoid this situation here.
If no one has a different opinion, I'll add a clause so that a
decomposition is folded only if it contains at least one non-spacing
character. (though I'm not sure how to check for this, at the phone right
now).

That would fix this situation, and wouldn't affect how ascii characters are
allowed to match unicode characters. This would only affect how ascii
characters are allowed to match decompositions.