[Top][All Lists]

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

Re: scan-lists sees comment delimiter inside string

From: Stefan Monnier
Subject: Re: scan-lists sees comment delimiter inside string
Date: Wed, 08 Jun 2005 15:53:06 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> With parse-sexp-ignore-comments t and point in between "( in

> (setq foo "(;)")

> forward-sexp gets me

> forward-sexp: Scan error: "Unbalanced parentheses".

> Obviously, this is because scan-lists finds the semicolon and does not
> check whether it's inside a string.  Could someone please add the
> necessary conjunct?

It's not as trivial a change as it may seem since figuring out whether we're
inside a string (or comment for that matter) or not often requires "parsing"
the buffer from the beginning and this parsing can fail if the syntax table
doesn't match 100% the language in use.

I do think it'd be good to do it and I suggest we beginning by introducing
new commands move-forward-sexp and move-backward-sexp (which are
"user-level" sexp movement commands) which could try to DTRT like you
suggest, while keeping the behavior of forward-sexp the way it is now.

If such a thing is done maybe forward-sexp-function should be used in
move-forward-sexp rather than in forward-sexp itself.

But then transpose-sexps should also be changed to use move-forward-sexp
since it should obey forward-sexp-function.

Patches are welcome, but I really hope they won't be part of the next
release, which is already about to enter its second year of so-called
"feature freeze".


reply via email to

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