Index | Thread | Search

From:
"Omar Polo" <op@omarpolo.com>
Subject:
Re: mg: regex search/replace issues [PATCH]
To:
Mark Willson <mark@hydrus.org.uk>
Cc:
tech@openbsd.org
Date:
Sat, 28 Feb 2026 19:45:15 +0100

Download raw body.

Thread
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!