GNU bug report logs - #55768
26.3; isearch highlighting in dired

Previous Next

Package: emacs;

Reported by: Thierry EMERY <thierryalemery <at> gmail.com>

Date: Thu, 2 Jun 2022 16:14:01 UTC

Severity: normal

Tags: moreinfo

Found in version 26.3

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55768 in the body.
You can then email your comments to 55768 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Thu, 02 Jun 2022 16:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thierry EMERY <thierryalemery <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 02 Jun 2022 16:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thierry EMERY <thierryalemery <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.3; isearch highlighting in dired
Date: Thu, 2 Jun 2022 17:22:31 +0200
[Message part 1 (text/plain, inline)]
Hello,

isearch fails to highlight in dired and displays the following error:
[image: image.png]

As dired sets text property 'invisible to a symbol, either:
'dired-hide-details-detail, 'dired-hide-details-information or
'dired-hide-details-link, in order for isearch to properly highlight the
searched string in a dired buffer, the following patch ought to be applied
to isearch-range-invisible:
diff -u isearch.el~ isearch.el
--- isearch.el~ 2019-09-10 02:32:49.000000000 +0200
+++ isearch.el 2022-06-02 17:13:55.490492201 +0200
@@ -2972,7 +2972,7 @@
  ;; skip all characters with that same `invisible' property value.
  ;; Do that over and over.
  (while (and (< (point) end) (invisible-p (point)))
-  (if (invisible-p (get-text-property (point) 'invisible))
+  (if (member (get-text-property (point) 'invisible)
buffer-invisibility-spec)
       (progn
  (goto-char (next-single-property-change (point) 'invisible
  nil end))

Kind Regards,

Thierry Emery
[Message part 2 (text/html, inline)]
[image.png (image/png, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Fri, 03 Jun 2022 03:32:01 GMT) Full text and rfc822 format available.

Message #8 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thierry EMERY <thierryalemery <at> gmail.com>
Cc: 55768 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Fri, 03 Jun 2022 05:31:16 +0200
Thierry EMERY <thierryalemery <at> gmail.com> writes:

> isearch fails to highlight in dired and displays the following error:
> image.png

[...]

>   (while (and (< (point) end) (invisible-p (point)))
> -  (if (invisible-p (get-text-property (point) 'invisible))
> +  (if (member (get-text-property (point) 'invisible) buffer-invisibility-spec)

Hm...  shouldn't this just be

> -  (if (invisible-p (point))

?  The previous change was added by Juri; added to the CCs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Fri, 03 Jun 2022 04:03:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Fri, 03 Jun 2022 07:58:02 GMT) Full text and rfc822 format available.

Message #13 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55768 <at> debbugs.gnu.org, Thierry EMERY <thierryalemery <at> gmail.com>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Fri, 03 Jun 2022 10:55:59 +0300
>> isearch fails to highlight in dired and displays the following error:
>> image.png
>
> [...]
>
>>   (while (and (< (point) end) (invisible-p (point)))
>> -  (if (invisible-p (get-text-property (point) 'invisible))
>> +  (if (member (get-text-property (point) 'invisible) buffer-invisibility-spec)
>
> Hm...  shouldn't this just be
>
>> -  (if (invisible-p (point))
>
> ?  The previous change was added by Juri; added to the CCs.

Actually, I just reverted to the previous version.
But the original change was 66e2e71d556785cd10270931c6fc0424b9dea6a6
from bug#8721.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Fri, 03 Jun 2022 08:20:02 GMT) Full text and rfc822 format available.

Message #16 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Thierry EMERY <thierryalemery <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55768 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Fri, 3 Jun 2022 09:23:12 +0200
[Message part 1 (text/plain, inline)]
(invisible-p (point)) has already been tested in the previous line, but it
only tests that there is a text property, not actual invisibility:
(defun invisible-p (pos)
  (get-text-property pos 'invisible))

If the text property `invisible' has another symbol than t as value and
`buffer-invisibility-spec' is a list (which is the case in dired, see
below), then the text will only be invisible if that symbol is currently
part of `buffer-invisibility-spec' (and that is used by
`dired-hide-details-mode').

buffer-invisibility-spec is a variable defined in ‘C source code’.
Its value is (t)
Local in buffer lisp; global value is t

  Automatically becomes buffer-local when set.

Documentation:
Invisibility spec of this buffer.
The default is t, which means that text is invisible if it has a non-nil
‘invisible’ property.
This variable can also be a list.  The list can have two kinds of elements:
‘ATOM’ and ‘(ATOM . ELLIPSIS)’.  A text character is invisible if its
‘invisible’ property is ‘ATOM’, or has an ‘invisible’ property that is a
list
that contains ‘ATOM’.
If the ‘(ATOM . ELLIPSIS)’ form is used, and ‘ELLIPSIS’ is non-nil, an
ellipsis will be displayed after the invisible characters.
Setting this variable is very fast, much faster than scanning all the text
in
the buffer looking for properties to change.
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Fri, 03 Jun 2022 08:20:03 GMT) Full text and rfc822 format available.

Message #19 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Thierry EMERY <thierryalemery <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55768 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Fri, 3 Jun 2022 09:42:51 +0200
[Message part 1 (text/plain, inline)]
Reading the documentation for `buffer-invisibility-spec' more thouroughly,
it now seems to me that a better patch would be:
diff -u isearch.el~ isearch.el
--- isearch.el~ 2019-09-10 02:32:49.000000000 +0200
+++ isearch.el 2022-06-03 09:40:59.991883469 +0200
@@ -2972,7 +2972,8 @@
  ;; skip all characters with that same `invisible' property value.
  ;; Do that over and over.
  (while (and (< (point) end) (invisible-p (point)))
-  (if (invisible-p (get-text-property (point) 'invisible))
+  (if (or (memq (get-text-property (point) 'invisible)
buffer-invisibility-spec)
+  (assq (get-text-property (point) 'invisible) buffer-invisibility-spec))
       (progn
  (goto-char (next-single-property-change (point) 'invisible
  nil end))


Le ven. 3 juin 2022 à 09:23, Thierry EMERY <thierryalemery <at> gmail.com> a
écrit :

> (invisible-p (point)) has already been tested in the previous line, but it
> only tests that there is a text property, not actual invisibility:
> (defun invisible-p (pos)
>   (get-text-property pos 'invisible))
>
> If the text property `invisible' has another symbol than t as value and
> `buffer-invisibility-spec' is a list (which is the case in dired, see
> below), then the text will only be invisible if that symbol is currently
> part of `buffer-invisibility-spec' (and that is used by
> `dired-hide-details-mode').
>
> buffer-invisibility-spec is a variable defined in ‘C source code’.
> Its value is (t)
> Local in buffer lisp; global value is t
>
>   Automatically becomes buffer-local when set.
>
> Documentation:
> Invisibility spec of this buffer.
> The default is t, which means that text is invisible if it has a non-nil
> ‘invisible’ property.
> This variable can also be a list.  The list can have two kinds of elements:
> ‘ATOM’ and ‘(ATOM . ELLIPSIS)’.  A text character is invisible if its
> ‘invisible’ property is ‘ATOM’, or has an ‘invisible’ property that is a
> list
> that contains ‘ATOM’.
> If the ‘(ATOM . ELLIPSIS)’ form is used, and ‘ELLIPSIS’ is non-nil, an
> ellipsis will be displayed after the invisible characters.
> Setting this variable is very fast, much faster than scanning all the text
> in
> the buffer looking for properties to change.
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Sat, 04 Jun 2022 11:25:02 GMT) Full text and rfc822 format available.

Message #22 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thierry EMERY <thierryalemery <at> gmail.com>
Cc: 55768 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Sat, 04 Jun 2022 13:24:12 +0200
Thierry EMERY <thierryalemery <at> gmail.com> writes:

> (invisible-p (point)) has already been tested in the previous line, but it only tests that
> there is a text property, not actual invisibility:
> (defun invisible-p (pos)
>   (get-text-property pos 'invisible))

That's not the definition of invisible-p.  It's

DEFUN ("invisible-p", Finvisible_p, Sinvisible_p, 1, 1, 0,
       doc: /* Non-nil if text properties at POS cause text there to be currently invisible.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Tue, 28 Jun 2022 17:08:01 GMT) Full text and rfc822 format available.

Message #25 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55768 <at> debbugs.gnu.org, Thierry EMERY <thierryalemery <at> gmail.com>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Tue, 28 Jun 2022 19:53:55 +0300
>> (invisible-p (point)) has already been tested in the previous line, but it only tests that
>> there is a text property, not actual invisibility:
>> (defun invisible-p (pos)
>>   (get-text-property pos 'invisible))
>
> That's not the definition of invisible-p.  It's
>
> DEFUN ("invisible-p", Finvisible_p, Sinvisible_p, 1, 1, 0,
>        doc: /* Non-nil if text properties at POS cause text there to be currently invisible.

I checked this again, and I see nothing wrong in the current implementation:

  (invisible-p (get-text-property (point) 'invisible))

is a valid call, because the arg of ‘invisible-p’ can be the actual value
of the ‘invisible’ text property.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Tue, 28 Jun 2022 17:23:01 GMT) Full text and rfc822 format available.

Message #28 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 55768 <at> debbugs.gnu.org, Thierry EMERY <thierryalemery <at> gmail.com>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Tue, 28 Jun 2022 19:22:18 +0200
Juri Linkov <juri <at> linkov.net> writes:

>>> (invisible-p (point)) has already been tested in the previous line,
>>> but it only tests that
>>> there is a text property, not actual invisibility:
>>> (defun invisible-p (pos)
>>>   (get-text-property pos 'invisible))
>>
>> That's not the definition of invisible-p.  It's
>>
>> DEFUN ("invisible-p", Finvisible_p, Sinvisible_p, 1, 1, 0,
>>        doc: /* Non-nil if text properties at POS cause text there to
>> be currently invisible.
>
> I checked this again, and I see nothing wrong in the current implementation:
>
>   (invisible-p (get-text-property (point) 'invisible))
>
> is a valid call, because the arg of ‘invisible-p’ can be the actual value
> of the ‘invisible’ text property.

The claim was that invisible-p:

>>> it only tests that there is a text property, not actual
>>> invisibility

and then there's a definition of invisible-p, which indeed only tests
that.  I pointed out that that's not what invisible-p is defined as, or
what it does.

In other words, this:

	;; If the following character is currently invisible,
	;; skip all characters with that same `invisible' property value.
	;; Do that over and over.
	(while (and (< (point) end) (invisible-p (point)))
	  (if (invisible-p (get-text-property (point) 'invisible))

Is fine, but

(eq (invisible-p (point))
    (invisible-p (get-text-property (point) 'invisible)))

is always true.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Tue, 28 Jun 2022 17:40:02 GMT) Full text and rfc822 format available.

Message #31 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55768 <at> debbugs.gnu.org, Thierry EMERY <thierryalemery <at> gmail.com>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Tue, 28 Jun 2022 20:37:06 +0300
> In other words, this:
>
> 	;; If the following character is currently invisible,
> 	;; skip all characters with that same `invisible' property value.
> 	;; Do that over and over.
> 	(while (and (< (point) end) (invisible-p (point)))
> 	  (if (invisible-p (get-text-property (point) 'invisible))
>
> Is fine, but
>
> (eq (invisible-p (point))
>     (invisible-p (get-text-property (point) 'invisible)))
>
> is always true.

I don't see how it's always true:

1. (invisible-p (point))
   checks invisibility of both: text properties and overlays.

2. (invisible-p (get-text-property (point) 'invisible))
   checks invisibility of text properties only.

3. (invisible-p (overlay-get o 'invisible))
   checks invisibility of overlays only.

There is a need for a separate check because overlays
can be opened, whereas text properties can't.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Wed, 29 Jun 2022 09:57:01 GMT) Full text and rfc822 format available.

Message #34 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 55768 <at> debbugs.gnu.org, Thierry EMERY <thierryalemery <at> gmail.com>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Wed, 29 Jun 2022 11:56:36 +0200
Juri Linkov <juri <at> linkov.net> writes:

>> 	;; If the following character is currently invisible,
>> 	;; skip all characters with that same `invisible' property value.
>> 	;; Do that over and over.
>> 	(while (and (< (point) end) (invisible-p (point)))
>> 	  (if (invisible-p (get-text-property (point) 'invisible))

[...]

> 1. (invisible-p (point))
>    checks invisibility of both: text properties and overlays.

That's true.  Was that the intention here -- first to check invisibility
of both text properties and overlays and then only check invisibility of
text properties?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Wed, 29 Jun 2022 17:59:01 GMT) Full text and rfc822 format available.

Message #37 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55768 <at> debbugs.gnu.org, Thierry EMERY <thierryalemery <at> gmail.com>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Wed, 29 Jun 2022 20:58:10 +0300
>>> 	;; If the following character is currently invisible,
>>> 	;; skip all characters with that same `invisible' property value.
>>> 	;; Do that over and over.
>>> 	(while (and (< (point) end) (invisible-p (point)))
>>> 	  (if (invisible-p (get-text-property (point) 'invisible))
>
> [...]
>
>> 1. (invisible-p (point))
>>    checks invisibility of both: text properties and overlays.
>
> That's true.  Was that the intention here -- first to check invisibility
> of both text properties and overlays and then only check invisibility of
> text properties?

Yep, that is my understanding too: first check both, then each separately.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Thu, 30 Jun 2022 09:32:01 GMT) Full text and rfc822 format available.

Message #40 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Juri Linkov <juri <at> linkov.net>
Cc: 55768 <at> debbugs.gnu.org, Thierry EMERY <thierryalemery <at> gmail.com>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Thu, 30 Jun 2022 11:30:55 +0200
Juri Linkov <juri <at> linkov.net> writes:

>> That's true.  Was that the intention here -- first to check invisibility
>> of both text properties and overlays and then only check invisibility of
>> text properties?
>
> Yep, that is my understanding too: first check both, then each separately.

Right.

Anyway, back to the original issue -- Thierry, you reported this problem
for Emacs 26.3, but do you see it in more recent Emacs versions?

If so, can you give a complete recipe to reproduce it, starting from
"emacs -Q"?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Removed tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 30 Jun 2022 09:32:01 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 30 Jun 2022 09:32:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Thu, 30 Jun 2022 14:39:01 GMT) Full text and rfc822 format available.

Message #47 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Thierry EMERY <thierryalemery <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55768 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Thu, 30 Jun 2022 16:37:50 +0200
[Message part 1 (text/plain, inline)]
Hello,

Good news: the bug that i had in Emacs 26.3 is not present in 28.1.
With Emacs 28.1 compiled from source and started with "src/emacs -Q" i can
use incremental search (e.g. in dired) including for visible text (found)
or invisible text (not found), and highlighting is correct in all cases.
Also i see in Emacs 28.1 sources that `invisible-p' has been rewritten (in
C), and is more thorough than in 26.3 :-)

Thanks,

Thierry


Le jeu. 30 juin 2022 à 11:31, Lars Ingebrigtsen <larsi <at> gnus.org> a écrit :

> Juri Linkov <juri <at> linkov.net> writes:
>
> >> That's true.  Was that the intention here -- first to check invisibility
> >> of both text properties and overlays and then only check invisibility of
> >> text properties?
> >
> > Yep, that is my understanding too: first check both, then each
> separately.
>
> Right.
>
> Anyway, back to the original issue -- Thierry, you reported this problem
> for Emacs 26.3, but do you see it in more recent Emacs versions?
>
> If so, can you give a complete recipe to reproduce it, starting from
> "emacs -Q"?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55768; Package emacs. (Thu, 30 Jun 2022 14:58:01 GMT) Full text and rfc822 format available.

Message #50 received at 55768 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Thierry EMERY <thierryalemery <at> gmail.com>
Cc: 55768 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: Re: bug#55768: 26.3; isearch highlighting in dired
Date: Thu, 30 Jun 2022 16:56:45 +0200
Thierry EMERY <thierryalemery <at> gmail.com> writes:

> Good news: the bug that i had in Emacs 26.3 is not present in 28.1.
> With Emacs 28.1 compiled from source and started with "src/emacs -Q" i can use
> incremental search (e.g. in dired) including for visible text (found) or invisible text
> (not found), and highlighting is correct in all cases.

Thanks for checking; I'm closing this bug report, then.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 55768 <at> debbugs.gnu.org and Thierry EMERY <thierryalemery <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 30 Jun 2022 14:58:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 29 Jul 2022 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 342 days ago.

Previous Next


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