unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Federico Tedin <federicotedin@gmail.com>
Cc: casouri@gmail.com, 40000@debbugs.gnu.org
Subject: bug#40000: 27.0.60; next-single-char-property-change hangs on bad argument
Date: Mon, 13 Apr 2020 17:31:29 +0300	[thread overview]
Message-ID: <83sgh7ihj2.fsf@gnu.org> (raw)
In-Reply-To: <878siz31ta.fsf@gmail.com> (message from Federico Tedin on Mon, 13 Apr 2020 16:20:01 +0200)

> From: Federico Tedin <federicotedin@gmail.com>
> Cc: casouri@gmail.com,  40000@debbugs.gnu.org
> Date: Mon, 13 Apr 2020 16:20:01 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >   If the property is constant all the way to the end of OBJECT, return the
> >   last valid position in OBJECT.
> >
> > Your change means this will no longer be true when LIMIT > EOB.
> >
> > Thanks.
> 
> Aah OK, I missed that part at the end. But if I evaluate:
> 
>   (next-single-char-property-change 0 'test "hello" 10000)
> 
> It still returns 10000. Is it possible that "return LIMIT if nothing is
> found before LIMIT" is meant to take precedence over "return the last
> valid position in OBJECT"?

I think this means you are dealing with "undefined behavior".  Since
you want to make it well-defined, the results must be consistent,
where they weren't before.

Note that the doc string also says this:

  In a string, scan runs to the end of the string, unless LIMIT is non-nil.
  In a buffer, if LIMIT is nil or omitted, it runs to (point-max), and the
  value cannot exceed that.

So it's quite clear to me that the value should never be more than the
last valid position, both for strings and for buffers.  No doubt, no
one called this function with LIMIT beyond the last valid position,
because that would produce an infloop.  So a change that will return
the maximum valid position in this case cannot be
backward-incompatible.





  reply	other threads:[~2020-04-13 14:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-09 15:40 bug#40000: 27.0.60; next-single-char-property-change hangs on bad argument Yuan Fu
2020-04-13 13:52 ` Federico Tedin
2020-04-13 14:04   ` Eli Zaretskii
2020-04-13 14:20     ` Federico Tedin
2020-04-13 14:31       ` Eli Zaretskii [this message]
2020-04-13 15:27         ` Federico Tedin
2020-04-13 15:54           ` Eli Zaretskii
2020-04-14 21:05             ` Federico Tedin
2020-04-25 12:23               ` Eli Zaretskii
2020-05-03 14:04                 ` Federico Tedin
2020-05-09  7:29                   ` Eli Zaretskii

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=83sgh7ihj2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=40000@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=federicotedin@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).