* paren-mismatching problems in cc-mode and paren.el (' inside string)
@ 2002-03-31 10:40 Alan Mackenzie
0 siblings, 0 replies; only message in thread
From: Alan Mackenzie @ 2002-03-31 10:40 UTC (permalink / raw)
[Mailed to bug-cc-mode@gnu.org; Posted to gnu.emacs.bugs.]
GNU Emacs 21.1.
In the following c-mode snippet:
void print_salaries (int alices, int bobs)
{
printf ("%i (Alice's salary)\n", alices) ;
printf ("%i (Bob's salary)\n", bobs) ;
}
the '(' before "Alice's" matches the ')' after "Bob's salary", both in
the highlighting (paren.el ??) and in commands like C-M-p (backward-list)
which cc-mode delegates to ..../emacs-lisp/lisp.el.
The problem is that the apostrophe has string syntax in the cc-mode
syntax table, so that in attempting to match the braces, everything
between the two apostrophes is regarded as an indivisible string.
[I actually found this problem while debugging awk-mode: There it is
more serious, because / has string syntax by defeault, and a line such as
printf ("Use local dict file? (y/n)")
is not at all contrived or unexpected.]
The root cause in the backward-list case (and probably the paren.el one,
too) is that the scan-lists primitive is used without first ensuring that
point is in a "safe" place (i.e. outside of any strings or comments).
--
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-03-31 10:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-31 10:40 paren-mismatching problems in cc-mode and paren.el (' inside string) Alan Mackenzie
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.