From: storm@cua.dk (Kim F. Storm)
Cc: monnier+gnu/emacs@rum.cs.yale.edu
Subject: Re: scheme.el bug & fix
Date: 17 Feb 2003 11:19:05 +0100 [thread overview]
Message-ID: <5xr8a78b1i.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <200302170105.TAA17107@eel.dms.auburn.edu>
Luc Teirlinck <teirllm@dms.auburn.edu> 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 <storm@cua.dk> http://www.cua.dk
next prev parent reply other threads:[~2003-02-17 10:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3E26DA700109A72E@mel-rta8.wanadoo.fr>
2003-02-16 23:53 ` scheme.el bug & fix Stefan Monnier
2003-02-17 1:05 ` Luc Teirlinck
2003-02-17 10:19 ` Kim F. Storm [this message]
2003-02-17 9:34 ` Miles Bader
2003-02-17 20:37 ` Richard Stallman
2003-02-17 14:39 ` Stefan Monnier
2003-02-18 0:30 ` Luc Teirlinck
2003-02-18 15:33 ` Stefan Monnier
2003-02-19 7:17 ` Richard Stallman
2003-02-19 14:31 ` Stefan Monnier
2003-02-19 15:11 ` Miles Bader
2003-02-20 18:21 ` Richard Stallman
2003-02-20 20:14 ` Stefan Monnier
2003-04-14 1:21 ` Luc Teirlinck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5xr8a78b1i.fsf@kfs2.cua.dk \
--to=storm@cua.dk \
--cc=monnier+gnu/emacs@rum.cs.yale.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.