From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: scheme.el bug & fix Date: 17 Feb 2003 11:19:05 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <5xr8a78b1i.fsf@kfs2.cua.dk> References: <3E26DA700109A72E@mel-rta8.wanadoo.fr> <200302162353.h1GNrkG24335@rum.cs.yale.edu> <200302170105.TAA17107@eel.dms.auburn.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1045473611 32681 80.91.224.249 (17 Feb 2003 09:20:11 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 17 Feb 2003 09:20:11 +0000 (UTC) Cc: monnier+gnu/emacs@rum.cs.yale.edu Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18khRV-0008Ur-00 for ; Mon, 17 Feb 2003 10:20:05 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18khfo-0007F3-00 for ; Mon, 17 Feb 2003 10:34:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18khSJ-0000ob-0B for emacs-devel@quimby.gnus.org; Mon, 17 Feb 2003 04:20:55 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18khRt-0000gg-00 for emacs-devel@gnu.org; Mon, 17 Feb 2003 04:20:29 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18khRc-0008In-00 for emacs-devel@gnu.org; Mon, 17 Feb 2003 04:20:22 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18khRY-0007fP-00 for emacs-devel@gnu.org; Mon, 17 Feb 2003 04:20:09 -0500 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id A04377C018; Mon, 17 Feb 2003 10:19:58 +0100 (CET) Original-To: Luc Teirlinck In-Reply-To: <200302170105.TAA17107@eel.dms.auburn.edu> Original-Lines: 49 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-cc: David.Ponce@wanadoo.fr Original-cc: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:11704 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11704 Luc Teirlinck writes: > Stefan Monnier wrote: > > 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 just checked all 28 occurrences of with-syntax-table and only the following would break: autoconf.el: autoconf-current-defun-function All other occurrences don't modify the syntax table *), so the copy operation is indeed wasteful in the normal case. antlr-mode.el and cc-defs.el even define their own versions of the macro, and they don't copy the syntax table either. *) except for scheme.el which expects to be able to modify the syntax table, so it would be fixed rather than broken by the change... Maybe we should make a new macro with-copy-of-syntax-table which does copy the table, and change the original macro not to copy. > Is there any reason why scheme.el can not possibly define its syntax > table in a more standard and more natural way? I do not believe that > with-syntax-table was meant to be used the way scheme .el uses it. But if you e.g. use with-current-buffer, you are working on that buffer, not a copy of it... So I find the "copy of" behaviour quite surprising. > (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.) But it is primarily used to temporarily *use* an existing syntax table, not temporarily *modify* a syntax table. -- Kim F. Storm http://www.cua.dk