bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13260: 24.3.50; save match data for core functions like `delete-char


From: Stefan Monnier
Subject: bug#13260: 24.3.50; save match data for core functions like `delete-char' and `delete-backward-char'?
Date: Mon, 24 Dec 2012 00:09:55 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> I'm fine with a rule like "anything that modifies the buffer should 
> be assumed to destroy the match data" -- given your explanation above.
> But I'm not convinced this should apply to all other functions.

Basically, if you need the match-data, you should get it right after the
match itself.  So save-match-data is something to use between the match
and the match-data extraction (unless this code is trivial, as is
usually the case), rather than around functions that might potentially
appear occasionally somewhere between a match and
a match-data extraction.

I know these requests will keep coming until the byte-compiler is
enhanced to flag places where a save-match-data is potentially missing,
or maybe until we replace the "string-match followed by
match-beginning/end" with a "match and then bind subgroups to provided
vars".


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]