GNU bug report logs -
#40053
28.0; text-property-search-forward skips first region
Previous Next
Reported by: Dustin Lacewell <dlacewell <at> gmail.com>
Date: Fri, 13 Mar 2020 17:36:01 UTC
Severity: normal
Tags: notabug
Found in version 28.0
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Fri, 13 Mar 2020 12:35:25 -0500 Dustin Lacewell <dlacewell <at> gmail.com> wrote:
> The following code does not do what I would expect:
>
> (with-current-buffer (get-buffer-create "*Test*")
> (erase-buffer)
> (insert " ")
> (insert-text-button "Button1"
> 'foo 'bar)
> (insert " ")
> (insert-text-button "Button2"
> 'foo 'bar)
> (beginning-of-buffer)
> (text-property-search-forward 'foo 'bar nil t)
> (display-buffer (current-buffer)))
>
> I would expect the point to land on the first button. However, it
> lands on the second.
Actually, if text-property-search-forward succeeds it moves to the end
of the propertized region, so in this case, just after the first
button. And that's what happens with this sexp:
(text-property-search-forward 'foo 'bar t t)
But you've called it with the argument PREDICATE nil, which means the
search succeeds if the value of the propertized text does not match the
VALUE argument, i.e. in this case if 'bar does not match 'bar. Since
this is false, the search stops, leaving point at the last position
where the value of 'foo changed, which is the beginning of the second
button.
Steve Berman
This bug report was last modified 5 years and 70 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.