X-Loop: help-debbugs@HIDDEN Subject: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el Resent-From: Liran Zvibel <liranz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Thu, 31 Jul 2014 17:17:01 +0000 Resent-Message-ID: <handler.18158.B.14068269726068 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 18158 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 18158 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.14068269726068 (code B ref -1); Thu, 31 Jul 2014 17:17:01 +0000 Received: (at submit) by debbugs.gnu.org; 31 Jul 2014 17:16:12 +0000 Received: from localhost ([127.0.0.1]:53200 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1XCtxb-0001Zm-Dr for submit <at> debbugs.gnu.org; Thu, 31 Jul 2014 13:16:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51855) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from <liranz@HIDDEN>) id 1XCsMg-0007XH-Gj for submit <at> debbugs.gnu.org; Thu, 31 Jul 2014 11:33:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <liranz@HIDDEN>) id 1XCsMW-000413-Gi for submit <at> debbugs.gnu.org; Thu, 31 Jul 2014 11:33:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <liranz@HIDDEN>) id 1XCsMW-00040z-EW for submit <at> debbugs.gnu.org; Thu, 31 Jul 2014 11:33:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <liranz@HIDDEN>) id 1XCsMR-0004vJ-OX for bug-gnu-emacs@HIDDEN; Thu, 31 Jul 2014 11:33:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <liranz@HIDDEN>) id 1XCsMN-00040J-35 for bug-gnu-emacs@HIDDEN; Thu, 31 Jul 2014 11:33:43 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:42379) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <liranz@HIDDEN>) id 1XCsMM-0003zP-Rh for bug-gnu-emacs@HIDDEN; Thu, 31 Jul 2014 11:33:39 -0400 Received: by mail-wi0-f172.google.com with SMTP id n3so9549577wiv.11 for <bug-gnu-emacs@HIDDEN>; 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) 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 <bug-gnu-emacs@HIDDEN> (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 31 Jul 2014 08:33:31 -0700 (PDT) Date: Thu, 31 Jul 2014 18:33:28 +0300 From: Liran Zvibel <liranz@HIDDEN> Message-ID: <etPan.53da61c8.70a64e2a.16175@HIDDEN> X-Mailer: Airmail (247) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Thu, 31 Jul 2014 13:16:09 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -4.0 (----) 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 <liranz=40gmail.com> * 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)
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Liran Zvibel <liranz@HIDDEN> Subject: bug#18158: Acknowledgement (Fix extra indent of d-mode "else static if" statements in cc-engine.el) Message-ID: <handler.18158.B.14068269726068.ack <at> debbugs.gnu.org> References: <etPan.53da61c8.70a64e2a.16175@HIDDEN> X-Gnu-PR-Message: ack 18158 X-Gnu-PR-Package: emacs Reply-To: 18158 <at> debbugs.gnu.org Date: Thu, 31 Jul 2014 17:17:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 18158 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 18158: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D18158 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
Received: (at control) by debbugs.gnu.org; 6 Oct 2019 22:35:18 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 06 18:35:18 2019 Received: from localhost ([127.0.0.1]:46972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1iHF7W-0008BB-ML for submit <at> debbugs.gnu.org; Sun, 06 Oct 2019 18:35:18 -0400 Received: from mail-pg1-f174.google.com ([209.85.215.174]:38257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1iHF7U-0008Aq-H0 for control <at> debbugs.gnu.org; Sun, 06 Oct 2019 18:35:17 -0400 Received: by mail-pg1-f174.google.com with SMTP id x10so7022316pgi.5 for <control <at> debbugs.gnu.org>; Sun, 06 Oct 2019 15:35:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=/5cIAhQf3jx4P7v/Ys8pOBnQDJm4B+xeUkoMYbLrZMY=; b=V3gCrbolxgyFakJU7332FBFo6wjtr46UxxGwpw9+E2vRvXnUIDCrPla0UXwnpPtD3q cwtljxoVlXxtL9pVBgaGza+FX7Fpuih7Rttx883JeiTfqMiONJM6nsl97KG/Sm5eSygT ElwIBv9fsdID6zn1ObxvwbOqO5/OaBeX0ps02ljcqD/jaWoGUC1OtvfciBXQLLxpT2h1 tlBVUY4YY5LfxjoeEXVGnXKisnF6IG632Mc/g3d7aIjFHoa2ltAp7Dj8/Ba+vq7VMlQQ GBrHDH25Ji38cpg6T1LpZwqkMhOo7oE0IndfMFTJ4YioCzW2odyFy7QTTTRcnAgXMwDM JJ1Q== X-Gm-Message-State: APjAAAXIaVjDaAH6kTyw4cab7DdTAzPffUFhH0x+UYfswNRwzYOUO6dL rDCaQqTNHclhcIut27kQtyPdaeN0yEq9fbrSK/+4dEv+gZw= X-Google-Smtp-Source: APXvYqyqxg8lj7xrndnVyCFr5hJbqcb5ZIStT30b9qLs5H9XuGYrsJfK7DYXDFJz8Pljgg/wGL3NMCUNGc2PNq7OypI= X-Received: by 2002:a65:5802:: with SMTP id g2mr28544938pgr.333.1570401310169; Sun, 06 Oct 2019 15:35:10 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas <stefan@HIDDEN> Date: Mon, 7 Oct 2019 00:34:58 +0200 Message-ID: <CADwFkmn9E=KeaaL6etFRLeeZB2N2Pcf6nwdMw_V9+cZp86TXAw@HIDDEN> Subject: To: control <at> debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.3 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 18158 + patch quit Content analysis details: (2.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.215.174 listed in list.dnswl.org] 2.0 BLANK_SUBJECT Subject is present but empty 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 18158 + patch quit Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.215.174 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager 2.0 BLANK_SUBJECT Subject is present but empty 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different tags 18158 + patch quit
X-Loop: help-debbugs@HIDDEN Subject: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el Resent-From: Stefan Kangas <stefan@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN, bug-cc-mode@HIDDEN Resent-Date: Mon, 20 Jan 2020 21:19:02 +0000 Resent-Message-ID: <handler.18158.B18158.157955509531210 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: patch To: Alan Mackenzie <acm@HIDDEN> Cc: 18158 <at> debbugs.gnu.org, Liran Zvibel <liranz@HIDDEN> Received: via spool by 18158-submit <at> debbugs.gnu.org id=B18158.157955509531210 (code B ref 18158); Mon, 20 Jan 2020 21:19:02 +0000 Received: (at 18158) by debbugs.gnu.org; 20 Jan 2020 21:18:15 +0000 Received: from localhost ([127.0.0.1]:46182 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1iteR5-00087K-8y for submit <at> debbugs.gnu.org; Mon, 20 Jan 2020 16:18:15 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:48598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefan@HIDDEN>) id 1iteR3-000873-8q for 18158 <at> 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==; 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 <stefan@HIDDEN>) id 1iteQw-000P04-S4; Mon, 20 Jan 2020 16:18:07 -0500 From: Stefan Kangas <stefan@HIDDEN> In-Reply-To: <etPan.53da61c8.70a64e2a.16175@HIDDEN> (Liran Zvibel's message of "Thu, 31 Jul 2014 18:33:28 +0300") References: <etPan.53da61c8.70a64e2a.16175@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Mon, 20 Jan 2020 22:18:05 +0100 Message-ID: <87blqxq12q.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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@HIDDEN X-Authenticated-Sender: ted.gofardesign.uk: stefan@HIDDEN X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi Alan, Could you please help review also the below patch for cc-engine.el? Thanks in advance. Best regards, Stefan Kangas Liran Zvibel <liranz@HIDDEN> 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 <liranz@HIDDEN> > > * 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)
X-Loop: help-debbugs@HIDDEN Subject: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el Resent-From: Alan Mackenzie <acm@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN, bug-cc-mode@HIDDEN Resent-Date: Sun, 26 Jan 2020 15:30:02 +0000 Resent-Message-ID: <handler.18158.B18158.15800525779864 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: patch To: Stefan Kangas <stefan@HIDDEN> Cc: 18158 <at> debbugs.gnu.org, Liran Zvibel <liranz@HIDDEN> Received: via spool by 18158-submit <at> debbugs.gnu.org id=B18158.15800525779864 (code B ref 18158); Sun, 26 Jan 2020 15:30:02 +0000 Received: (at 18158) by debbugs.gnu.org; 26 Jan 2020 15:29:37 +0000 Received: from localhost ([127.0.0.1]:57291 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ivjqz-0002Z2-H3 for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 10:29:37 -0500 Received: from colin.muc.de ([193.149.48.1]:57531 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1ivjqx-0002Yt-OE for 18158 <at> debbugs.gnu.org; Sun, 26 Jan 2020 10:29:36 -0500 Received: (qmail 35759 invoked by uid 3782); 26 Jan 2020 15:29:33 -0000 Received: from acm.muc.de (p4FE153B6.dip0.t-ipconnect.de [79.225.83.182]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 26 Jan 2020 16:29:31 +0100 Received: (qmail 18631 invoked by uid 1000); 26 Jan 2020 15:29:31 -0000 Date: Sun, 26 Jan 2020 15:29:31 +0000 Message-ID: <20200126152931.GA4829@ACM> References: <etPan.53da61c8.70a64e2a.16175@HIDDEN> <87blqxq12q.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87blqxq12q.fsf@HIDDEN> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Stefan and Liran. On Mon, Jan 20, 2020 at 22:18:05 +0100, Stefan Kangas wrote: > Hi Alan, > Could you please help review also the below patch for cc-engine.el? I'm less than happy about putting a special purpose workaround into a critical bit of CC Mode (c-add-stmt-syntax) without having even seen the problem. Liran, if you're still there and still interested, could you possibly supply me with a sample of D source code containing the problem? I would hope to be able to enhance CC Mode to handle it in a more general and useful fashion. > Thanks in advance. > Best regards, > Stefan Kangas -- Alan Mackenzie (Nuremberg, Germany). > Liran Zvibel <liranz@HIDDEN> writes: > > Hi, > > > > I’m not subscribed to this list (or to -devel), so please reply also to my email when responding. > > > > Thanks, > > Liran Zvibel. > > > > ** Description: > > > > Fix extra indent of d-mode "else static if" statements > > > > The D programming language has a notion of “static if” conditionals. > > The d-mode (from https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode.git) > > requires cc-mode. > > When writing “else static if” blocks, the code block is getting indented twice, > > as well as all future “else static if”s that come later. This is very annoying. > > > > This simple fix was originally suggested here: > > http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode/ElseStaticIf > > The simple fix treats "static if" same as “if" that comes right after an “else". > > > > I fixed it locally in my installed emacs long time ago, but today when downloading > > trunk to test 24.4 I was disappointed it was not already fixed by someone else. > > I know many D programmers that apply this change locally to their installed Emacs, > > hopefully not for long. > > > > ** ChangeLog > > > > 2014-07-31 Liran Zvibel <liranz@HIDDEN> > > > > * Small cc-mode change to make sure “else static if” does not get > > deeper and deeper indentation the same way that “else if” is treated > > for d-mode that requires cc-mode. > > > > ** The patch : > > > > === 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 **** > > (looking-at "else\\>[^_]") > > (save-excursion > > (goto-char old-pos) > > ! (looking-at "if\\>[^_]"))) > > ;; Special case to avoid deeper and deeper indentation > > ! ;; of "else if" clauses. > > ) > > > > ((and (not stop-at-boi-only) > > --- 9053,9062 ---- > > (looking-at "else\\>[^_]") > > (save-excursion > > (goto-char old-pos) > > ! (or (looking-at "if\\>[^_]") > > ! (looking-at "static\\>[^_]")))) > > ;; Special case to avoid deeper and deeper indentation > > ! ;; of "else if"/"static else if" clauses. > > ) > > > > ((and (not stop-at-boi-only)
Received: (at control) by debbugs.gnu.org; 26 Jan 2020 15:37:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 10:37:45 2020 Received: from localhost ([127.0.0.1]:57300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ivjyq-0002nH-NB for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 10:37:44 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:59428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefan@HIDDEN>) id 1ivjyo-0002n0-Se for control <at> debbugs.gnu.org; Sun, 26 Jan 2020 10:37:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding: 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=YHQIRHF2ekh9VvPOTpunpxylEV6oE8GvySy2b/ltVrs=; b=roqyxRQpXV5cDUaRnC0WCt2SaU prEp1w+g12HLWl377tk7sEIRSBbfCy7zs7E6vpC+I2sikPi/5j3T+m52A4ExFJkl+wFkIOo5ocoKQ Ml752iQ8dnRXs6fVGp/R4pPlcic2m0W30ZabbmDv9AT0TJj7ygA/Nyt9ofECStb9Vx7qI7JfLRzrG 5679iEniZWZSBW1x5u+46L9EtjUrvVwEVoKyuGnYjAqEhKmdEMyWNtTcY0Y8Az74uKZ6xwSy0YlVr brdzKl7W81UrZmwMfb9oq66FPRdQZXgKvS2aqBnUoI2Y97t9ePcsn0QHwfpyVNNfBb9qVwvGDIs/e XIsOFhIg==; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:33742 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from <stefan@HIDDEN>) id 1ivjyi-001QvA-LS; Sun, 26 Jan 2020 10:37:36 -0500 From: Stefan Kangas <stefan@HIDDEN> To: Alan Mackenzie <acm@HIDDEN> Subject: Re: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el In-Reply-To: <20200126152931.GA4829@ACM> (Alan Mackenzie's message of "Sun, 26 Jan 2020 15:29:31 +0000") References: <etPan.53da61c8.70a64e2a.16175@HIDDEN> <87blqxq12q.fsf@HIDDEN> <20200126152931.GA4829@ACM> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Sun, 26 Jan 2020 16:37:34 +0100 Message-ID: <875zgy8c01.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain 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@HIDDEN X-Authenticated-Sender: ted.gofardesign.uk: stefan@HIDDEN X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) tags 18158 - patch tags 18158 + moreinfo thanks Hi Alan, Alan Mackenzie <acm@HIDDEN> writes: > I'm less than happy about putting a special purpose workaround into a > critical bit of CC Mode (c-add-stmt-syntax) without having even seen the > problem. > > Liran, if you're still there and still interested, could you possibly > supply me with a sample of D source code containing the problem? Thanks for looking into it. I'm retagging the bug accordingly (see above). Best regards, Stefan Kangas
Received: (at control) by debbugs.gnu.org; 26 Jan 2020 15:37:45 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 10:37:45 2020 Received: from localhost ([127.0.0.1]:57300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ivjyq-0002nH-NB for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 10:37:44 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:59428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefan@HIDDEN>) id 1ivjyo-0002n0-Se for control <at> debbugs.gnu.org; Sun, 26 Jan 2020 10:37:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding: 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=YHQIRHF2ekh9VvPOTpunpxylEV6oE8GvySy2b/ltVrs=; b=roqyxRQpXV5cDUaRnC0WCt2SaU prEp1w+g12HLWl377tk7sEIRSBbfCy7zs7E6vpC+I2sikPi/5j3T+m52A4ExFJkl+wFkIOo5ocoKQ Ml752iQ8dnRXs6fVGp/R4pPlcic2m0W30ZabbmDv9AT0TJj7ygA/Nyt9ofECStb9Vx7qI7JfLRzrG 5679iEniZWZSBW1x5u+46L9EtjUrvVwEVoKyuGnYjAqEhKmdEMyWNtTcY0Y8Az74uKZ6xwSy0YlVr brdzKl7W81UrZmwMfb9oq66FPRdQZXgKvS2aqBnUoI2Y97t9ePcsn0QHwfpyVNNfBb9qVwvGDIs/e XIsOFhIg==; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:33742 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from <stefan@HIDDEN>) id 1ivjyi-001QvA-LS; Sun, 26 Jan 2020 10:37:36 -0500 From: Stefan Kangas <stefan@HIDDEN> To: Alan Mackenzie <acm@HIDDEN> Subject: Re: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el In-Reply-To: <20200126152931.GA4829@ACM> (Alan Mackenzie's message of "Sun, 26 Jan 2020 15:29:31 +0000") References: <etPan.53da61c8.70a64e2a.16175@HIDDEN> <87blqxq12q.fsf@HIDDEN> <20200126152931.GA4829@ACM> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Date: Sun, 26 Jan 2020 16:37:34 +0100 Message-ID: <875zgy8c01.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain 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@HIDDEN X-Authenticated-Sender: ted.gofardesign.uk: stefan@HIDDEN X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) tags 18158 - patch tags 18158 + moreinfo thanks Hi Alan, Alan Mackenzie <acm@HIDDEN> writes: > I'm less than happy about putting a special purpose workaround into a > critical bit of CC Mode (c-add-stmt-syntax) without having even seen the > problem. > > Liran, if you're still there and still interested, could you possibly > supply me with a sample of D source code containing the problem? Thanks for looking into it. I'm retagging the bug accordingly (see above). Best regards, Stefan Kangas
X-Loop: help-debbugs@HIDDEN Subject: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el Resent-From: Liran Zvibel <liranz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN, bug-cc-mode@HIDDEN Resent-Date: Wed, 29 Jan 2020 01:28:02 +0000 Resent-Message-ID: <handler.18158.B18158.158026125119619 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: moreinfo To: Alan Mackenzie <acm@HIDDEN> Cc: 18158 <at> debbugs.gnu.org, Stefan Kangas <stefan@HIDDEN> Received: via spool by 18158-submit <at> debbugs.gnu.org id=B18158.158026125119619 (code B ref 18158); Wed, 29 Jan 2020 01:28:02 +0000 Received: (at 18158) by debbugs.gnu.org; 29 Jan 2020 01:27:31 +0000 Received: from localhost ([127.0.0.1]:33109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1iwc8g-00056M-Fa for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 20:27:30 -0500 Received: from mail-pj1-f54.google.com ([209.85.216.54]:54112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <liranz@HIDDEN>) id 1iwc8e-000569-9x for 18158 <at> debbugs.gnu.org; Tue, 28 Jan 2020 20:27:29 -0500 Received: by mail-pj1-f54.google.com with SMTP id n96so1854349pjc.3 for <18158 <at> debbugs.gnu.org>; Tue, 28 Jan 2020 17:27:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=nawrB93myEZJss7q8kOsXvEp85BZcv2l4+/4ks7j1hE=; b=W46K9/bnLcSDGx1z/Ckp/29FhrAoa2V1LktqtWUUiBsCYDWBj1/jZJJLmWuc93nVlA NPMPcOtLebjah1wBsXdMqLc8/3wKqFVOibsGPtALwtlkEgVVjXWQ45CqhrryHvcQci+K vvMLYw9BB1RAqSgOjuviRbhngJaNZdOADDdvWO3PCwNKobkXHU9lcq0t5ENR6/NGQaVP 3jMznDA0ntn5p6vhz25IcYtix/7xa3fA783K5C//ONxCtPsZrCr7B4VuCNJS08tot2md /dDfSfbxMDUjePM5B4aHOe5UHk8bfUyshIUprENXy5A4nj2rkcOVFseILjxOWs41dZl7 fN5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=nawrB93myEZJss7q8kOsXvEp85BZcv2l4+/4ks7j1hE=; b=IQpkceJ6pRIPKMqFH6vIlkyOTx5XJpJGrtRYt2oeOJOPD7JqfvHPICk9mz4tarpCys 4Kn6R50Bis7wa9Zzw5ymTB+5VUlweMrbultypIkovcJYY4PhodEkhkMtKGJMTidTA1Zy sMts5gZHmsWcTt+iyagFCjjkOdaWo9W9uz5Me5oZx00IUzOZ7y1ltoPqQNk5XAjNmowT K8rRK59HXBtQC66VNB4rsKHJTdu0S29ifs70HjfDb17BQoYm+f8X6GaFbYxnvZtK8yRs qmOs9WZGS5P8yocFqJsl6izSHie/PdA1zvL6XpxHRKTdq0t3DisOG9aNK1Mi4qjCtVij iRiA== X-Gm-Message-State: APjAAAX2fEYh36+wlq1cnqNgTOQI5JokPMmbHZMhOuagB7HVblKJ/1wo FJHhI1eApL6vLPckytHzbTo= X-Google-Smtp-Source: APXvYqxVBrjaYvxJq4VN/k00J/bvz7HDxEejUq0NetyVst35MTJUAQEusbAWnDx23F87D+l8qsj0tg== X-Received: by 2002:a17:90a:cb96:: with SMTP id a22mr8055256pju.96.1580261242186; Tue, 28 Jan 2020 17:27:22 -0800 (PST) Received: from [172.19.248.166] ([38.98.37.134]) by smtp.gmail.com with ESMTPSA id r66sm282014pfc.74.2020.01.28.17.27.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jan 2020 17:27:21 -0800 (PST) From: Liran Zvibel <liranz@HIDDEN> Message-Id: <8B3ABB9B-7A39-428A-A65B-B77D0614C9FE@HIDDEN> Content-Type: multipart/alternative; boundary="Apple-Mail=_2CC2DABF-8B2F-430B-B000-CD99C843583F" Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.40.2.2.4\)) Date: Tue, 28 Jan 2020 17:26:41 -0800 In-Reply-To: <20200126152931.GA4829@ACM> References: <etPan.53da61c8.70a64e2a.16175@HIDDEN> <87blqxq12q.fsf@HIDDEN> <20200126152931.GA4829@ACM> X-Mailer: Apple Mail (2.3608.40.2.2.4) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --Apple-Mail=_2CC2DABF-8B2F-430B-B000-CD99C843583F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 @("notrace") JSONValue objToJSON(T)(auto ref const T obj) @trusted { alias U =3D Unqual!T; static if (is(U =3D=3D JSONValue)) { return obj; } else static if (__traits(compiles, obj.toJSON())) { return obj.toJSON(); } else static if (is(U =3D=3D typeof(null))) { return JSONValue(null); } else static if (is(U =3D=3D enum)) { // before the JSONValue casts = as int return JSONValue(obj.to!string); } else static if (isSomeString!U) { if (obj is null) { return JSONValue(null); } else { return JSONValue(obj); } } else static if(is(U =3D=3D SysTime)) { if (obj =3D=3D SysTime.init) { return JSONValue(null); } else { return JSONValue(obj.toUTC().toISOExtString()); } } else static if(is(U =3D=3D Duration)) { auto hns =3D obj.total!"hnsecs"(); if (hns % 10_000_000 =3D=3D 0) { return JSONValue(hns / 10_000_000); } else { return JSONValue(hns / 10_000_000.0); } } else static if (is(U =3D=3D UUID)) { return JSONValue(obj.toString()); } else static if (isFloatingPoint!U) { if (obj !=3D obj || obj =3D=3D U.infinity || obj =3D=3D = -U.infinity) { return JSONValue(null); } else { auto tmp =3D cast(long)obj; if (tmp =3D=3D obj) { // dump as long, to avoid losing percision return JSONValue(tmp); } else { return JSONValue(obj); } } } : > On Jan 26, 2020, at 7:29 AM, Alan Mackenzie <acm@HIDDEN> wrote: >=20 > Hello, Stefan and Liran. >=20 > On Mon, Jan 20, 2020 at 22:18:05 +0100, Stefan Kangas wrote: >> Hi Alan, >=20 >> Could you please help review also the below patch for cc-engine.el? >=20 > I'm less than happy about putting a special purpose workaround into a > critical bit of CC Mode (c-add-stmt-syntax) without having even seen = the > problem. >=20 > Liran, if you're still there and still interested, could you possibly > supply me with a sample of D source code containing the problem? I > would hope to be able to enhance CC Mode to handle it in a more = general > and useful fashion. >=20 >> Thanks in advance. >=20 >> Best regards, >> Stefan Kangas >=20 > --=20 > Alan Mackenzie (Nuremberg, Germany). >=20 >=20 >=20 >> Liran Zvibel <liranz@HIDDEN> writes: >=20 >>> Hi, >>>=20 >>> I=E2=80=99m not subscribed to this list (or to -devel), so please = reply also to my email when responding. >>>=20 >>> Thanks, >>> Liran Zvibel. >>>=20 >>> ** Description: >>>=20 >>> Fix extra indent of d-mode "else static if" statements=20 >>>=20 >>> The D programming language has a notion of =E2=80=9Cstatic if=E2=80=9D= conditionals. >>> 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 getting indented twice, >>> as well as all future =E2=80=9Celse static if=E2=80=9Ds that come = later. This is very annoying. >>>=20 >>> This simple fix was originally suggested here:=20 >>> = http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode/ElseStatic= If >>> The simple fix treats "static if" same as =E2=80=9Cif" that comes = right after an =E2=80=9Celse". >>>=20 >>> I fixed it locally in my installed emacs long time ago, but today = when downloading=20 >>> trunk to test 24.4 I was disappointed it was not already fixed by = someone else.=20 >>> I know many D programmers that apply this change locally to their = installed Emacs,=20 >>> hopefully not for long. >>>=20 >>> ** ChangeLog >>>=20 >>> 2014-07-31 Liran Zvibel <liranz@HIDDEN> >>>=20 >>> * Small cc-mode change to make sure =E2=80=9Celse static if=E2=80=9D= does not get=20 >>> deeper and deeper indentation the same way that =E2=80=9Celse = if=E2=80=9D is treated=20 >>> for d-mode that requires cc-mode. >>>=20 >>> ** The patch : >>>=20 >>> =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 **** >>> (looking-at "else\\>[^_]") >>> (save-excursion >>> (goto-char old-pos) >>> ! (looking-at "if\\>[^_]"))) >>> ;; Special case to avoid deeper and deeper = indentation >>> ! ;; of "else if" clauses. >>> ) >>>=20 >>> ((and (not stop-at-boi-only) >>> --- 9053,9062 ---- >>> (looking-at "else\\>[^_]") >>> (save-excursion >>> (goto-char old-pos) >>> ! (or (looking-at "if\\>[^_]") >>> ! (looking-at "static\\>[^_]")))) >>> ;; Special case to avoid deeper and deeper = indentation >>> ! ;; of "else if"/"static else if" clauses. >>> ) >>>=20 >>> ((and (not stop-at-boi-only) --Apple-Mail=_2CC2DABF-8B2F-430B-B000-CD99C843583F Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D"">@("notrace") JSONValue objToJSON(T)(auto ref const T obj) = @trusted {</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> alias U =3D = Unqual!T;</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> static if (is(U =3D=3D = JSONValue)) {</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> return = obj;</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> }</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> </span><span style=3D"font-variant-ligatures: = no-common-ligatures; color: #ffffff; background-color: #000000" = class=3D"">else static if</span><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> (__traits(compiles, obj.toJSON())) = {</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> return = obj.toJSON();</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> }</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> </span><span style=3D"font-variant-ligatures: = no-common-ligatures; color: #ffffff; background-color: #000000" = class=3D"">else static if</span><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> (is(U =3D=3D typeof(null))) = {</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> return = JSONValue(null);</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> }</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> </span><span style=3D"font-variant-ligatures: = no-common-ligatures; color: #ffffff; background-color: #000000" = class=3D"">else static if</span><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> (is(U =3D=3D enum)) { // before the = JSONValue casts as int</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = return JSONValue(obj.to!string);</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> }</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = </span><span style=3D"font-variant-ligatures: = no-common-ligatures; color: #ffffff; background-color: #000000" = class=3D"">else static if</span><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> (isSomeString!U) {</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> if (obj is null) = {</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = return JSONValue(null);</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = } else {</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = return = JSONValue(obj);</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> }</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> </span><span style=3D"font-variant-ligatures: = no-common-ligatures; color: #ffffff; background-color: #000000" = class=3D"">else static if</span><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">(is(U =3D=3D SysTime)) = {</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> if (obj =3D=3D= SysTime.init) {</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = return JSONValue(null);</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = } else {</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = return = JSONValue(obj.toUTC().toISOExtString());</span></div><div style=3D"margin:= 0px; font-stretch: normal; font-size: 11px; line-height: normal; = font-family: Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> </span><span = style=3D"font-variant-ligatures: no-common-ligatures; color: #ffffff; = background-color: #000000" class=3D"">else static if</span><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D"">(is(U = =3D=3D Duration)) {</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> auto hns =3D = obj.total!"hnsecs"();</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = if (hns % 10_000_000 =3D=3D 0) {</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> return = JSONValue(hns / 10_000_000);</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = else {</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = return JSONValue(hns / = 10_000_000.0);</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> }</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> </span><span style=3D"font-variant-ligatures: = no-common-ligatures; color: #ffffff; background-color: #000000" = class=3D"">else static if</span><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> (is(U =3D=3D UUID)) {</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> return = JSONValue(obj.toString());</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> </span><span = style=3D"font-variant-ligatures: no-common-ligatures; color: #ffffff; = background-color: #000000" class=3D"">else static if</span><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = (isFloatingPoint!U) {</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = if (obj !=3D obj || obj =3D=3D U.infinity || obj =3D=3D= -U.infinity) {</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = return JSONValue(null);</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = else {</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = auto tmp =3D = cast(long)obj;</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = if (tmp =3D=3D obj) {</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = // dump as long, to = avoid losing percision</span></div><div style=3D"margin: 0px; = font-stretch: normal; font-size: 11px; line-height: normal; font-family: = Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = return = JSONValue(tmp);</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = else {</span></div><div style=3D"margin: 0px; font-stretch: = normal; font-size: 11px; line-height: normal; font-family: Menlo; color: = rgb(0, 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D""> = return JSONValue(obj);</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> }</span></div><div = style=3D"margin: 0px; font-stretch: normal; font-size: 11px; = line-height: normal; font-family: Menlo; color: rgb(0, 0, 0);" = class=3D""><span style=3D"font-variant-ligatures: no-common-ligatures" = class=3D""> }</span></div><div style=3D"margin:= 0px; font-stretch: normal; font-size: 11px; line-height: normal; = font-family: Menlo; color: rgb(0, 0, 0);" class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""> = }</span></div><div style=3D"margin: 0px; font-stretch: normal; = font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(0, = 0, 0);" class=3D""><span style=3D"font-variant-ligatures: = no-common-ligatures" class=3D"">:</span></div><div class=3D""><span = style=3D"font-variant-ligatures: no-common-ligatures" class=3D""><br = class=3D""></span></div><div style=3D""><br class=3D""><blockquote = type=3D"cite" class=3D""><div class=3D"">On Jan 26, 2020, at 7:29 AM, = Alan Mackenzie <<a href=3D"mailto:acm@HIDDEN" = class=3D"">acm@HIDDEN</a>> wrote:</div><br = class=3D"Apple-interchange-newline"><div class=3D""><div class=3D"">Hello,= Stefan and Liran.<br class=3D""><br class=3D"">On Mon, Jan 20, 2020 at = 22:18:05 +0100, Stefan Kangas wrote:<br class=3D""><blockquote = type=3D"cite" class=3D"">Hi Alan,<br class=3D""></blockquote><br = class=3D""><blockquote type=3D"cite" class=3D"">Could you please help = review also the below patch for cc-engine.el?<br = class=3D""></blockquote><br class=3D"">I'm less than happy about putting = a special purpose workaround into a<br class=3D"">critical bit of CC = Mode (c-add-stmt-syntax) without having even seen the<br = class=3D"">problem.<br class=3D""><br class=3D"">Liran, if you're still = there and still interested, could you possibly<br class=3D"">supply me = with a sample of D source code containing the problem? I<br = class=3D"">would hope to be able to enhance CC Mode to handle it in a = more general<br class=3D"">and useful fashion.<br class=3D""><br = class=3D""><blockquote type=3D"cite" class=3D"">Thanks in advance.<br = class=3D""></blockquote><br class=3D""><blockquote type=3D"cite" = class=3D"">Best regards,<br class=3D"">Stefan Kangas<br = class=3D""></blockquote><br class=3D"">-- <br class=3D"">Alan Mackenzie = (Nuremberg, Germany).<br class=3D""><br class=3D""><br class=3D""><br = class=3D""><blockquote type=3D"cite" class=3D"">Liran Zvibel <<a = href=3D"mailto:liranz@HIDDEN" class=3D"">liranz@HIDDEN</a>> = writes:<br class=3D""></blockquote><br class=3D""><blockquote = type=3D"cite" class=3D""><blockquote type=3D"cite" class=3D"">Hi,<br = class=3D""><br class=3D"">I=E2=80=99m not subscribed to this list (or to = -devel), so please reply also to my email when responding.<br = class=3D""><br class=3D"">Thanks,<br class=3D"">Liran Zvibel.<br = class=3D""><br class=3D"">** Description:<br class=3D""><br class=3D"">Fix= extra indent of d-mode "else static if" statements <br = class=3D""><br class=3D"">The D programming language has a notion of = =E2=80=9Cstatic if=E2=80=9D conditionals.<br class=3D"">The d-mode (from = <a href=3D"https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode.git" = class=3D"">https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode.git</a= >)<br class=3D"">requires cc-mode.<br class=3D"">When writing =E2=80=9Cels= e static if=E2=80=9D blocks, the code block is getting indented = twice,<br class=3D"">as well as all future =E2=80=9Celse static if=E2=80=9D= s that come later. This is very annoying.<br class=3D""><br = class=3D"">This simple fix was originally suggested here: <br = class=3D""><a = href=3D"http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode/El= seStaticIf" = class=3D"">http://www.prowiki.org/wiki4d/wiki.cgi?EditorSupport/EmacsDMode= /ElseStaticIf</a><br class=3D"">The simple fix treats "static if" same = as =E2=80=9Cif" that comes right after an =E2=80=9Celse".<br = class=3D""><br class=3D"">I fixed it locally in my installed emacs long = time ago, but today when downloading <br class=3D"">trunk to test = 24.4 I was disappointed it was not already fixed by someone = else. <br class=3D"">I know many D programmers that apply this = change locally to their installed Emacs, <br class=3D"">hopefully = not for long.<br class=3D""><br class=3D"">** ChangeLog<br class=3D""><br = class=3D"">2014-07-31 Liran Zvibel <liranz@HIDDEN><br = class=3D""><br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>* Small cc-mode change to make = sure =E2=80=9Celse static if=E2=80=9D does not get <br = class=3D""><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span>deeper and deeper indentation the same way that =E2=80=9Celse = if=E2=80=9D is treated <br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>for d-mode that requires = cc-mode.<br class=3D""><br class=3D"">** The patch :<br class=3D""><br = class=3D"">=3D=3D=3D modified file 'lisp/progmodes/cc-engine.el'<br = class=3D"">*** lisp/progmodes/cc-engine.el<span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>2014-06-29 11:26:47 +0000<br = class=3D"">--- lisp/progmodes/cc-engine.el<span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>2014-07-31 15:22:15 +0000<br = class=3D"">*************** comment at the start of cc-engine.el for<br = class=3D"">*** 9053,9061 ****<br class=3D""> <span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span> = (looking-at "else\\>[^_]")<br class=3D""> <span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span> = (save-excursion<br class=3D""> <span class=3D"Apple-tab-span"= style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span> (goto-char = old-pos)<br class=3D"">! <span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span> (looking-at = "if\\>[^_]")))<br class=3D""> <span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>;; Special case to avoid deeper = and deeper indentation<br class=3D"">! <span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>;; of "else if" clauses.<br = class=3D""> <span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span>)<br class=3D""><br = class=3D""> <span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span><span class=3D"Apple-tab-span" = style=3D"white-space:pre"> </span> ((and (not = stop-at-boi-only)<br class=3D"">--- 9053,9062 ----<br class=3D""> = <span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span> (looking-at "else\\>[^_]")<br class=3D""> = <span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span> (save-excursion<br class=3D""> <span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span> = (goto-char old-pos)<br class=3D"">! = = (or (looking-at "if\\>[^_]")<br class=3D"">! = <span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span> (looking-at "static\\>[^_]"))))<br class=3D""> = <span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span>;; Special case to avoid deeper and deeper indentation<br = class=3D"">! <span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span>;; of "else if"/"static else if" clauses.<br class=3D""> = <span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span><span class=3D"Apple-tab-span" style=3D"white-space:pre"> = </span>)<br class=3D""><br class=3D""> <span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span><span = class=3D"Apple-tab-span" style=3D"white-space:pre"> </span> = ((and (not stop-at-boi-only)<br = class=3D""></blockquote></blockquote></div></div></blockquote></div><br = class=3D""></body></html>= --Apple-Mail=_2CC2DABF-8B2F-430B-B000-CD99C843583F--
X-Loop: help-debbugs@HIDDEN Subject: bug#18158: Fix extra indent of d-mode "else static if" statements in cc-engine.el Resent-From: Alan Mackenzie <acm@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN, bug-cc-mode@HIDDEN Resent-Date: Fri, 31 Jan 2020 19:42:01 +0000 Resent-Message-ID: <handler.18158.B18158.158049967013469 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: moreinfo To: Liran Zvibel <liranz@HIDDEN> Cc: 18158 <at> debbugs.gnu.org, Stefan Kangas <stefan@HIDDEN> Received: via spool by 18158-submit <at> debbugs.gnu.org id=B18158.158049967013469 (code B ref 18158); Fri, 31 Jan 2020 19:42:01 +0000 Received: (at 18158) by debbugs.gnu.org; 31 Jan 2020 19:41:10 +0000 Received: from localhost ([127.0.0.1]:38124 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ixcA9-0003VB-UC for submit <at> debbugs.gnu.org; Fri, 31 Jan 2020 14:41:10 -0500 Received: from colin.muc.de ([193.149.48.1]:54574 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1ixcA7-0003V1-Gf for 18158 <at> debbugs.gnu.org; Fri, 31 Jan 2020 14:41:08 -0500 Received: (qmail 45785 invoked by uid 3782); 31 Jan 2020 19:41:05 -0000 Received: from acm.muc.de (p4FE15D3F.dip0.t-ipconnect.de [79.225.93.63]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 31 Jan 2020 20:41:03 +0100 Received: (qmail 5893 invoked by uid 1000); 31 Jan 2020 19:41:03 -0000 Date: Fri, 31 Jan 2020 19:41:03 +0000 Message-ID: <20200131194103.GA5872@ACM> References: <etPan.53da61c8.70a64e2a.16175@HIDDEN> <87blqxq12q.fsf@HIDDEN> <20200126152931.GA4829@ACM> <8B3ABB9B-7A39-428A-A65B-B77D0614C9FE@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8B3ABB9B-7A39-428A-A65B-B77D0614C9FE@HIDDEN> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Liran. Many thanks for the sample D file. I can indeed reproduce the problem, and I'm looking into ways of fixing it properly, thus removing the need for the workarounds which have found their way into d-mode.el. On Tue, Jan 28, 2020 at 17:26:41 -0800, Liran Zvibel wrote: > @("notrace") JSONValue objToJSON(T)(auto ref const T obj) @trusted { > alias U = Unqual!T; > static if (is(U == JSONValue)) { > return obj; > } > else static if (__traits(compiles, obj.toJSON())) { > return obj.toJSON(); > } > else static if (is(U == typeof(null))) { [ .... ] > } > } > } > : > > On Jan 26, 2020, at 7:29 AM, Alan Mackenzie <acm@HIDDEN> wrote: > > Hello, Stefan and Liran. > > On Mon, Jan 20, 2020 at 22:18:05 +0100, Stefan Kangas wrote: > >> Hi Alan, > >> Could you please help review also the below patch for cc-engine.el? > > I'm less than happy about putting a special purpose workaround into a > > critical bit of CC Mode (c-add-stmt-syntax) without having even seen the > > problem. > > Liran, if you're still there and still interested, could you possibly > > supply me with a sample of D source code containing the problem? I > > would hope to be able to enhance CC Mode to handle it in a more general > > and useful fashion. -- Alan Mackenzie (Nuremberg, Germany).
X-Loop: help-debbugs@HIDDEN Subject: bug#18158: D Mode: Getting rid of the ugly advice on looking-at. References: <etPan.53da61c8.70a64e2a.16175@HIDDEN> In-Reply-To: <etPan.53da61c8.70a64e2a.16175@HIDDEN> Resent-From: Alan Mackenzie <acm@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN, bug-cc-mode@HIDDEN Resent-Date: Sun, 02 Feb 2020 11:57:02 +0000 Resent-Message-ID: <handler.18158.B18158.158064461419840 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: moreinfo To: Russel Winder <russel@HIDDEN>, Vladimir Panteleev <vladimir@HIDDEN> Cc: 18158 <at> debbugs.gnu.org, stefan@HIDDEN, liranz@HIDDEN X-Debbugs-Original-Cc: bug-cc-mode@HIDDEN, 18158 <at> debbugs.gnu.org, Stefan Kangas <stefan@HIDDEN>, Liran Zvibel <liranz@HIDDEN> Received: via spool by 18158-submit <at> debbugs.gnu.org id=B18158.158064461419840 (code B ref 18158); Sun, 02 Feb 2020 11:57:02 +0000 Received: (at 18158) by debbugs.gnu.org; 2 Feb 2020 11:56:54 +0000 Received: from localhost ([127.0.0.1]:39558 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1iyDry-00059w-25 for submit <at> debbugs.gnu.org; Sun, 02 Feb 2020 06:56:54 -0500 Received: from colin.muc.de ([193.149.48.1]:45610 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1iyDro-00059Z-7i for 18158 <at> debbugs.gnu.org; Sun, 02 Feb 2020 06:56:52 -0500 Received: (qmail 46037 invoked by uid 3782); 2 Feb 2020 11:56:42 -0000 Received: from acm.muc.de (p2E5D58E7.dip0.t-ipconnect.de [46.93.88.231]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 02 Feb 2020 12:56:41 +0100 Received: (qmail 5944 invoked by uid 1000); 2 Feb 2020 11:56:41 -0000 Date: Sun, 2 Feb 2020 11:56:41 +0000 Message-ID: <20200202115641.GA5547@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Russel and Vladimir. I am the maintainer of the CC Mode project at Sourceforge, and also CC Mode within Emacs. I hope you don't mind too much me writing to your personal Email addresses - the submission of bug reports to Github is restricted to those with a Github account, and I don't have and don't want a Github account. In the newest released d-mode.el (version 201812050604) at around line 698, advice is added to the function looking-at, such that (looking-at ""if\\>[^_]") will also return t on "static if" (and a couple of other things, too). This was done because of a lack of a needed feature in the base CC Mode. This advice is not ideal. If nothing else, it will be inconvenient should the regexp "if\\>[^_]" ever change to, say, "if\\_>". I am intending to make a change like this throughout CC Mode sometime, since "\\_<" and "\\_>" have existed in Emacs's regexp engine for at least 10 years, now. So, why not add suitable features to CC Mode so that this advice in d-mode.el is not needed any more? In the patches below, I have introduced two new c-lang-defconsts, c-post-else-if-prefix-kwds (which should take the value '("static") in D Mode) and c-post-else-no-indent-kwds (with value '("if" "debug" "version") in D Mode). c-add-stmt-syntax in cc-engine.el has been modified to use (c-lang-defvars derived from) these variables in place of the hard coded "if\\>[^_]". I suggest an amendment to d-mode.el along the lines of my patch below. It is intended to work with both the new CC Mode, and existing CC Mode versions, using a compile time test. At some time in the future, it should be possible to get rid of the old advice mechanism entirely. I propose to commit the patch for CC Mode, below. I would be grateful indeed if either of you could find the time to review it, first. Just a quick tip, though you probably don't need it: when compiling the new d-mode.el, be sure that the new cc-langs.elc has been loaded into your Emacs. So, here is the suggested patch for d-mode.el: --- d-mode.201812050604.el 2018-12-05 06:07:51.000000000 +0000 +++ d-mode.el 2020-02-02 11:31:41.724734790 +0000 @@ -334,6 +334,21 @@ d '("for" "if" "switch" "while" "catch" "synchronized" "scope" "foreach" "foreach_reverse" "with" "unittest")) +(cc-eval-when-compile + (when (c-safe (c-lang-const c-post-else-no-indent-kwds java)) + + (c-lang-defconst c-post-else-if-prefix-kwds + ;; Keywords which can come between "else" and "if" (or some other member + ;; of `c-post-else-no-indent-kwds') without giving the substatement being + ;; introduced extra indentation." + d '("static")) + + (c-lang-defconst c-post-else-no-indent-kwds + ;; Keywords which when following an "else" (possibly with intervening + ;; members of `c-post-else-if-prefix-kwds') do not cause extra + ;; indentation of the substatement being introduced. + d '("if" "debug" "version")))) + (c-lang-defconst c-simple-stmt-kwds ;; Statement keywords followed by an expression or nothing. d '("break" "continue" "goto" "return" "throw")) @@ -695,32 +710,35 @@ ;;---------------------------------------------------------------------------- ;;; Workaround for special case of 'else static if' not being handled properly -(defun d-special-case-looking-at (orig-fun &rest args) - ;; checkdoc-params: (orig-fun args) - "Advice function for fixing cc-mode indentation in certain D constructs." - (let ((rxp (car args))) - (if (and (stringp rxp) (string= rxp "if\\>[^_]")) - (or (apply orig-fun '("static\\>\\s-+if\\>[^_]")) - (apply orig-fun '("version\\>[^_]")) - (apply orig-fun '("debug\\>[^_]")) - (apply orig-fun args)) - (apply orig-fun args)))) - -(defun d-around--c-add-stmt-syntax (orig-fun &rest args) - ;; checkdoc-params: (orig-fun args) - "Advice function for fixing cc-mode indentation in certain D constructs." - (if (not (string= major-mode "d-mode")) - (apply orig-fun args) - (progn - (add-function :around (symbol-function 'looking-at) - #'d-special-case-looking-at) - (unwind-protect - (apply orig-fun args) - (remove-function (symbol-function 'looking-at) - #'d-special-case-looking-at))))) +(cc-eval-when-compile + (unless (c-safe (c-lang-const c-post-else-no-indent-kwds java)) + + (defun d-special-case-looking-at (orig-fun &rest args) + ;; checkdoc-params: (orig-fun args) + "Advice function for fixing cc-mode indentation in certain D constructs." + (let ((rxp (car args))) + (if (and (stringp rxp) (string= rxp "if\\>[^_]")) + (or (apply orig-fun '("static\\>\\s-+if\\>[^_]")) + (apply orig-fun '("version\\>[^_]")) + (apply orig-fun '("debug\\>[^_]")) + (apply orig-fun args)) + (apply orig-fun args)))) + + (defun d-around--c-add-stmt-syntax (orig-fun &rest args) + ;; checkdoc-params: (orig-fun args) + "Advice function for fixing cc-mode indentation in certain D constructs." + (if (not (string= major-mode "d-mode")) + (apply orig-fun args) + (progn + (add-function :around (symbol-function 'looking-at) + #'d-special-case-looking-at) + (unwind-protect + (apply orig-fun args) + (remove-function (symbol-function 'looking-at) + #'d-special-case-looking-at))))) -(when (version<= "24.4" emacs-version) - (advice-add 'c-add-stmt-syntax :around #'d-around--c-add-stmt-syntax)) + (when (version<= "24.4" emacs-version) + (advice-add 'c-add-stmt-syntax :around #'d-around--c-add-stmt-syntax)))) ;;---------------------------------------------------------------------------- ;;;###autoload , and my proposed patch for CC Mode. This patch applies cleanly to the Emacs 26.3 sources, and all later versions in the Emacs savannah repository: diff -r 6a0c16f6ef37 cc-engine.el --- a/cc-engine.el Mon Jan 27 17:50:19 2020 +0000 +++ b/cc-engine.el Sun Feb 02 11:36:01 2020 +0000 @@ -12275,7 +12275,10 @@ (looking-at "else\\>[^_]") (save-excursion (goto-char old-pos) - (looking-at "if\\>[^_]"))) + (while (looking-at c-post-else-if-prefix-key) + (goto-char (match-end 1)) + (c-forward-syntactic-ws)) + (looking-at c-post-else-no-indent-key))) ; e.g. "if" ;; Special case to avoid deeper and deeper indentation ;; of "else if" clauses. ) diff -r 6a0c16f6ef37 cc-langs.el --- a/cc-langs.el Mon Jan 27 17:50:19 2020 +0000 +++ b/cc-langs.el Sun Feb 02 11:36:01 2020 +0000 @@ -2802,6 +2802,34 @@ (c-lang-const c-block-stmt-2-kwds))))) (c-lang-defvar c-opt-block-stmt-key (c-lang-const c-opt-block-stmt-key)) +(c-lang-defconst c-post-else-if-prefix-kwds + "Keywords which can come between \"else\" and \"if\" (or some other member of +`c-post-else-no-indent-kwds') without giving the substatement being introduced +extra indentation." + ;; This is used in D Mode. + t nil) + +(c-lang-defconst c-post-else-if-prefix-key + ;; Regexp matching a keyword in `c-post-else-if-prefix-kwds', or matching + ;; nothing. + t (c-make-keywords-re t (c-lang-const c-post-else-if-prefix-kwds))) +(c-lang-defvar c-post-else-if-prefix-key + (c-lang-const c-post-else-if-prefix-key)) + +(c-lang-defconst c-post-else-no-indent-kwds + "Keywords which when following an \"else\" (possibly with intervening members +of `c-post-else-if-prefix-kwds') do not cause extra indentation of the +substatement being introduced." + ;; This is used non-trivially in D Mode. + t '("if")) + +(c-lang-defconst c-post-else-no-indent-key + ;; Regexp matching a keyword in `c-post-else-no-indent-kwds', or matching + ;; nothing. + t (c-make-keywords-re t (c-lang-const c-post-else-no-indent-kwds))) +(c-lang-defvar c-post-else-no-indent-key + (c-lang-const c-post-else-no-indent-key)) + (c-lang-defconst c-simple-stmt-kwds "Statement keywords followed by an expression or nothing." t '("break" "continue" "goto" "return") -- Alan Mackenzie (Nuremberg, Germany).
X-Loop: help-debbugs@HIDDEN Subject: bug#18158: D Mode: Getting rid of the ugly advice on looking-at. Resent-From: Vladimir Panteleev <vladimir@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN, bug-cc-mode@HIDDEN Resent-Date: Sun, 02 Feb 2020 17:58:01 +0000 Resent-Message-ID: <handler.18158.B18158.15806662298406 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: moreinfo To: Alan Mackenzie <acm@HIDDEN> Cc: 18158 <at> debbugs.gnu.org, stefan@HIDDEN, russel@HIDDEN, liranz@HIDDEN X-Debbugs-Original-Cc: bug-cc-mode@HIDDEN, 18158 <at> debbugs.gnu.org, Stefan Kangas <stefan@HIDDEN>, Russel Winder <russel@HIDDEN>, Liran Zvibel <liranz@HIDDEN> Received: via spool by 18158-submit <at> debbugs.gnu.org id=B18158.15806662298406 (code B ref 18158); Sun, 02 Feb 2020 17:58:01 +0000 Received: (at 18158) by debbugs.gnu.org; 2 Feb 2020 17:57:09 +0000 Received: from localhost ([127.0.0.1]:40499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1iyJUb-0002BU-7e for submit <at> debbugs.gnu.org; Sun, 02 Feb 2020 12:57:09 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:32811) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <thecybershadow@HIDDEN>) id 1iyIbN-0000dV-DK for 18158 <at> debbugs.gnu.org; Sun, 02 Feb 2020 12:00:06 -0500 Received: by mail-lj1-f193.google.com with SMTP id y6so12155401lji.0 for <18158 <at> debbugs.gnu.org>; Sun, 02 Feb 2020 09:00:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z1Hg5ncNx4r72vv1TXkv/H0rSfpQaVV6JarR6k80t3k=; b=peSV+LzIfdShBSv8uxj6xBZbsKnA6dq02eS9hEjuuBlBggWAi8sBP2rrBtYFe3rlXF pjR2xRYNNcWlg0VroYgsRJA3Ncs9utVTpAfwXqJGlykXldPflPdGbT+diRDL/ZuDLB3H gISjyIvbewQ7gZIOFeddWNpfSW4N5SK5prlNixFj9Do4l+6nLkv626Ej4HhNJCzmERmV exrZtwjuoGnchRxyXPrRghikYf4nlGRn+nS92hX77UZaeuRmfGfph9JYcGuyyucZ17jJ bTQfWN/T3TqwE/A3VofJv2LTV/uMQuoAEdl9QznABsxK/hWnLKdJa105gb68Wf6cyEgS veFw== X-Gm-Message-State: APjAAAUNCJkKX5G5vr16gzKgUs/jfjUjgVB4D5OtyldtB6yx1JE73JF2 J87ImoSpuEBEyWpmaSrUR948jjN0m9dXO/cT4c4= X-Google-Smtp-Source: APXvYqyuMm/nyYtN43l+HOAb+XDXv0Niug5eal5Epwk27ldLFRGKnDbPbwalxP4zyAL0YLr2EISycFx0A7l9ZXT9Eug= X-Received: by 2002:a2e:918c:: with SMTP id f12mr10659163ljg.66.1580662799424; Sun, 02 Feb 2020 08:59:59 -0800 (PST) MIME-Version: 1.0 References: <20200202115641.GA5547@ACM> In-Reply-To: <20200202115641.GA5547@ACM> From: Vladimir Panteleev <vladimir@HIDDEN> Date: Sun, 2 Feb 2020 16:59:43 +0000 Message-ID: <CAHhfkvz+AVF0g3hY2A6ct8UsKCH-a5x=J0LPLtK66Frbo=mAeQ@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Mailman-Approved-At: Sun, 02 Feb 2020 12:57:07 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.5 (/) Hello Alan, First, thank you very much for reaching out. I held the expectation that the maintainer(s) of cc-mode would not have any time to spare on derivative modes distributed outside of Emacs, so your message was a welcome surprise. I greatly appreciate you taking the time to prepare a patch for d-mode. However, I hope you will forgive me if I burden you with a bigger matter. As of last year, I had been working on a major update to d-mode. This new version fixes all known bugs in d-mode filed so far and has many other improvements. It is located here: GitHub pull request: https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/pull/93 Git clone URL: https://github.com/CyberShadow/Emacs-D-Mode.git ("next" branch) Current version: https://raw.githubusercontent.com/CyberShadow/Emacs-D-Mode/next/d-mode.el I'll be happy to create non-GitHub mirrors of the above upon request. Unfortunately, the only way I found to achieve these improvements in D language support was through advising even more cc-mode functions, similar to the "looking-at" advice your message pertains to. I fully realize that this approach is not very future-proof. I tried to keep the implementation as unintrusive and unreliant on cc-mode internals as possible. However, cc-mode is a non-trivially large and complicated piece of software, and D is a relatively large and complicated language, so I admit I have likely fallen short of that goal. My plan for ongoing maintenance was to keep up and address problems due to changes in cc-mode internals as they occur; however, considering the amount of time required to debug and devise fixes for each problem, I may have been overly eager in considering this approach. For this reason I had been thinking of contacting you for advice on how best to proceed. Some possible ideas I had in mind: 1. Add hooks and variables to cc-mode to allow d-mode to cleanly configure cc-mode to support the D language. Though I believe D firmly fits into the Algol-like family of languages currently supported by cc-mode, it also has many unique features, so I worry that this approach would be overly burdensome to cc-mode. 2. Move d-mode into cc-mode, replacing advice hacks with clean integration. I would be happy to contribute my work to GNU and continue supporting d-mode within cc-mode, if this is a possibility. However, even though most of the code in my "next" branch was written by me, the project has been around for a while, and I don't know if we can find all authors and have them transfer copyright to FSF; or, alternatively, move only the code I've written, and rewrite the missing parts, but I don't know how strict we would need to be in this regard. 3. Reimplement d-mode in cc-mode. It might be easier to start from scratch and, using just the existing d-mode test suite for reference, reimplement d-mode within cc-mode. Not having to resort to hacks such as advising functions will likely allow a much cleaner implementation than the current one. 4. Copy relevant parts of cc-mode into d-mode. One very ugly, but possibly practical approach would be to include all relevant cc-mode code in d-mode's distribution. All definitions would need to be properly namespaced to not conflict with the real cc-mode. This would effectively "freeze" the cc-mode version that d-mode uses, thus protecting it from incompatible changes in internals of future cc-mode versions, though compatibility fixes for future Emacs versions would still need to be applied, and d-mode will be unable to benefit from any future cc-mode improvements. 5. Abandon ship, and scale back D language support in d-mode to a maintainable minimum. Perhaps using cc-mode for D language support within Emacs is not an optimal solution. All of the above ideas would certainly require a non-trivial amount of further effort to achieve, and the result would only cover the combination of supporting the D language within Emacs. An approach that has been recently gaining popularity is, instead of writing one package for each language for each editor, to use "language servers" which use a common protocol to provide language support to any editor. The LSP protocol specification (as maintained by Microsoft) supports formatting (indentation), outlining (imenu), and (in recent versions) semantic syntax highlighting (fontification), with the downside of requiring additional software and configuration. If there is no interest in supporting D / d-mode in cc-mode (ideas 1-3 above), then perhaps this may be the best course of action. I would love to hear your thoughts on the above. Also, looking at the email headers, I see that this message was in reference to Emacs bug 18158. Looking at the previous messages in the bug thread (https://debbugs.gnu.org/18158), I found it odd that a bug in d-mode's behavior was filed at Emacs' bug tracker. I think that any d-mode or cc-mode issues observed when d-mode is active ought to be reported to the d-mode bugtracker, and not the cc-mode one. It is certainly not my intention to burden cc-mode maintainers with d-mode's bugs or shortcomings. Perhaps there is something I need to do to make it clearer where to report bugs in d-mode? In any case, I've been unable to reproduce the bug (as it was originally filed, and with the test code provided in message #20 (<8B3ABB9B-7A39-428A-A65B-B77D0614C9FE@HIDDEN>), on either the current master branch or my "next" branch of d-mode. I see that the bug was filed in 2014. Perhaps it was fixed by this commit in 2015: https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/commit/27fbe66f6de27f8337fe40d6a19f039c589cd1fc I added a test case for this fix in this commit: https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/commit/3e5a5d523d7580b2a42f376cbf83bdd9ac296bbd Best regards.
X-Loop: help-debbugs@HIDDEN Subject: bug#18158: D Mode: Getting rid of the ugly advice on looking-at. Resent-From: Alan Mackenzie <acm@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN, bug-cc-mode@HIDDEN Resent-Date: Fri, 07 Feb 2020 21:32:01 +0000 Resent-Message-ID: <handler.18158.B18158.15811110723449 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: moreinfo To: Vladimir Panteleev <vladimir@HIDDEN> Cc: 18158 <at> debbugs.gnu.org, stefan@HIDDEN, russel@HIDDEN, liranz@HIDDEN X-Debbugs-Original-Cc: bug-cc-mode@HIDDEN, 18158 <at> debbugs.gnu.org, Stefan Kangas <stefan@HIDDEN>, Russel Winder <russel@HIDDEN>, Liran Zvibel <liranz@HIDDEN> Received: via spool by 18158-submit <at> debbugs.gnu.org id=B18158.15811110723449 (code B ref 18158); Fri, 07 Feb 2020 21:32:01 +0000 Received: (at 18158) by debbugs.gnu.org; 7 Feb 2020 21:31:12 +0000 Received: from localhost ([127.0.0.1]:50365 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1j0BDT-0000tZ-DG for submit <at> debbugs.gnu.org; Fri, 07 Feb 2020 16:31:11 -0500 Received: from colin.muc.de ([193.149.48.1]:38326 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1j0BDP-0000tN-Q3 for 18158 <at> debbugs.gnu.org; Fri, 07 Feb 2020 16:31:10 -0500 Received: (qmail 90008 invoked by uid 3782); 7 Feb 2020 21:31:06 -0000 Received: from acm.muc.de (p4FE15DC2.dip0.t-ipconnect.de [79.225.93.194]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 07 Feb 2020 22:31:00 +0100 Received: (qmail 8990 invoked by uid 1000); 7 Feb 2020 21:31:00 -0000 Date: Fri, 7 Feb 2020 21:31:00 +0000 Message-ID: <20200207213100.GB8591@ACM> References: <20200202115641.GA5547@ACM> <CAHhfkvz+AVF0g3hY2A6ct8UsKCH-a5x=J0LPLtK66Frbo=mAeQ@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <CAHhfkvz+AVF0g3hY2A6ct8UsKCH-a5x=J0LPLtK66Frbo=mAeQ@HIDDEN> User-Agent: Mutt/1.10.1 (2018-07-13) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Vladimir, Thanks for your extensive reply. I have been thinking it over over the past few days. On Sun, Feb 02, 2020 at 16:59:43 +0000, Vladimir Panteleev wrote: > Hello Alan, > First, thank you very much for reaching out. I held the expectation > that the maintainer(s) of cc-mode would not have any time to spare on > derivative modes distributed outside of Emacs, so your message was a > welcome surprise. :-) > I greatly appreciate you taking the time to prepare a patch for > d-mode. However, I hope you will forgive me if I burden you with a > bigger matter. No problem. > As of last year, I had been working on a major update to d-mode. This > new version fixes all known bugs in d-mode filed so far and has many > other improvements. It is located here: > GitHub pull request: > https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/pull/93 > Git clone URL: https://github.com/CyberShadow/Emacs-D-Mode.git ("next" branch) > Current version: > https://raw.githubusercontent.com/CyberShadow/Emacs-D-Mode/next/d-mode.el > I'll be happy to create non-GitHub mirrors of the above upon request. I think I can get a copy of the repository without having to sign up, but I haven't had a chance to do this, yet. > Unfortunately, the only way I found to achieve these improvements in D > language support was through advising even more cc-mode functions, > similar to the "looking-at" advice your message pertains to. Maybe we could work together on this so that these pieces of advice could be minimised, or even avoided altogether. Could you possibly give me one or two examples of why these pieces of advice are needed? This would give me more of a feel for what the problems are. > I fully realize that this approach is not very future-proof. I tried > to keep the implementation as unintrusive and unreliant on cc-mode > internals as possible. However, cc-mode is a non-trivially large and > complicated piece of software, and D is a relatively large and > complicated language, so I admit I have likely fallen short of that > goal. CC Mode is indeed (too) complicated. Partly this is because the languages it deals with are complicated (particularly C++), but also, it has to be said, because the maintainers haven't always adopted an optimal compromise between speed, accuracy and simplicity. Accuracy has tended to be the highest goal, followed by speed. > My plan for ongoing maintenance was to keep up and address problems > due to changes in cc-mode internals as they occur; however, > considering the amount of time required to debug and devise fixes for > each problem, I may have been overly eager in considering this > approach. For this reason I had been thinking of contacting you for > advice on how best to proceed. > Some possible ideas I had in mind: > 1. Add hooks and variables to cc-mode to allow d-mode to cleanly > configure cc-mode to support the D language. This would perhaps be the cleanest option. > Though I believe D firmly fits into the Algol-like family of > languages currently supported by cc-mode, it also has many unique > features, so I worry that this approach would be overly burdensome to > cc-mode. How does D compare with C++ in terms of complexity? One practical step for option 1 would be for you to have write access to the CC Mode repository, in particular to a "D Mode" branch, where you could implement the necessary CC Mode features to support D Mode. Something like this was done ~10 years ago for enhancing Java Mode. > 2. Move d-mode into cc-mode, replacing advice hacks with clean integration. I would be less keen on this. Some while ago, my predecessor Martin Stjernholm decided as a matter of policy not to have any more languages directly implemented in CC Mode, and I have continued with this. The problem is that if the maintainer of a particular CC Mode mode stops contributing for any reason, the mode becomes old and fossilised. This has already happened to IDL Mode and Pike Mode. But perhaps a D Mode support file could be included in CC Mode, somewhat along the lines of how cc-awk.el supports AWK, but including only essential support for D Mode rather than including D Mode itself. I'm not sure if I've explained that very well. > I would be happy to contribute my work to GNU and continue > supporting d-mode within cc-mode, if this is a possibility. However, > even though most of the code in my "next" branch was written by me, > the project has been around for a while, and I don't know if we can > find all authors and have them transfer copyright to FSF; or, > alternatively, move only the code I've written, and rewrite the > missing parts, but I don't know how strict we would need to be in this > regard. Very strict indeed. The FSF's policy is that all contributions which aren't minor (in practice, up to about 15 lines of code) need their authors to assign their copyright. I've not known them to deviate from this policy, which has good reasons, though occasionally it can cause bad feelings. > 3. Reimplement d-mode in cc-mode. > It might be easier to start from scratch and, using just the > existing d-mode test suite for reference, reimplement d-mode within > cc-mode. Not having to resort to hacks such as advising functions will > likely allow a much cleaner implementation than the current one. Restarting an existing piece of software from scratch is a risky process. One skirts existing bugs cleanly, but there's a high chance of introducing new bugs which weren't there in the first place. > 4. Copy relevant parts of cc-mode into d-mode. > One very ugly, but possibly practical approach would be to include > all relevant cc-mode code in d-mode's distribution. All definitions > would need to be properly namespaced to not conflict with the real > cc-mode. This would effectively "freeze" the cc-mode version that > d-mode uses, thus protecting it from incompatible changes in internals > of future cc-mode versions, though compatibility fixes for future > Emacs versions would still need to be applied, and d-mode will be > unable to benefit from any future cc-mode improvements. I don't think this is the best way forward. Even though it could work, it's likely to involve a lot of unrewarding work, and some duplication of effort in fixing bugs common to CC Mode and D Mode. > 5. Abandon ship, and scale back D language support in d-mode to a > maintainable minimum. This would be entirely up to you, but I suspect that D Mode users would be unhappy with losing useful features for the sake of maintainability. > Perhaps using cc-mode for D language support within Emacs is not an > optimal solution. All of the above ideas would certainly require a > non-trivial amount of further effort to achieve, and the result would > only cover the combination of supporting the D language within Emacs. > An approach that has been recently gaining popularity is, instead of > writing one package for each language for each editor, to use > "language servers" which use a common protocol to provide language > support to any editor. The LSP protocol specification (as maintained > by Microsoft) supports formatting (indentation), outlining (imenu), > and (in recent versions) semantic syntax highlighting (fontification), > with the downside of requiring additional software and configuration. > If there is no interest in supporting D / d-mode in cc-mode (ideas 1-3 > above), then perhaps this may be the best course of action. This is a big topic indeed. There have been a few discussions around LSP on the Emacs developer mailing list in the past few months. Using LSP in place of the current mechanisms would involve a lot of work, but would likely be worth it. Recently, somebody has implemented fontification for Java Mode using Emacs's own analysis suite (whose name I can't recall at the moment). So it seems things are moving in that direction. Personally, I have mixed feelings about LSP. It may be a better way of doing things, but comes along at a time when traditional CC Mode is very highly developed over several decades of hard work. It's a bit like when vinyl records were superseded by CDs just around the time when we'd learnt how to make high quality records. For a while, the new CDs weren't as good. > I would love to hear your thoughts on the above. I hope I've given you enought to think about. ;-) > Also, looking at the email headers, I see that this message was in > reference to Emacs bug 18158. Looking at the previous messages in the > bug thread (https://debbugs.gnu.org/18158), I found it odd that a bug > in d-mode's behavior was filed at Emacs' bug tracker. It's bound to happen every now and then. I actually missed this bug back in 2014 and wasn't aware of it until Stefan Kangas, who's been going through hundreds of open old bugs trying to settle them, alerted me to it. > I think that any d-mode or cc-mode issues observed when d-mode is > active ought to be reported to the d-mode bugtracker, and not the > cc-mode one. It is certainly not my intention to burden cc-mode > maintainers with d-mode's bugs or shortcomings. Perhaps there is > something I need to do to make it clearer where to report bugs in > d-mode? I don't think you need to worry too much, very few D Mode bugs get sent to the CC Mode or the Emacs mailing lists. > In any case, I've been unable to reproduce the bug (as it was > originally filed, and with the test code provided in message #20 > (<8B3ABB9B-7A39-428A-A65B-B77D0614C9FE@HIDDEN>), on either the > current master branch or my "next" branch of d-mode. I see that the > bug was filed in 2014. Perhaps it was fixed by this commit in 2015: > https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/commit/27fbe66f6de27f8337fe40d6a19f039c589cd1fc > I added a test case for this fix in this commit: > https://github.com/Emacs-D-Mode-Maintainers/Emacs-D-Mode/commit/3e5a5d523d7580b2a42f376cbf83bdd9ac296bbd To reproduce it, I temporarily removed the advice on `looking-at' from D Mode. The problem was then apparent in the test code supplied by Liran Zvibel on 28th January to me, Cc: to the Emacs bug list. > Best regards. -- Alan Mackenzie (Nuremberg, Germany).
X-Loop: help-debbugs@HIDDEN Subject: bug#18158: D Mode: Getting rid of the ugly advice on looking-at. Resent-From: Vladimir Panteleev <vladimir@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN, bug-cc-mode@HIDDEN Resent-Date: Thu, 13 Feb 2020 13:38:01 +0000 Resent-Message-ID: <handler.18158.B18158.158160106320451 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 18158 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: moreinfo To: Alan Mackenzie <acm@HIDDEN> Cc: 18158 <at> debbugs.gnu.org, stefan@HIDDEN, russel@HIDDEN, liranz@HIDDEN X-Debbugs-Original-Cc: bug-cc-mode@HIDDEN, 18158 <at> debbugs.gnu.org, Stefan Kangas <stefan@HIDDEN>, Russel Winder <russel@HIDDEN>, Liran Zvibel <liranz@HIDDEN> Received: via spool by 18158-submit <at> debbugs.gnu.org id=B18158.158160106320451 (code B ref 18158); Thu, 13 Feb 2020 13:38:01 +0000 Received: (at 18158) by debbugs.gnu.org; 13 Feb 2020 13:37:43 +0000 Received: from localhost ([127.0.0.1]:59424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1j2EgZ-0005Jn-0m for submit <at> debbugs.gnu.org; Thu, 13 Feb 2020 08:37:43 -0500 Received: from mail-lf1-f68.google.com ([209.85.167.68]:36683) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <thecybershadow@HIDDEN>) id 1j2EgX-0005Jb-Sx for 18158 <at> debbugs.gnu.org; Thu, 13 Feb 2020 08:37:42 -0500 Received: by mail-lf1-f68.google.com with SMTP id f24so4298856lfh.3 for <18158 <at> debbugs.gnu.org>; Thu, 13 Feb 2020 05:37:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xaMG12MoLo9DUwe29xtiYprXPJhKk6q/hem7DlP3ya4=; b=prsA0+qqtcLjZdKh8Xh7iEQe/yt2P+var9f0PHfgcDw+e7jth37sza52B+bH5PIupN TzUg0KdWn8ltfEr1itHEMXrDlxP/I2355f2BAqUTdnqzlIIVvZvcCiaNVhhCa+SOcu7Y uRFY0YbvTMd7IgqUfPSbQHFi5WviGzPLTMyeyydUyIs3I+kMmzYOj/a9jZU3xs80b7H9 H51ZX9dsS72tBE4pdu7AR9O1EX6zY9hnIUQin7VOKeHST0IRlANccemrNVg6TG9W4F3+ FB5L5zVbNOsI10TqT3hINfPGkwXSbNsBE9xd8cvmzsyVQRPNd7HpgFtPNeRKi6bZ9Nps ob5w== X-Gm-Message-State: APjAAAVz3v0ONhOyX3R41b7zHFJAojM2LS7SMdgX9mSNtqcB1arVPoz8 ogbC257xz5FNyN4AkmFvQlqWzvThFiBvtbNk1b0= X-Google-Smtp-Source: APXvYqxM7WGAbq/krkXebkFCAp09yTtlGvVXr3UTj2HMcmnpKmwUaLoEgESF91XOXtWj3i8BRTbHObuaGOcFLdjNlFU= X-Received: by 2002:ac2:5626:: with SMTP id b6mr1033701lff.134.1581601055961; Thu, 13 Feb 2020 05:37:35 -0800 (PST) MIME-Version: 1.0 References: <20200202115641.GA5547@ACM> <CAHhfkvz+AVF0g3hY2A6ct8UsKCH-a5x=J0LPLtK66Frbo=mAeQ@HIDDEN> <20200207213100.GB8591@ACM> In-Reply-To: <20200207213100.GB8591@ACM> From: Vladimir Panteleev <vladimir@HIDDEN> Date: Thu, 13 Feb 2020 13:37:19 +0000 Message-ID: <CAHhfkvysqydAm6ZbWtuFt_ruvToqbM8yUx=qaoMoYHtAcKe6fA@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.5 (/) Hi Alan, On Fri, 7 Feb 2020 at 21:31, Alan Mackenzie <acm@HIDDEN> wrote:> > Unfortunately, the only way I found to achieve these improvements in D > Could you possibly give me one or two examples of why these pieces of > advice are needed? This would give me more of a feel for what the > problems are. Yes, gladly. d-mode installs advice in seven^Wsix places, all of which are in cc-mode. Here is a rough / brief description of each. 1. The looking-at call from within c-add-stmt-syntax which started this discussion. It has been later extended in 075c3e7b8da8bfffe1bbe00cf705494755959fd1 to also apply to "version" and "debug" blocks. 2. A replacement of c-forward-decl-or-cast-1. The D version, which is an edited copy of the cc-mode function, has additional code required to recognize and fontify variable declarations in foreach statements and lambda expressions, as well as conditional compilation. The D version (d-forward-decl-or-cast-1) completely replaces c-forward-decl-or-cast-1, and only a small part of the original remains. 3. A replacement of c-get-fontification-context. This one is also used for foreach loops and lambda parameter lists. I'm not sure the "integration" with cc-mode is that great here - the code might be using some constants with different conventions than cc-mode. 4. A replacement of c-in-knr-argdecl. Here d-mode abuses cc-mode's logic for two features that are syntactically a bit similar to K&R C argument lists - function contracts and template constraints. They also exist between the function signature and its body, so making use of the existing K&R mechanics in cc-mode seemed like the simplest way to fix support for these constructs. 5. A replacement of c-forward-type. This one also implements only exactly the syntax in the D programming language. 6. A modified version of c-update-brace-stack. The modifications were necessary to help cc-mode understand static compilation constructs in the D language. Syntax such as "static if" does not change whether its substatements are "top-level" or not, and it can be used with or without a { } pair, which required custom logic. As I was making this list, I couldn't remember what one of the advice was for, so I removed it - and the test suite still passed, so it seems like my newer changes made it obsolete. I committed the removal. > How does D compare with C++ in terms of complexity? I would say D is definitely less complicated than C++, and it's especially easier to parse (it was designed from the beginning to avoid pitfalls such as the ambiguity of "a < b, c > d"). However, it also has many features (for instance, depending on how you count, it has about seven kinds of string literals). Some troublesome aspects I ran into while working on d-mode were type inference (types may sometimes be omitted from declarations) and parameter lists ("(a, b, c)" is a list of types for a function declaration, like in C, but a parameter name list with inferred types for lambdas). > One practical step for option 1 would be for you to have write access to > the CC Mode repository, in particular to a "D Mode" branch, where you > could implement the necessary CC Mode features to support D Mode. > Something like this was done ~10 years ago for enhancing Java Mode. That would work; though, I might need a bit of guidance with making my cc-mode modifications acceptable :) E.g., what would be a good way for derived modes to replace cc-mode functions such as c-forward-type. > But perhaps a D Mode support file could be included in CC Mode, somewhat > along the lines of how cc-awk.el supports AWK, but including only > essential support for D Mode rather than including D Mode itself. I'm > not sure if I've explained that very well. I think I understand. Probably it will be clearer which way is best once we attempt to do so. > > I would love to hear your thoughts on the above. > > I hope I've given you enought to think about. ;-) Indeed. Thank you for the extensive reply. I agree with and have no further comments on everything you said not quoted above. > To reproduce it, I temporarily removed the advice on `looking-at' from D > Mode. The problem was then apparent in the test code supplied by Liran > Zvibel on 28th January to me, Cc: to the Emacs bug list. Oh, I see. Thank you for the clarification. I guess I could have put two and two together :) Best regards.
Received: (at control) by debbugs.gnu.org; 26 Sep 2020 23:17:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 26 19:17:28 2020 Received: from localhost ([127.0.0.1]:48050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1kMJRY-0005ps-HE for submit <at> debbugs.gnu.org; Sat, 26 Sep 2020 19:17:28 -0400 Received: from quimby.gnus.org ([95.216.78.240]:57784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <larsi@HIDDEN>) id 1kMJRX-0005pd-EW for control <at> debbugs.gnu.org; Sat, 26 Sep 2020 19:17:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kL89r607U8C9M18NUqt1SSLB5C2gZzuZ9stLGGelVfI=; b=rtAnYXtSnOqDu4lCyDJ3eHaaWQ ygTq3yTolYSznRkhD4LEEmzWDvqBKCOq2U3up5A5VCAcFzbr/27btZlvDo/FIA6GF95x6lr8IHGEI tp+2NEYPlFl897Cw02+KsjHrZcxu5FHyB/5/xJRocunww4CbVCu3u//w6F3f1L+/8BQE=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1kMJRO-0004My-T2 for control <at> debbugs.gnu.org; Sun, 27 Sep 2020 01:17:21 +0200 Date: Sun, 27 Sep 2020 01:17:17 +0200 Message-Id: <87ft74b01u.fsf@HIDDEN> To: control <at> debbugs.gnu.org From: Lars Ingebrigtsen <larsi@HIDDEN> Subject: control message for bug #18158 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 18158 - moreinfo quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) tags 18158 - moreinfo quit
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.