From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63286: 30.0.50; CC Mode: New `c-for-clauses-as-arglist' style variable Date: Fri, 05 May 2023 07:57:32 +0300 Message-ID: <83sfcbjryb.fsf@gnu.org> References: <1769719.uSAL7GYomB@ravel> <2123423.7n0gGkaxiF@ravel> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37991"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 63286@debbugs.gnu.org To: Olivier Certner , Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 05 06:57:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1punVQ-0009h1-BR for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 05 May 2023 06:57:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1punVA-0004SH-2n; Fri, 05 May 2023 00:57:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1punV9-0004S3-3K for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 00:57:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1punV8-0003LO-RD for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 00:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1punV8-00028F-8f for bug-gnu-emacs@gnu.org; Fri, 05 May 2023 00:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 May 2023 04:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63286 X-GNU-PR-Package: emacs Original-Received: via spool by 63286-submit@debbugs.gnu.org id=B63286.16832626128176 (code B ref 63286); Fri, 05 May 2023 04:57:02 +0000 Original-Received: (at 63286) by debbugs.gnu.org; 5 May 2023 04:56:52 +0000 Original-Received: from localhost ([127.0.0.1]:52820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1punUv-00027m-RP for submit@debbugs.gnu.org; Fri, 05 May 2023 00:56:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1punUs-00027U-0M for 63286@debbugs.gnu.org; Fri, 05 May 2023 00:56:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1punUl-0003H8-Ca; Fri, 05 May 2023 00:56:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9a98CkyApnCQJwRp1w7BB49Pdr3ZrwOfWi8YFnsReKs=; b=E+y46GADUxhe bjA1MZ6O07td3VDM/GNU6aR601w8P7K1ViXCp73BfDtuCElt3gkBViyjShLFM3GAfCoBHROh2080G ++nbxDhp+HhgIPQV6cB4hDkHkpVkxBAT2h+CxasIILWYfaS95H6apk1dVScjDDVeutQpSkm2WndKa o8VtK9GTs8DeUd6Rf+WXk+oX9vMYBbJUKMKEBfOxnrbHyToBOV4InR1hTGh0GoHWNPhA4jWzP/hYH oiAHCXEA49mZFsVRfToXmMJdxZcCmZnx+rOBTtXmqG5XHc+7RhjFaxJUjSfHU7aw1E+A8rKGl1Fmm 4WcLVEaq4JA5CQcw3M3Uwg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1punUk-0000Nf-QR; Fri, 05 May 2023 00:56:39 -0400 In-Reply-To: <2123423.7n0gGkaxiF@ravel> (message from Olivier Certner on Fri, 05 May 2023 00:22:12 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261048 Archived-At: > From: Olivier Certner > Date: Fri, 05 May 2023 00:22:12 +0200 > > This new style variable allows to disable special handling of "for" > statements' clauses, which is that there are indented as statements, > or continuations of such, when on separate lines instead of argument > lists or continuations of such. I don't think I understand the feature you are proposing. Can you elaborate, perhaps with examples? > --- a/doc/misc/cc-mode.texi > +++ b/doc/misc/cc-mode.texi > @@ -2624,6 +2624,7 @@ Style Variables > Commas});@* > @code{c-cleanup-list} (@pxref{Clean-ups});@* > @code{c-basic-offset} (@pxref{Customizing Indentation});@* > +@code{c-for-clauses-as-arglist} (@pxref{Syntactic Symbols});@* > @code{c-offsets-alist} (@pxref{c-offsets-alist});@* > @code{c-comment-only-line-offset} (@pxref{Comment Line-Up});@* > @code{c-special-indent-hook}, @code{c-label-minimum-indentation} > @@ -4267,7 +4268,8 @@ Syntactic Symbols > Subsequent lines in an enum or static array list where the line begins > with an open brace. @ref{Brace List Symbols}. > @item statement > -A statement. @ref{Function Symbols}. > +A statement, including `for' clauses except if > +@code{c-for-clauses-as-arglist} is true. @ref{Function Symbols}. > @item statement-cont > A continuation of a statement. @ref{Function Symbols}. > @item annotation-var-cont > @@ -4309,15 +4311,22 @@ Syntactic Symbols > @item comment-intro > A line containing only a comment introduction. @ref{Literal Symbols}. > @item arglist-intro > -The first line in an argument list. @ref{Paren List Symbols}. > +The first line in an argument list or a parenthesized expression. > +Note that @code{for} clauses are rather considered statements (or > +their continuation) except if @code{c-for-clauses-as-arglist} is true. > +@ref{Paren List Symbols}. > @item arglist-cont > Subsequent argument list lines when no arguments follow on the same > -line as the arglist opening paren. @ref{Paren List Symbols}. > +line as the arglist opening paren. Same remark concerning @code{for} > +clauses as for @code{arglist-intro} above. @ref{Paren List Symbols}. > @item arglist-cont-nonempty > Subsequent argument list lines when at least one argument follows on > -the same line as the arglist opening paren. @ref{Paren List Symbols}. > +the same line as the arglist opening paren. Same remark concerning > +@code{for} clauses as for @code{arglist-intro} above. @ref{Paren List > +Symbols}. > @item arglist-close > -The solo close paren of an argument list. @ref{Paren List Symbols}. > +The solo close paren of an argument list or a @code{for} clause. > +@ref{Paren List Symbols}. > @item stream-op > Lines continuing a stream operator (C++ only). @ref{Literal > Symbols}. @c @emph{FIXME!!! Can this not be moved somewhere better?} This uses @ref incorrectly. The original text also uses it incorrectly. Alan, please fix that when you have time: those should be @xref, not @ref. The latter is not appropriate at the beginning of a sentence. > +(defcustom-c-stylevar c-for-clauses-as-arglist nil > + "Whether to consider for clauses as part of an argument list. "for" should be quoted here, to make this sentence more clear. > +The clauses of the for statement are normally considered by CC > +mode as separate statements when at start of a line \(and > +statement continuations when split). Setting this variable to > +non-nil indicates that they should be treated as any other > +argument lists." I don't understand what "argument lists" have to do with 'for'. Or maybe I don't understand what you mean by "for clauses". > + :type 'boolean > + :group 'c) Defcustoms should have the :version tag. Finally, would it be possible to have tests for this feature? Thanks.