emacs-devel
[Top][All Lists]
Advanced

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

Re: Saving match data


From: Marcin Borkowski
Subject: Re: Saving match data
Date: Wed, 28 Sep 2016 19:00:44 +0200
User-agent: mu4e 0.9.17; emacs 25.2.50.1

On 2016-09-28, at 16:01, Philipp Stephani <address@hidden> wrote:

> Hi,
>
> the Elisp manual (section "The Match Data") says:
>
> "Notice that all functions are allowed to overwrite the match data
> unless they’re explicitly documented not to do so."
>
> I think this statement is surprising and puts unnecessary burden on Elisp

Yes, it is surprising.  Here's a story from three years ago about how
this hit me:
http://mbork.pl/2013-09-18_Selective_replacement_in_LaTeX_documents_(en)

OTOH, I agree with Stefan and Eli that changing that would be a huge
work (and it would make Emacs slower).

OYAH, I think that it is safe to assume that only functions related to
searching actually mess with match data, and one could easily grep the
Emacs sources to make a list of functions which actually change match
data.  Then, we could extend these functions' docstrings (and mentions
in the manual) with a suitable mention.  IOW, I would consider doing
this

> and then clean up existing documentation [...]

but not this:

> [...] add `save-match-data' where appropriate.

Also, one might consider (as hinted in my post) adding `save-match-data'
to _interactive_ functions messing with match data.  This way, the user
would not be surprised as I was back then.  This _might_ be a reasonable
compromise, no?

WDYT?

> Philipp

Best,

-- 
Marcin Borkowski



reply via email to

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