GNU bug report logs - #47564
text-property-search-forward does not behave as advertized

Previous Next

Package: emacs;

Reported by: Nicolas Graner <nicolas <at> graner.name>

Date: Fri, 2 Apr 2021 14:09:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

Full log


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

From: Nicolas Graner <nicolas <at> graner.name>
To: bug-gnu-emacs <at> gnu.org
Subject: text-property-search-forward does not behave as advertized
Date: Fri, 02 Apr 2021 16:08:17 +0200
I found some discrepancies between the behavior of
text-property-search-forward and text-property-search-backward, and what
the doc says they should do. I am not sure whether they are bugs or
documentation errors, except for the last one below which is clearly a
bug.

Here is how to reproduce starting from an empty buffer, tested on
28.0.50. I have inserted comments with my observations.

(insert "12345678")
(put-text-property 3 6 'foo 'bar)
(goto-char 1)
(text-property-search-forward 'foo 'bar t)
;; moves point to 6 and returns range 3 to 6
;; Doc says it should move the point to start of range, but it
;; consistently moves to end of range.
(goto-char 1)
(text-property-search-forward 'foo 'bar nil)
;; moves point to 3 and returns range 1 to 3, whre property foo is nil.
;; Doc says: with PREDICATE nil, a value will match if it is
;; non-nil and is NOT ‘equal’ to VALUE.
;; In fact, the condition "it is non-nil" is apparently ignored.
(goto-char 9)
(text-property-search-backward 'foo 'bar t)
;; moves point to 3 and returns range 3 to 6
;; As above, consistently moves to beginning of range instead of end.
(goto-char 7)
(text-property-search-backward 'foo 'bar t)
;; returns nil. This one is really weird, considering it works OK from
;; position 6 or 8. As if there was something special when you start 1
;; after the end of a range.

Hope this helps,
Nicolas




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

Previous Next


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