Index | Thread | Search

From:
"Mark Willson" <mark.willson@hydrus.org.uk>
Subject:
Re: mg: regex search/replace issues [PATCH]
To:
"'Omar Polo'" <op@omarpolo.com>
Cc:
<tech@openbsd.org>
Date:
Sun, 1 Mar 2026 08:44:39 -0000

Download raw body.

Thread
Hi Omar,

> -----Original Message-----
> From: Omar Polo <op@omarpolo.com>
> Sent: 28 February 2026 18:45
> To: Mark Willson <mark@hydrus.org.uk>
> Cc: tech@openbsd.org
> Subject: Re: mg: regex search/replace issues [PATCH]
> 
> Hello,
> 
> Mark Willson <mark@hydrus.org.uk> wrote:
> > Hi Folks,
> >
> > The patch below fixes the following issues with the mg(1) editor:
> >
> > 1. An infinite loop with (replace-regexp "^.*$" ""). replace-regexp does
> >    not advance to the next line. This also occurs when the search text
> >    is "^".
> >
> > 2. replace-regexp replaces all occurances of ^pat on a line. For
> >    example, (replace-regexp "^#" "") will delete every occurance of
> >    "#" in the line "#############################". This is unexpected
> >    (at least to me) and is not the behaviour of emacs.
> >
> > I'd be very grateful if someone could apply this patch (or a more
> > acceptable version) to the source tree.
> 
> sorry for the late reply.  I remember that I was looking into your diff
> back in the Prague hackathon (two years ago!!), but I got distracted and
> never ended up finishing to review.  Apologize!
> 
> I've committed with a tiny nitpick: i've used gotoeol() instead of
> setting curwp->w_doto directly, I thought it was more readable.
> 
> Thanks!

Thanks very much for committing (a better version of) the patch. No worries
re delay!

Best Regards,
Mark
--
Mark Willson | Mobile: +44 7579 784676 | Email: mark.willson@hydrus.org.uk