GNU bug report logs - #54218
[PATCH] Magic number regexp shouldn't match beyond end-of-line.

Previous Next

Package: emacs;

Reported by: "Andrew L. Moore" <slewsys <at> gmail.com>

Date: Wed, 2 Mar 2022 04:53:01 UTC

Severity: normal

Tags: patch

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 54218 <at> debbugs.gnu.org (full text, mbox):

From: "Andrew L. Moore" <slewsys <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 54218 <at> debbugs.gnu.org
Subject: Re: bug#54218: [PATCH] Magic number regexp shouldn't match beyond
 end-of-line.
Date: Thu, 3 Mar 2022 14:57:06 -0500
On 3/3/22 09:42, Lars Ingebrigtsen wrote:
> "Andrew L. Moore" <slewsys <at> gmail.com> writes:
> 
>> Repeat magic number search to work around match-data loss
>> when `save-window-excursion' is called.
> 
> I think it would perhaps make more sense to just save the match data
> instead of repeating the match, so I've now done so in Emacs 29

Yes, this resolves the issues that I was seeing.

For the record, I'm not able to reproduce the data loss with
vanilla Emacs by calling `executable-set-magic' manually.  It
occurs (for me) when `executable-set-magic' is called automatically
from a minor mode.  In any case, your patch fixes my minor mode
and does no harm.

The other issue that I attributed to the regexp matching beyond
EOL was caused by `replace-match' being called by incorrect or
uninitialized match data.  Your patch resolves this as well.
Thank you!




This bug report was last modified 3 years and 78 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.