From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#22246: 24.4; C-Mode: Syntax-Highlighting for =?UTF-8?Q?=E2=80=9E//=E2=80=9C-Comment-Line?= continued with =?UTF-8?Q?=E2=80=9E\=E2=80=9C?= Date: 28 Dec 2015 17:55:51 -0000 Organization: muc.de e.V. Message-ID: <20151228175551.41699.qmail@mail.muc.de> References: <20151226145948.GA30399@localhost> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1451325382 25366 80.91.229.3 (28 Dec 2015 17:56:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 28 Dec 2015 17:56:22 +0000 (UTC) Cc: 22246@debbugs.gnu.org To: Andreas Pickart Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 28 18:56:13 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aDc1k-0006TT-9k for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Dec 2015 18:56:12 +0100 Original-Received: from localhost ([::1]:45664 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDc1j-0006R3-Mg for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Dec 2015 12:56:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDc1f-0006Qk-FE for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2015 12:56:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDc1e-0003jB-Bu for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2015 12:56:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDc1a-0003io-K6; Mon, 28 Dec 2015 12:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aDc1a-0006IS-D3; Mon, 28 Dec 2015 12:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 28 Dec 2015 17:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22246 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 22246-submit@debbugs.gnu.org id=B22246.145132535524191 (code B ref 22246); Mon, 28 Dec 2015 17:56:02 +0000 Original-Received: (at 22246) by debbugs.gnu.org; 28 Dec 2015 17:55:55 +0000 Original-Received: from localhost ([127.0.0.1]:46645 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aDc1T-0006I7-5E for submit@debbugs.gnu.org; Mon, 28 Dec 2015 12:55:55 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:46893) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aDc1R-0006Hy-DM for 22246@debbugs.gnu.org; Mon, 28 Dec 2015 12:55:54 -0500 Original-Received: (qmail 41700 invoked by uid 3782); 28 Dec 2015 17:55:51 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.2-RELEASE-p7 (amd64)) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:110902 Archived-At: Hello, Andreas. There's now at least a provisional fix to this bug in the Emacs repository release branch. In article you wrote: > [-- text/plain, encoding quoted-printable, charset: utf-8, 114 lines --= ] > In Standard-C, it is allowed to continue Lines with a Backslash (=E2=80= =9E\=E2=80=9C). > This even works for Single-Line-Comments (=E2=80=9E//=E2=80=9C). But th= e C-Mode of Emacs > does not colour the Continuation-Line right in this Case. Thanks for taking the trouble to report this bug. > In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5) > of 2015-03-07 on trouble, modified by Debian I've converted the fix to work on Emacs 24.4, but after applying the patch, you'll need (i) to rebuild the Emacs binary, and also (ii) to rebuild CC Mode. If you want any help on these, feel free to send me a private email. Here's the patch for Emacs 24.4: --- src/syntax.c~ 2015-12-28 17:31:54.658565440 +0000 +++ src/syntax.c 2015-12-28 16:26:02.057742664 +0000 @@ -139,6 +139,7 @@ =20 static Lisp_Object Qsyntax_table_p; static Lisp_Object Qsyntax_table, Qscan_error; +static Lisp_Object Qcomment_end_can_be_escaped; =20 /* This is the internal form of the parse state used in parse-partial-se= xp. */ =20 @@ -734,8 +735,10 @@ || SYNTAX_FLAGS_COMMENT_NESTED (syntax) !=3D comnested)) continue; =20 - /* Ignore escaped characters, except comment-enders. */ - if (code !=3D Sendcomment && char_quoted (from, from_byte)) + /* Ignore escaped characters, except comment-enders which cannot + be escaped. */ + if ((Vcomment_end_can_be_escaped || code !=3D Sendcomment) + && char_quoted (from, from_byte)) continue; =20 switch (code) @@ -2286,7 +2289,8 @@ if (code =3D=3D Sendcomment && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) =3D=3D style && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? - (nesting > 0 && --nesting =3D=3D 0) : nesting < 0)) + (nesting > 0 && --nesting =3D=3D 0) : nesting < 0) + && !(Vcomment_end_can_be_escaped && char_quoted (from, from_by= te))) /* we have encountered a comment end of the same style as the comment sequence which began this comment section */ @@ -3641,6 +3645,12 @@ In both cases, LIMIT bounds the search. */); Vfind_word_boundary_function_table =3D Fmake_char_table (Qnil, Qnil); =20 + DEFVAR_BOOL ("comment-end-can-be-escaped", Vcomment_end_can_be_escaped= , + doc: /* Non-nil means an escaped ender inside a comment d= oesn't end the comment. */); + Vcomment_end_can_be_escaped =3D 0; + DEFSYM (Qcomment_end_can_be_escaped, "comment-end-can-be-escaped"); + Fmake_variable_buffer_local (Qcomment_end_can_be_escaped); + defsubr (&Ssyntax_table_p); defsubr (&Ssyntax_table); defsubr (&Sstandard_syntax_table); --- lisp/progmodes/cc-langs.el~ 2014-06-14 23:51:42.000000000 +0000 +++ lisp/progmodes/cc-langs.el 2015-12-28 16:18:41.226762430 +0000 @@ -1380,6 +1380,14 @@ "\\)\\s *")) (c-lang-setvar comment-start-skip (c-lang-const comment-start-skip)) =20 +(c-lang-defconst comment-end-can-be-escaped + "When non-nil, escaped EOLs inside comments are valid. +This works in Emacs >=3D 25.1." + t nil + (c c++ objc) t) +(c-lang-setvar comment-end-can-be-escaped + (c-lang-const comment-end-can-be-escaped)) + (c-lang-defconst c-syntactic-ws-start ;; Regexp matching any sequence that can start syntactic whitespace. ;; The only uncertain case is '#' when there are cpp directives. --=20 Alan Mackenzie (Nuremberg, Germany).