From: Stephen Berman <stephen.berman@gmx.net>
To: Dustin Lacewell <dlacewell@gmail.com>
Cc: 40053@debbugs.gnu.org
Subject: bug#40053: 28.0; text-property-search-forward skips first region
Date: Fri, 13 Mar 2020 19:46:29 +0100 [thread overview]
Message-ID: <87h7ysgkje.fsf@gmx.net> (raw)
In-Reply-To: <CAMDmBpGvML0OvKfGx4WjiOd3ESebMK00+J72e2An-eXZJN=fVw@mail.gmail.com> (Dustin Lacewell's message of "Fri, 13 Mar 2020 12:35:25 -0500")
On Fri, 13 Mar 2020 12:35:25 -0500 Dustin Lacewell <dlacewell@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
next prev parent reply other threads:[~2020-03-13 18:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 17:35 bug#40053: 28.0; text-property-search-forward skips first region Dustin Lacewell
2020-03-13 18:46 ` Stephen Berman [this message]
2020-03-14 11:37 ` 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=87h7ysgkje.fsf@gmx.net \
--to=stephen.berman@gmx.net \
--cc=40053@debbugs.gnu.org \
--cc=dlacewell@gmail.com \
/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).