Subject: Re: bug#67161: 30.0.50; [PATCH] Add option `dired-filename-display-length'

From: Juri Linkov <[email-masked]>
Date: Tue, 21 Nov 2023 09:52:02 +0200

>>> in the attached patch, then text in hidden part can be matched
>>> regardless of search-invisible being open or t. It also has a bonus
>>> that hidden text can be revealed during isearch.
>
> Yes, using an overlay sounds like a better choice here, thanks.
>
>> Juri, this seems to be a usability bug?  Why does Isearch only look
>> into invisible overlay properties, but not text properties?  IOW, why
>> doesn't "M-s i" set the value of isearch-invisible to t, not 'open'?
>
> I think the idea is that matching invisible text is somewhat
> inconvenient, so it's better to temporarily reveal/open that text.
> But I think it points to an bug in Isearch: when `isearch-invisible` is
> `open` we should match text inside invisible text, regardless if we can
> reveal/open that invisible text or not.  IOW `open` should find the
> same matches as `t`, the only difference being that it additionally
> (tries to) reveal/open the text.

This could be a new value like `open-or-match` with a trivial change:

@@ -3899,6 +3899,9 @@ isearch-filter-visible
 of what `isearch-range-invisible' says."
   (and (not (text-property-not-all beg end 'inhibit-isearch nil))
        (or (eq search-invisible t)
+           (when (eq search-invisible 'open-or-match)
+             (isearch-range-invisible beg end)
+             t)
            (not (isearch-range-invisible beg end)))))

But I doubt that it could be enabled by default because in many cases
it's too confusing for users to stop at a match that is not visible.

OTOH, there was a request about informing the user about hidden matches.
So now the Isearch prompt shows the number of invisible matches.
Having this information the user can reveal in some way and visually
inspect these matches.

>> In any case, the differences between properties and
>> overlays is unusual and IMO a misfeature.  Can this be fixed?
>
> Indeed, it would be good to implement some way to reveal/open invisible
> text made invisible via text-properties rather than overlays.
> That also applies to `reveal-mode`, of course.

Would be nice to have such useful feature.