unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Bug/regression in regex-replace (was fix for bug#67124)
@ 2024-11-30  1:24 Campbell Barton
  2024-11-30  2:49 ` ideasman42
  0 siblings, 1 reply; 2+ messages in thread
From: Campbell Barton @ 2024-11-30  1:24 UTC (permalink / raw)
  To: emacs-devel

Hi, the commit 47b497b4dac91e5ea56102018223bdeb5e21a93b by Stefan 
Monnier (an alternate fix for bug#67124) has broken the evil-numbers 
package [0], causing it's tests to fail.

 From a user perspective:
`evil-numbers/dec-at-pt` on `0` to result in `1` instead of `-1`.

The change seems to be caused by (set-match-data ...)
using passing in a pair of identical points (a match with zero length), 
then a call to regex-replace to insert text into the empty match (the 
numbers "sign" in this case).

I'm not sure if this would be considered a bug, or if creating an empty 
group is considers incorrect use of the API, in that case - invalid 
input might raise an error instead of failing silently.

Whatever the case this used to work - and the commit doesn't indicate 
the change was intentional.

[0]: https://github.com/juliapath/evil-numbers





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

* Re: Bug/regression in regex-replace (was fix for bug#67124)
  2024-11-30  1:24 Bug/regression in regex-replace (was fix for bug#67124) Campbell Barton
@ 2024-11-30  2:49 ` ideasman42
  0 siblings, 0 replies; 2+ messages in thread
From: ideasman42 @ 2024-11-30  2:49 UTC (permalink / raw)
  To: emacs-devel

On 11/30/24 12:24 PM, Campbell Barton <ideasman42@gmail.com> wrote:
> Hi, the commit 47b497b4dac91e5ea56102018223bdeb5e21a93b by Stefan 
> Monnier (an alternate fix for bug#67124) has broken the evil-numbers 
> package [0], causing it's tests to fail.
> 
>  From a user perspective:
> `evil-numbers/dec-at-pt` on `0` to result in `1` instead of `-1`.
> 
> The change seems to be caused by (set-match-data ...)
> using passing in a pair of identical points (a match with zero length), 
> then a call to regex-replace to insert text into the empty match (the 
> numbers "sign" in this case).
> 
> I'm not sure if this would be considered a bug, or if creating an empty 
> group is considers incorrect use of the API, in that case - invalid 
> input might raise an error instead of failing silently.
> 
> Whatever the case this used to work - and the commit doesn't indicate 
> the change was intentional.
> 
> [0]: https://github.com/juliapath/evil-numbers

To follow up on this problem, this looks like a more typical bug since swapping the order,
so the empty match is replaced after the later, non-empty match still works,
so I assume it's preferred to handle this via the bug-tracker instead of the mailing list.



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

end of thread, other threads:[~2024-11-30  2:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-30  1:24 Bug/regression in regex-replace (was fix for bug#67124) Campbell Barton
2024-11-30  2:49 ` ideasman42

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