From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: paren-mismatching problems in cc-mode and paren.el (' inside string) Date: Sun, 31 Mar 2002 10:40:52 +0000 Organization: muc.de e.V. -- private internet access Sender: bug-gnu-emacs-admin@gnu.org Message-ID: NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1017571344 14872 127.0.0.1 (31 Mar 2002 10:42:24 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 31 Mar 2002 10:42:24 +0000 (UTC) Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16rcn2-0003rl-00 for ; Sun, 31 Mar 2002 12:42:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16rcmx-0006ur-00; Sun, 31 Mar 2002 05:42:19 -0500 Original-Received: from marvin.muc.de ([193.149.48.2]) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 16rclH-0006lF-00 for ; Sun, 31 Mar 2002 05:40:35 -0500 Original-Received: (qmail 12916 invoked by uid 8); 31 Mar 2002 10:40:04 -0000 Original-To: gnu-emacs-bug@prep.ai.mit.edu Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 34 Original-NNTP-Posting-Host: acm.muc.de Original-X-Trace: marvin.muc.de 1017571204 12792 193.149.49.134 (31 Mar 2002 10:40:04 GMT) Original-X-Complaints-To: news-admin@muc.de Original-NNTP-Posting-Date: 31 Mar 2002 10:40:04 GMT User-Agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686)) Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:323 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:323 [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").