[Top][All Lists]

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

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

From: Richard Stallman
Subject: Re: find-file-noselect needs save-match-data
Date: Fri, 15 Jun 2007 04:49:01 -0400

    Excuse me but just another question: as Stefan said, 99% of
    non-trivial functions use regexps, does it mean that these 99%
    non-trivial functions shall not be put on the hooks that may be run
    between two regexp-sensitive functions/commands unless the putter
    saves match-data?  Or, does it mean that this type of hooks need

It depends on how the hook is used.

                        `pre-command-hook', `post-command-hook',
    `before-change-functions' and `after-change-functions' seem to be some
    of the hooks.

`pre-command-hook' and `post-command-hook' are not called from many
places.  The principal one is the main command loop, which does not
care if the match data is clobbered by the hook.  Therefore, anyplace
else that runs these hooks should make sure not to care either.

`before-change-functions' and `after-change-functions' can be called
from lots of primitives, including `insert'.  It would be a horrible
pain to have to worry that all these primitives might clobber the
match data.  Therefore, any hook functions put on these hooks must
preserve the match data.

That should be documented in the doc strings of those hooks
and in the Lisp Ref Manual.  Would someone like to do that?

reply via email to

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