From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el Date: Mon, 20 Jan 2020 22:18:05 +0100 Message-ID: <87blqxq12q.fsf@marxist.se> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="91953"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 18158@debbugs.gnu.org, Liran Zvibel To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 20 22:19:12 2020 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 1iteS0-000Nt7-DY for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Jan 2020 22:19:12 +0100 Original-Received: from localhost ([::1]:44248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iteRz-00045B-Gy for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 20 Jan 2020 16:19:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47151) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iteRr-00044q-M2 for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2020 16:19:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iteRq-0004xY-Cd for bug-gnu-emacs@gnu.org; Mon, 20 Jan 2020 16:19:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40209) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iteRq-0004xO-94; Mon, 20 Jan 2020 16:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iteRq-00088Y-3c; Mon, 20 Jan 2020 16:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 20 Jan 2020 21:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: patch Original-Received: via spool by 18158-submit@debbugs.gnu.org id=B18158.157955509531210 (code B ref 18158); Mon, 20 Jan 2020 21:19:02 +0000 Original-Received: (at 18158) by debbugs.gnu.org; 20 Jan 2020 21:18:15 +0000 Original-Received: from localhost ([127.0.0.1]:46182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iteR5-00087K-8y for submit@debbugs.gnu.org; Mon, 20 Jan 2020 16:18:15 -0500 Original-Received: from ted.gofardesign.uk ([67.225.143.91]:48598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iteR3-000873-8q for 18158@debbugs.gnu.org; Mon, 20 Jan 2020 16:18:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=s652HofXdmU3lB8fFyRDKQp7PnBnr6vGCjTaeu9qk6U=; b=ZLpK5lS41MvXDrV1AM0WUN6YlH 4Ktlp5l8HlAPhjw4ANj/ir+8ksblDFW8F3xbDKdhE0VeDBbtKrYdgIm1olLFjB+lJsFzrZ48UM1jI xSU634gQzHlio/nr9ZWr5yYsZZ3dse8Q1ltLnVHnYTDM/+IT+vfVhvoehl8RDAUuPp6lRatfhkdsy PugGADo3gh5mrkl7JCc9oEIlRts2Dyj8N14BoD5sH2djujOFI/JMRQOlK2a7fJZKl9jiJfzukW7Sf s7OS46pByn9fwEBya/zAYBu0yXd02Zs1+l9Qafw6ytzgwsPEurHpIwjoADqsLhlO/gwHtFjUL3KsK cNrG/UNQ==; Original-Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:40030 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iteQw-000P04-S4; Mon, 20 Jan 2020 16:18:07 -0500 In-Reply-To: (Liran Zvibel's message of "Thu, 31 Jul 2014 18:33:28 +0300") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se 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: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:174961 Archived-At: Hi Alan, Could you please help review also the below patch for cc-engine.el? Thanks in advance. Best regards, Stefan Kangas Liran Zvibel writes: > Hi, > > I=E2=80=99m not subscribed to this list (or to -devel), so please reply a= lso to my email when responding. > > Thanks, > Liran Zvibel. > > ** Description: > > Fix extra indent of d-mode =C2=A0"else static if" statements=C2=A0 > > The D programming language has a notion of =E2=80=9Cstatic if=E2=80=9D co= nditionals. > The d-mode (from https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode= .git) > requires cc-mode. > When writing =E2=80=9Celse static if=E2=80=9D blocks, the code block is g= etting indented twice, > as well as all future =E2=80=9Celse static if=E2=80=9Ds that come later. = This is very annoying. > > This simple fix was originally suggested here:=C2=A0 > http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode/ElseStati= cIf > The simple fix treats "static if" same as =E2=80=9Cif" that comes right a= fter an =E2=80=9Celse". > > I fixed it locally in my installed emacs long time ago, but today when do= wnloading=C2=A0 > trunk to test 24.4 I was disappointed it was not already fixed by someone= else.=C2=A0 > I know many D programmers that apply this change locally to their install= ed Emacs,=C2=A0 > hopefully not for long. > > ** ChangeLog > > 2014-07-31 Liran Zvibel > > * Small cc-mode change to make sure =E2=80=9Celse static if=E2=80=9D doe= s not get=C2=A0 > deeper and deeper indentation the same way that =E2=80=9Celse if=E2=80= =9D is treated=C2=A0 > for d-mode that requires cc-mode. > > ** The patch : > > =3D=3D=3D modified file 'lisp/progmodes/cc-engine.el' > *** lisp/progmodes/cc-engine.el 2014-06-29 11:26:47 +0000 > --- lisp/progmodes/cc-engine.el 2014-07-31 15:22:15 +0000 > *************** comment at the start of cc-engine.el for > *** 9053,9061 **** > =C2=A0 =C2=A0 =C2=A0 (looking-at "else\\>[^_]") > =C2=A0 =C2=A0 =C2=A0 (save-excursion > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char old-pos) > ! =C2=A0 =C2=A0 =C2=A0 (looking-at "if\\>[^_]"))) > =C2=A0 ;; Special case to avoid deeper and deeper indentation > ! ;; of "else if" clauses. > =C2=A0 ) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((and (not stop-at-boi-only) > --- 9053,9062 ---- > =C2=A0 =C2=A0 =C2=A0 (looking-at "else\\>[^_]") > =C2=A0 =C2=A0 =C2=A0 (save-excursion > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char old-pos) > ! =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(or (looking-at "if\\>[^_]") > ! =C2=A0 (looking-at "static\\>[^_]")))) > =C2=A0 ;; Special case to avoid deeper and deeper indentation > ! ;; of "else if"/"static else if" clauses. > =C2=A0 ) > > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((and (not stop-at-boi-only)