emacs-devel
[Top][All Lists]
Advanced

[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: Wed, 06 Jun 2007 08:25:53 +0800

> I just got a possibly wrong idea today morning.  The error happens in
> the case that some command, which changes the match data, is added
> into a hook.  When the hook is executed, the match data is also
> changed.  Now, if we could assume that _hooks shall not change the
> match data_, we can save and restore the match data automatically when
> we run hooks.  I am not sure about this assumption, though.

`save-match-data' is not cheap.  I suppose it's not advisable to
automatically wrap every hook into it.

> Adding `save-match-data' to functions one by one works, but it is
> difficult to check all of the functions, and it is not the overall
> solution.

I think that `find-file-noselect' and `file-truename' should not change
match-data regardless of whether they run in a hook or not (though a
number of hooks should probably not run `find-file-noselect' in the
first place).

Ok.  So I wrote a script to find out all such defuns.  I found many
defuns are possible needing `save-match-data' with it.  The script is
attached, and to start finding, first load the file and then execute
`list-possible-wrong-match-defuns-in-dir'.  An exception in the
executing is for some files a question about whether to apply local
variables list.

Should we check all these defuns and add `save-match-data' to some of
them?

Regards,
Guanpeng Xu

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

Attachment: ss.el
Description: Text document


reply via email to

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