[Top][All Lists]

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

Re: scheme.el bug & fix

From: Stefan Monnier
Subject: Re: scheme.el bug & fix
Date: Mon, 17 Feb 2003 09:39:17 -0500

>    It turns out the problem is that
>      (with-syntax-table st (modify-syntex-entry foo bar))
>    does not modify `st' because `with-syntax-table' does not use `st'
>    but a copy of it.  Actually it's even documented in the docstring.
>    This sounds silly.  Does anybody have an idea why it is defined that way ?
>    If not, any objection the patch below which should also improve
>    (very marginally) the performance of Emacs ?
> Are you sure that you are not going to break plenty of existing code
> this way?

I grepped through lisp/**/*.el and couldn't find a single case where
the table needed to be copied.

> People could very legitimately have relied on the present
> behavior, which is, as you state yourself, very explicitly mentioned
> in the doc string.  The reason for the "silly" behavior seems obvious:
> to avoid accidental modification of st.

But it is extremely rare to use modify-syntax-entry with no
third argument and within a with-syntax-table thing, so the
risk of accidental modification is basically inexistent.
As a matter of fact, syntax-tables are very rarely modified at
all, other than when they're created.

> Is there any reason why scheme.el can not possibly define its syntax
> table in a more standard and more natural way?

Of course, it can.  That's a separate question.  Please someone install
the patch as soon as you can: it's obviously the right thing to do.

> (I believe it is meant to very temporarily change the syntax table of
> the current buffer, not to be used to actually define syntax tables.)

Indeed, and you don't want this temporary syntax-table-switch to make
a copy of the table and then drop it on the floor (turning it into
garbage) unless there's a very good reason for it.
For example with-category-table does not copy the table.


reply via email to

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