[AUCTeX-devel] Re: Changes in font locking

Robert Pluim rpluim at gmail.com
Tue Mar 13 05:39:08 EDT 2007


On 3/13/07, David Kastrup <dak at gnu.org> wrote:
>
> "Robert Pluim" <rpluim at gmail.com> writes:
>
> > Patch to paper over this problem follows.  I suspect that
> 'copy-syntax-table'
> > is actually at fault, but with this at least the test in
> http://mid.gmane.org/
> > cp7323$qm7$1%40sea.gmane.org works.
> >
>
> The idea of the copy probably was to have things like
> `modify-syntax-entry' in `body' not have a lasting effect.  I doubt
> that this is actually the intent of the macro according to its doc
> string: actually, it is quite likely that people would set up a syntax
> table with
>
> (with-syntax-table some-table
>   (modify-syntax-entry ?x ?y)
>   ...
> )



I agree that people would use it like that, although the test case doesn't
seem to be modifying the syntax-table that I can see.


The corresponding macro in Emacs, if I am not mistaken, is the
> following:
>
> (defmacro with-syntax-table (table &rest body)
>   "Evaluate BODY with syntax table of current buffer set to TABLE.
> The syntax table of the current buffer is saved, BODY is evaluated, and
> the
> saved table is restored, even in case of an abnormal exit.
> Value is what BODY returns."
>   (declare (debug t))
>   (let ((old-table (make-symbol "table"))
>         (old-buffer (make-symbol "buffer")))
>     `(let ((,old-table (syntax-table))
>            (,old-buffer (current-buffer)))
>        (unwind-protect
>            (progn
>              (set-syntax-table ,table)
>              , at body)
>          (save-current-buffer
>            (set-buffer ,old-buffer)
>            (set-syntax-table ,old-table))))))



This is identical to the 21.5 version, modulo the 'copy-syntax-table'.

I think it likely that copying the syntax table is a mistake, given
> what people would expect from the doc string of the macro and given
> that there is a non-trivial amount of code around which relies on the
> non-copying behavior.



Perhaps, although I don't see how the copy-syntax-table could cause a
problem when not modifying the syntax-table, unless it was not copying
correctly.

So I don't think your patch is "papering over the problem", but rather
> fixing it.  I think it likely that `copy-syntax-table' works as
> intended, and that it is just misused here.



Well, to answer that properly I need to understand the xemacs implementation
of syntax-tables, and I don't yet ;-)

Robert

--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xemacs.org/pipermail/xemacs-beta/attachments/20070313/be710e6d/attachment.htm


More information about the XEmacs-Beta mailing list