From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Reuben Thomas via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#47488: Treatment of # in js.el Date: Mon, 29 Mar 2021 21:28:29 +0000 Message-ID: Reply-To: Reuben Thomas Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c56d6d05beb39025" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33646"; mail-complaints-to="usenet@ciao.gmane.io" To: 47488@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 29 23:29:17 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lQzRl-0008cR-7f for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Mar 2021 23:29:17 +0200 Original-Received: from localhost ([::1]:45036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQzRk-0003ll-9d for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Mar 2021 17:29:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQzRX-0003lb-K5 for bug-gnu-emacs@gnu.org; Mon, 29 Mar 2021 17:29:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38217) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lQzRW-00047b-Qo for bug-gnu-emacs@gnu.org; Mon, 29 Mar 2021 17:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lQzRW-0006ZK-MV for bug-gnu-emacs@gnu.org; Mon, 29 Mar 2021 17:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Mar 2021 21:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47488 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.161705333125229 (code B ref -1); Mon, 29 Mar 2021 21:29:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Mar 2021 21:28:51 +0000 Original-Received: from localhost ([127.0.0.1]:49763 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lQzRK-0006Yq-QE for submit@debbugs.gnu.org; Mon, 29 Mar 2021 17:28:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:46636) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lQzRI-0006Yi-87 for submit@debbugs.gnu.org; Mon, 29 Mar 2021 17:28:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lQzRI-0003kg-15 for bug-gnu-emacs@gnu.org; Mon, 29 Mar 2021 17:28:48 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52405) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lQzRH-00040H-Qt for bug-gnu-emacs@gnu.org; Mon, 29 Mar 2021 17:28:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59438) by fencepost.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lQzRG-0005Um-NR for bug-emacs@gnu.org; Mon, 29 Mar 2021 17:28:47 -0400 Original-Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]:39915) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lQzRC-0003x7-Of for bug-emacs@gnu.org; Mon, 29 Mar 2021 17:28:46 -0400 Original-Received: by mail-oi1-x233.google.com with SMTP id i81so14443103oif.6 for ; Mon, 29 Mar 2021 14:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:from:date:message-id:subject:to; bh=ktGZElXPQJ4e3ZiyH6x6y6felPsSmax9pW/E1yibK1U=; b=Z5EpqUXsrGGc+7b/ux/Yd7L1fNjtLrqssHeDc4U4yg0jWLq+sblSArvNqPpmw2k4q+ PsREnbwSKWaa0y67T6BdQkapZv3U1I4YxDv7DnInYk85qX09a7R4CLGk74NPYKTp+FNn QICOK21WhgO1FYW8g4JXj0dbjjejvV4N0jr+A= 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=ktGZElXPQJ4e3ZiyH6x6y6felPsSmax9pW/E1yibK1U=; b=Ml04qZ7KYdcKjEw6/iqDU+aAWLLN+DQ5nHtMr3RkNSmFpx05z5IyQlv8GBuJxPdbWN 21KgouCYQAl71Za/FZUxHhdqszbuLYQB9tkFprj0jwQuUlJWMYh1tCKauWLBVU0O0jRY 91brK8PBBymvljluXjK46kP4G0FojA/48IFotFwVu4SWZgco8hZebNbPuCoFjXpR52S/ rhT61hey4aQxLEeoiJRVtqs1s/YTi7+f4bxIoBTkjI+bLxhVqGOrAa2pfc16M0yK+WkO daLDcNzrUZQghUtYmcMmlytfdMDlk56God+TEeCCMlqyD8Dvv+hKDEARE2BqS00Jmwzr aFEQ== X-Gm-Message-State: AOAM532nGqz+yoQ0fqa1fcmZ7DguOlDU3S50bhqd/DMewdRq9KQMGOOL p212ahGTSBuHxgfSO5DA55duyHMsUShV6HQiIMMa5qZZ8p0Iqw== X-Google-Smtp-Source: ABdhPJz2wKEI6Z1F4+wdL0FGkiAU8qdtj6gjN2I8xldObYt+MrGpxGw4Ib9LlmD0mOYAlSUJGkB++PDbwRNKgKq6o2E= X-Received: by 2002:aca:f245:: with SMTP id q66mr784980oih.179.1617053320827; Mon, 29 Mar 2021 14:28:40 -0700 (PDT) Received-SPF: pass client-ip=2607:f8b0:4864:20::233; envelope-from=rrt@sc3d.org; helo=mail-oi1-x233.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:203271 Archived-At: --000000000000c56d6d05beb39025 Content-Type: text/plain; charset="UTF-8" I started using private class fields, as described here (a stage 3 proposal that is widely implemented, though not actually standardized yet AFAICT). These are normal fields that start with a hash. I find in js--proper-indentation the line (annotated by git blame): 17b5d0f7077 (Chong Yidong 2009-08-14 2864) ((eq (char-after) ?#) 0) It sets the indentation for a line starting with # unconditionally to 0. I cannot find any other use of # in JavaScript that would justify treating lines starting with # apparently like C preprocessor macros. There is other related code, and it all seems to go back to when js.el was first installed in Emacs. Is this just because the code was originally based on cc-mode or something, and the references to hash were never removed? Or was cpp used with early JavaScript?? I see references such as js--opt-cpp-start which says "Regexp matching the prefix of a cpp directive", and a match for "#define" in js--update-quick-match-re. I cannot see any code in js-tests.el that tests this cpp-related functionality. Is there some reason to keep the cpp-related code in js.el? I presume removing it would simplify then adding support for private class fields; indeed, maybe no particular support is needed if cpp support is first removed. -- https://rrt.sc3d.org --000000000000c56d6d05beb39025 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I started using private class fields, a= s described here (a stage 3 proposal th= at is widely implemented, though not actually standardized yet AFAICT).

These are normal fields t= hat start with a hash.

I find in js--proper-indentation the line (annotated by git blame):
<= div class=3D"gmail_default" style=3D"font-family:arial,helvetica,sans-serif= ;font-size:small">
17b5d0f7077 (Chong Yidong = =C2=A0 =C2=A0 =C2=A0 =C2=A0 2009-08-14 2864) =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 ((eq (char-after) ?#) 0)

It sets the indentation for a line starting with # unconditionall= y to 0. I cannot find any other use of # in JavaScript that would justify t= reating lines starting with # apparently like C preprocessor macros. There = is other related code, and it all seems to go back to when js.el was first = installed in Emacs.

Is= this just because the code was originally based on cc-mode or something, a= nd the references to hash were never removed? Or was cpp used with early Ja= vaScript?? I see references such as js--opt-cpp-start which says "Rege= xp matching the prefix of a cpp directive", and a match for "#def= ine" in js--update-quick-match-re.

I cannot see any code in js-tests.el that tests this cpp-relat= ed functionality.

Is t= here some reason to keep the cpp-related code in js.el? I presume removing = it would simplify then adding support for private class fields; indeed, may= be no particular support is needed if cpp support is first removed.

--
--000000000000c56d6d05beb39025--