From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Liran Zvibel Newsgroups: gmane.emacs.bugs Subject: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el Date: Thu, 31 Jul 2014 18:33:28 +0300 Message-ID: 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 1406827042 24589 80.91.229.3 (31 Jul 2014 17:17:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 31 Jul 2014 17:17:22 +0000 (UTC) To: 18158@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 31 19:17:16 2014 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 1XCtye-0002Tg-Dh for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Jul 2014 19:17:16 +0200 Original-Received: from localhost ([::1]:57893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCtyd-0003Y0-MI for geb-bug-gnu-emacs@m.gmane.org; Thu, 31 Jul 2014 13:17:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCtyV-0003Xt-83 for bug-gnu-emacs@gnu.org; Thu, 31 Jul 2014 13:17:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCtyQ-0002lS-Ig for bug-gnu-emacs@gnu.org; Thu, 31 Jul 2014 13:17:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46259) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCtyQ-0002lO-EA for bug-gnu-emacs@gnu.org; Thu, 31 Jul 2014 13:17:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XCtyQ-0001bB-0E for bug-gnu-emacs@gnu.org; Thu, 31 Jul 2014 13:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Liran Zvibel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 31 Jul 2014 17:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18158 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14068269726068 (code B ref -1); Thu, 31 Jul 2014 17:17:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 31 Jul 2014 17:16:12 +0000 Original-Received: from localhost ([127.0.0.1]:53200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XCtxb-0001Zm-Dr for submit@debbugs.gnu.org; Thu, 31 Jul 2014 13:16:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51855) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XCsMg-0007XH-Gj for submit@debbugs.gnu.org; Thu, 31 Jul 2014 11:33:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCsMW-000413-Gi for submit@debbugs.gnu.org; Thu, 31 Jul 2014 11:33:53 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:38318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCsMW-00040z-EW for submit@debbugs.gnu.org; Thu, 31 Jul 2014 11:33:48 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCsMR-0004vJ-OX for bug-gnu-emacs@gnu.org; Thu, 31 Jul 2014 11:33:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XCsMN-00040J-35 for bug-gnu-emacs@gnu.org; Thu, 31 Jul 2014 11:33:43 -0400 Original-Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:42379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XCsMM-0003zP-Rh for bug-gnu-emacs@gnu.org; Thu, 31 Jul 2014 11:33:39 -0400 Original-Received: by mail-wi0-f172.google.com with SMTP id n3so9549577wiv.11 for ; Thu, 31 Jul 2014 08:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:subject:mime-version:content-type :content-transfer-encoding:content-disposition; bh=VexKV965hFhc1sAjWHPr0eZiTVOSFrDXE2d6uzudXrI=; b=JPiy3dTq4bg2ZJdA8gsMnqAHVTKE4yrqZH5uOeAlu6xD/kMvOdnQUTV/W57K+rAoi4 orQgtyjLj5pcBc1rjYYQPxXJ1TetggzkGRAh1Js70pXVuLyQM7s/GzORO7n1iWeX/vSe QD6ShYRJ8Ppxy35TMkh4/K1mUZJieHLCUhhsINdIWs/73GZR0s6GS3UvC/y6Lk1JSzvZ RuZfs7ERAW096jIEWzpjFL15Vev8/6JafTIxVjsnVf6eFJ6Lo8OpyQT2GjNcNnHgKkG0 BBXPu6q/r0HKqNN2zKWena2l/qFj75jg31ZTcXgb7mPiNvwwWGB/W0Rou+O5+DNKfxME ie1Q== X-Received: by 10.194.187.241 with SMTP id fv17mr18266378wjc.13.1406820812227; Thu, 31 Jul 2014 08:33:32 -0700 (PDT) Original-Received: from engine.local (dialup-62-0-73-102.jlm.netvision.net.il. [62.0.73.102]) by mx.google.com with ESMTPSA id dj2sm67334114wib.11.2014.07.31.08.33.30 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 08:33:31 -0700 (PDT) X-Mailer: Airmail (247) Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Thu, 31 Jul 2014 13:16:09 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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:92008 Archived-At: 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: =46ix extra indent of d-mode =C2=A0=22else static if=22 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=3FEditorSupport/EmacsDMode/ElseSta= ticIf The simple fix treats =22static if=22 same as =E2=80=9Cif=22 that comes r= ight after an =E2=80=9Celse=22. 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 =22else=5C=5C>=5B=5E=5F=5D=22) =C2=A0 =C2=A0 =C2=A0 (save-excursion =C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char old-pos) =21 =C2=A0 =C2=A0 =C2=A0 (looking-at =22if=5C=5C>=5B=5E=5F=5D=22))) =C2=A0 ;; Special case to avoid deeper and deeper indentation =21 ;; of =22else if=22 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 =22else=5C=5C>=5B=5E=5F=5D=22) =C2=A0 =C2=A0 =C2=A0 (save-excursion =C2=A0 =C2=A0 =C2=A0 =C2=A0 (goto-char old-pos) =21 =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 =22if=5C=5C>=5B= =5E=5F=5D=22) =21 =C2=A0 (looking-at =22static=5C=5C>=5B=5E=5F=5D=22)))) =C2=A0 ;; Special case to avoid deeper and deeper indentation =21 ;; of =22else if=22/=22static else if=22 clauses. =C2=A0 ) =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((and (not stop-at-boi-only)