unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Nicolas Graner <nicolas@graner.name>
To: 47564@debbugs.gnu.org
Subject: bug#47564: text-property-search-forward does not behave as advertized
Date: Fri, 02 Apr 2021 16:08:17 +0200	[thread overview]
Message-ID: <868s60wzhq.fsf@universite-paris-saclay.fr> (raw)

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





             reply	other threads:[~2021-04-02 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-02 14:08 Nicolas Graner [this message]
2021-04-10 16:27 ` bug#47564: text-property-search-forward does not behave as advertized Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 10:44   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=868s60wzhq.fsf@universite-paris-saclay.fr \
    --to=nicolas@graner.name \
    --cc=47564@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).