GNU bug report logs - #77054
Completion highlighting applied outside completion-lazy-hilit-fn

Previous Next

Package: emacs;

Reported by: João Guerra <joca.bt <at> gmail.com>

Date: Sun, 16 Mar 2025 15:28:01 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: João Távora <joaotavora <at> gmail.com>
To: João Guerra <joca.bt <at> gmail.com>,  Eli Zaretskii <eliz <at> gnu.org>, 77054 <at> debbugs.gnu.org
Subject: bug#77054: Completion highlighting applied outside completion-lazy-hilit-fn
Date: Wed, 19 Mar 2025 20:41:32 +0000
Forgot to CC the bug tracker.  So just wanted to say again I'm sorry
to disappoint, and to clarify a possible misunderstanding.  "lazy" has
nothing to do with "what" is highlighted but merely "when". As far
as I can tell,that part is working fine,so whatever your problem is
And again, lazy highlighting only concerns a collaboration between
style and frontend.

toodle-oo!
João



On Wed, Mar 19, 2025 at 3:14 PM João Távora <joaotavora <at> gmail.com> wrote:
>
> So, sorry to disappoint you João, and best of luck!
>
> João
>
> On Wed, Mar 19, 2025, 15:12 João Guerra <joca.bt <at> gmail.com> wrote:
>>
>> > AFAIK this feature has been in Emacs at least for a full major version cycle (29) and had it failed in its basic mission we would have heard about it. I also remember testing it thoroughly.
>>
>> It feels a bit disappointing when the answer to a possible bug report
>> is something like "nobody has reported it so it must be working fine"
>> or "it worked on my machine".
>>
>> Anyway, here's a way to reproduce it in a less "complex" setup, only
>> using Emacs builtins.
>>
>> The flex style sets `completion-lazy-hilit-fn` in the middle of
>> `completion-pcm--hilit-commonality` to `completion--hilit-from-re`.
>> Let's override that just for demonstration purposes in a *hacky way*.
>>
>> ```
>> (setopt completion-styles '(flex)
>>         file-name-shadow-properties `(invisible t
>> ,@file-name-shadow-properties))
>> (setq completion-lazy-hilit t)
>> (defun completion--hilit-from-re (string regexp &optional point-idx)
>>   "Bogus fontification that only fontifies the last character of STRING."
>>   (message "lazy %s" completion-lazy-hilit)
>>   (let ((last (1- (length string))))
>>     (add-face-text-property last (1+ last) 'completions-common-part t string))
>>   string)
>> (icomplete-mode t)
>> ```
>>
>> See the attached picture for the outcome (if that doesn't work here's
>> an alternative url
>> https://drive.proton.me/urls/ZMMW1D9S2R#EXEwlTnWeCHy). You'll notice
>> that my fontification function has run, fontifying the last character.
>> However, additional characters are fontified, meaning there's
>> fontification happening elsewhere (the culprit indicated in the
>> original bug report). It could be the case that the frontend decided
>> to do additional fontification, but that's not the case (except for
>> the first candidate).
>>
>> My expectation as a user or package maintainer is that no
>> fontification will be performed by Emacs if I am using lazy
>> highlighting. However, that's not the case in *specific* situations as
>> I am trying to show in this bug report.
>>
>> > At least according to the docstrings I wrote at the time, and which I suggest reading.
>>
>> Neither docstring directly discusses whether additional fontification
>> can be performed by Emacs when using lazy highlighting, so my
>> assumption would be no.
>>
>> If it helps, I can reframe this bug report as: if lazy highlighting is
>> enabled, can Emacs perform additional fontification (outside the
>> completion frontend and style)?
>>
>> If the answer is yes, can we consider changing that behaviour? As I
>> believe it constraints what packages can do.



--
João Távora




This bug report was last modified 105 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.