From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: HELP, PLEASE! Syntax problem! Date: Wed, 25 Nov 2009 09:43:01 -0500 Message-ID: References: <20091125125810.GA4734@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1259160201 12176 80.91.229.12 (25 Nov 2009 14:43:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Nov 2009 14:43:21 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 25 15:43:14 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NDJ5N-000859-MA for ged-emacs-devel@m.gmane.org; Wed, 25 Nov 2009 15:43:14 +0100 Original-Received: from localhost ([127.0.0.1]:56596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDJ5N-0005I6-7D for ged-emacs-devel@m.gmane.org; Wed, 25 Nov 2009 09:43:13 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NDJ5H-0005HM-Ig for emacs-devel@gnu.org; Wed, 25 Nov 2009 09:43:07 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NDJ5D-0005FP-87 for emacs-devel@gnu.org; Wed, 25 Nov 2009 09:43:07 -0500 Original-Received: from [199.232.76.173] (port=47491 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NDJ5C-0005FF-Vf for emacs-devel@gnu.org; Wed, 25 Nov 2009 09:43:03 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:3342 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NDJ5C-00057M-W1 for emacs-devel@gnu.org; Wed, 25 Nov 2009 09:43:03 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvYEAFDRDEtFpYc//2dsb2JhbACBTdQphDIEihY X-IronPort-AV: E=Sophos;i="4.47,286,1257138000"; d="scan'208";a="49990677" Original-Received: from 69-165-135-63.dsl.teksavvy.com (HELO pastel.home) ([69.165.135.63]) by ironport2-out.pppoe.ca with ESMTP; 25 Nov 2009 09:43:01 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id C25F980E3; Wed, 25 Nov 2009 09:43:01 -0500 (EST) In-Reply-To: <20091125125810.GA4734@muc.de> (Alan Mackenzie's message of "Wed, 25 Nov 2009 12:58:10 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:117743 Archived-At: > In the following fragment of code: > 1 int a = foo ( > 2 1); > 3 #define X(A, B) \ > 4 do { \ > 5 printf (A, B); \ > 6 } while (0) > 7 int a = foo ( > 8 1); > , there is a C macro between lines 3 and 6. The syntax-table properties > here have been manipulated (see below). Putting point at the "(" in L5 > and doing C-M-n takes point to after ")" ON LINE 8. Similar things > happen with C-M-p, C-M-u from various places inside the macro > Evidently, all syntactic properties inside the macro have been > suppressed. This is not wanted. The first problem is most likely that `syntax-table' is only special for text-properties, not for char-properties in general (i.e. when placed on an overlay, it has no effect). Of course, the real problem is that the syntax-table hacking you're doing here is just that: a hack. Maybe another hack would have fewer shortcomings? E.g. maybe you could place a syntax-table property on the # that says "beginning of comment" and a matching "end of comment" on the newline that terminates line 6? Then again, our syntax-tables are too limited in their comment handling, so given that CC already uses most forms of comments, it'll be difficult to make sure that # only matches that particular comment ender and not just "any \n" or "*/", but maybe just marking the "\\\n" that get in the way as "punctuation" would solve it? Stefan