From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.bugs Subject: bug#40760: 27.0.50; An indentation problem with const and chaining in js-mode Date: Mon, 14 Mar 2022 11:13:49 +0100 Message-ID: <87ilsgvo2q.fsf@mbork.pl> References: <87r1wf99id.fsf@mbork.pl> <87fsnkoosu.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10157"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.1.0; emacs 29.0.50 Cc: 40760@debbugs.gnu.org, mbork@mbork.pl To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 14 11:14:47 2022 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 1nThiv-0002OX-TS for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Mar 2022 11:14:45 +0100 Original-Received: from localhost ([::1]:38182 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nThiu-0005Lz-8c for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 14 Mar 2022 06:14:44 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57272) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nThiE-0004yF-W7 for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 06:14:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50248) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nThiE-0006WS-0Q for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 06:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nThiD-0007tf-OC for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 06:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Marcin Borkowski Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Mar 2022 10:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40760 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 40760-submit@debbugs.gnu.org id=B40760.164725284030342 (code B ref 40760); Mon, 14 Mar 2022 10:14:01 +0000 Original-Received: (at 40760) by debbugs.gnu.org; 14 Mar 2022 10:14:00 +0000 Original-Received: from localhost ([127.0.0.1]:44145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nThiC-0007tJ-L8 for submit@debbugs.gnu.org; Mon, 14 Mar 2022 06:14:00 -0400 Original-Received: from mail.mojserwer.eu ([195.110.48.8]:46420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nThi8-0007t8-Mg for 40760@debbugs.gnu.org; Mon, 14 Mar 2022 06:13:59 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id 02A42E70B0; Mon, 14 Mar 2022 11:13:53 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RJUmxLCpvmNr; Mon, 14 Mar 2022 11:13:49 +0100 (CET) Original-Received: from localhost (83.8.166.110.ipv4.supernova.orange.pl [83.8.166.110]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 924E0E653B; Mon, 14 Mar 2022 11:13:49 +0100 (CET) In-reply-to: <87fsnkoosu.fsf@gnus.org> 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:228344 Archived-At: On 2022-03-14, at 10:40, Lars Ingebrigtsen wrote: > Marcin Borkowski writes: > >> When declaring a const variable which is assigned a value of a long, >> chained expression, the default indentation is wrong (compared to a let >> declaration): >> >> let a = /regex/ >> .test('regex hello'); >> >> const a = /regex/ >> .test('regex hello'); > > I think this is the intended indentation? That is, they indent to where > the "a" is. Well, in a tab-only indentation style (used by many people, me included) this is _very_ wrong, e.g. because it results in Emacs using both tabs and spaces here. > Marcin Borkowski writes: > >> This is the temporary solution I employed: >> >> (setq js--declaration-keyword-re "\\<\\(let\\|var\\)\\>") >> >> I would suggest turning this variable into a user option. > > This isn't just used for indentation, so altering this const will lead > to other breakages (and so it shouldn't be customiseable, either). Grep apparently disagrees - I found 5 occurrences of `js--declaration-keyword-re' in Emacs sources, and all of them seem to be related to indentation. So, I don't see any danger here. (Anyway, I changed it in my init.el; we'll see how that works.) Best, -- Marcin Borkowski http://mbork.pl