[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (require 'cus-load) clobbers match-data
From: |
Glenn Morris |
Subject: |
Re: (require 'cus-load) clobbers match-data |
Date: |
Tue, 16 Feb 2010 15:13:40 -0500 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Geoff Gole wrote:
> While trying to puzzle out bug 5533
> <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=5533>, I've found that
> (require 'cus-load) will stomp on match data if the file is not
> already loaded:
I'm not sure that 5533 can reasonably be classed as a bug. It seems a
strange way to do a search-replace - what's wrong with M-x query-replace?
In general, there should be no expectation that any operation in Emacs
will preserve the match-data (unless it explicitly says so).
> Maybe require should save and restore the match data itself?
This would be completely unnecessary in the vast majority of cases.
Since a require can run arbitrary code, there should be no expectation
that it preserves match-data.
The usual answer to "why doesn't FOO preserve the match-data" is "the
code calling FOO should take care to preserve the match-data if it
cares about it", rather than "FOO should always preserve the
match-data".