auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Re: Changes in font locking


From: Robert Pluim
Subject: Re: [AUCTeX-devel] Re: Changes in font locking
Date: Tue, 13 Mar 2007 10:39:08 +0100



On 3/13/07, David Kastrup <address@hidden> wrote:
"Robert Pluim" <address@hidden> 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)
             ,@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

--


reply via email to

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