all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <none@example.invalid>
Subject: paren-mismatching problems in cc-mode and paren.el (' inside string)
Date: Sun, 31 Mar 2002 10:40:52 +0000	[thread overview]
Message-ID: <k3p68a.q5.ln@acm.acm> (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").

                 reply	other threads:[~2002-03-31 10:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=k3p68a.q5.ln@acm.acm \
    --to=none@example.invalid \
    /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.