GNU bug report logs -
#25608
CC Mode 5.33 (C/l); Incorrect syntactic information and indentation after multi-line comment with parenthesis or keywords
Previous Next
Full log
Message #11 received at 25608 <at> debbugs.gnu.org (full text, mbox):
Hello, Chris.
On Thu, Feb 02, 2017 at 13:45:36 +0000, Chris Wagner wrote:
> Hello,
> With the following c code:
> /*-----------------------------------------------------------------------------
> (c) Copyright notice containing open parentheses
> -----------------------------------------------------------------------------*/
> /*---------------------------------------------------------------------------*/
> the last line is indented incorrectly, as the identified syntactic
> information is ((topmost-intro-cont 1) (comment-intro)). I think it
> should be ((topmost-intro 1) (comment-intro)), which the following code
> correctly identifies:
> /*-----------------------------------------------------------------------------
> Non parenthesis language
> -----------------------------------------------------------------------------*/
> /*---------------------------------------------------------------------------*/
> Similarly, if there is a keyword in the comment, the next comment is
> incorrectly identified and indented:
> /*-----------------------------------------------------------------------------
> (c) Copyright notice containing open parentheses
> Line containing keyword for
> -----------------------------------------------------------------------------*/
> /*---------------------------------------------------------------------------*/
> Note that indenting the comment region removes the problem:
> /*-----------------------------------------------------------------------------
> (c) Copyright notice containing open parentheses
> Line containing keyword for
> -----------------------------------------------------------------------------*/
> /*---------------------------------------------------------------------------*/
> indents correctly.
> Best regards,
> Chris
The problem in all these cases which fail is the open parenthesis at
column zero inside the comment. This (currently) causes mis-analysis of
the code around it, as detailed in the Emacs manual on page "Left Margin
Paren".
However, I would be the first to agree with you that this is a fault in
Emacs rather than anything wrong with your source code, which is
perfectly normal C. There is a fix for this problem, and I have some
hope that this fix will be incorporated into Emacs 26.
[ CC Mode configuration dump snipped, but appreciated. ]
> Dr Chris Wagner
> Senior Consultant, Medical Technology
> Cambridge Consultants
> Science Park, Milton Road
> Cambridge, CB4 0DW, England
> Switchboard: +44 (0)1223 420024
> Direct dial: +44 (0)1223 392497
> Fax: +44 (0)1223 423373
> chris.wagner <at> cambridgeconsultants.com
> www.CambridgeConsultants.com
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 8 years and 135 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.