Subject: Re: bug#22541: 25.0.50; highlight-regexp from isearch has is case-sensitive even if case-fold is active

From: Juri Linkov <[email-masked]>
Date: Sat, 30 Apr 2016 23:07:40 +0300

>>>> > Another possible side effect of this is that highlighting
>>>> >
>>>> >   Database directory:
>>>> >
>>>> > doesn't work: hi-lock goes through the motions but nothing ends up being
>>>> > highlighted. Turning off char-folding fixes that.
>>>>
>>>> Actually “Database directory:” is not highlighted due to case-folding.
>>>> After toggling case-folding with ‘M-s c’ and preserving the capital D,
>>>> it's highlighted correctly.
>>>>
>>>> ......
>>
>> The problem is that with introduction of char-folding, a hack responsible
>> for case-folding in isearch-highlight-regexp that turns isearch-string
>> into a case-insensitive regexp is not used anymore, i.e. it's overridden by
>> isearch-regexp-function.  (Also note a FIXME comment in hi-lock-process-phrase)
>>
>> Since we can't change the value of font-lock-keywords-case-fold-search
>> for font-lock based highlighting in hi-lock for individual regexps,
>> the best solution is to rely on the feature allowing MATCHER in
>> font-lock-keywords to be a function.  So we can let-bind case-fold-search
>> in its lambda.
>>
>> Now the remaining problem is how to transfer case-fold from
>> isearch-highlight-regexp down to hi-lock-set-pattern.
>
> Hi. Sorry it took me so long to reply to this. I haven't looked at
> isearch specifically in enough detail to comment on this, but if it
> makes this better, then I'm all for it :)

Fortunately, I'll have more time in May to help in fixing this.

>> Implementing pcre-style embedded modifiers is a good long-term goal,
>> but we need to fix this for the next release.  What options do we have now?
>> I see no other way than adding new argument to the chain of calls:
>> ...
>
> I've been looking long-term, and emacs-devel now has a thread about an
> initial implementation of one of the embedded modifiers. Since char-fold
> isn't the default anymore, maybe this issue isn't pressing and isn't
> critical to fix by emacs-25?

Better to release emacs-25 with less bugs :)