all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#40053: 28.0; text-property-search-forward skips first region
@ 2020-03-13 17:35 Dustin Lacewell
  2020-03-13 18:46 ` Stephen Berman
  0 siblings, 1 reply; 3+ messages in thread
From: Dustin Lacewell @ 2020-03-13 17:35 UTC (permalink / raw)
  To: 40053

[-- Attachment #1: Type: text/plain, Size: 482 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 692 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#40053: 28.0; text-property-search-forward skips first region
  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
  2020-03-14 11:37   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Berman @ 2020-03-13 18:46 UTC (permalink / raw)
  To: Dustin Lacewell; +Cc: 40053

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#40053: 28.0; text-property-search-forward skips first region
  2020-03-13 18:46 ` Stephen Berman
@ 2020-03-14 11:37   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-03-14 11:37 UTC (permalink / raw)
  To: Stephen Berman; +Cc: Dustin Lacewell, 40053

Stephen Berman <stephen.berman@gmx.net> writes:

> 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.

Yup.  So I don't think there's any bug here, and I'm closing this bug
report.  If there's still something to fix here, respond, and the bug
report will be reopened.

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-14 11:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2020-03-14 11:37   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.