[Top][All Lists]

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

Re: find-file-noselect needs save-match-data

From: Herbert Euler
Subject: Re: find-file-noselect needs save-match-data
Date: Thu, 14 Jun 2007 14:37:42 +0800

So I don't see current usage as problematic w.r.t efficiency.
The only real problem with it is that people tend to not know/understand it
and are thus tempted to complain that most functions need to be wrapped in
save-match-data, which then leads to long discussions such as this one.
Maybe we should make the convention more prominent by adding it to the
docstring of save-match-data?

This is probably true.  I found this strange behavior when I studied
the previous SKIP_SYNTAX_BACKWARD patch.  I grep'ed to get all the
places that invoke SKIP_SYNTAX_BACKWARD, and looked at them one by
one.  Several are in regex.c.  I wrote many expressions in the
*scratch* buffer and evaluated them with C-x C-e sequentially to make
sure all the places in regex.c get called.  When I evaluated the three
expressions in the beginning of this thread, I got wrong results and
started not to understand it.  Starting Emacs with -Q, I found the
result is correct.  So I knew it's something wrong with my
configuration.  Finally, I knew it's in type-break, and then I knew
the problem is caused by `find-file-noselect' which is put on
`post-command-hook' and changes the match data.

I missed something, at least the efficiency.  And the operations above
is truely rare: I don't think people would do that often too.  If in
most cases such a wrong result will not happen, it is then not a
problem for common usage.  Unless some mode makes the wrong cases
common, it is safe to ignore it.

However, this is surely a shortcoming of Emacs.

Guanpeng Xu

Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

reply via email to

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