From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#40760: 27.0.50; An indentation problem with const and chaining in js-mode Date: Fri, 18 Mar 2022 03:12:01 +0200 Message-ID: <0f3dfed4-f61a-87f9-6325-ca9d80e7077e@yandex.ru> References: <87r1wf99id.fsf@mbork.pl> <87fsnkoosu.fsf@gnus.org> <87ilsgvo2q.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2549"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Cc: 40760@debbugs.gnu.org To: Marcin Borkowski , Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 18 02:13:13 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 1nV1B2-0000TS-OC for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Mar 2022 02:13:12 +0100 Original-Received: from localhost ([::1]:48822 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nV1B1-00053o-47 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Mar 2022 21:13:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nV1At-00052i-4i for bug-gnu-emacs@gnu.org; Thu, 17 Mar 2022 21:13:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33615) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nV1As-0000xp-Rd for bug-gnu-emacs@gnu.org; Thu, 17 Mar 2022 21:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nV1As-0003Ye-Du for bug-gnu-emacs@gnu.org; Thu, 17 Mar 2022 21:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Mar 2022 01:13:02 +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.164756593513600 (code B ref 40760); Fri, 18 Mar 2022 01:13:02 +0000 Original-Received: (at 40760) by debbugs.gnu.org; 18 Mar 2022 01:12:15 +0000 Original-Received: from localhost ([127.0.0.1]:55741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV1A6-0003XH-KG for submit@debbugs.gnu.org; Thu, 17 Mar 2022 21:12:15 -0400 Original-Received: from mail-wr1-f43.google.com ([209.85.221.43]:37616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nV1A0-0003Wx-UO for 40760@debbugs.gnu.org; Thu, 17 Mar 2022 21:12:12 -0400 Original-Received: by mail-wr1-f43.google.com with SMTP id u16so8753730wru.4 for <40760@debbugs.gnu.org>; Thu, 17 Mar 2022 18:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=7xc5tC618XhUUtvQ3Z1PAzBSmAgl3QHMxMG5VJ8m47Y=; b=FMdOLMNVwa4icNdsnph/HwdjdPdOAj3xrfQONvHhSCMip54LMTnyF8QCVNHvDrs8LN CcOexhAAwV8uOEv8CSCV7KGmZ/2FziCUoDUDUZCZDnebqIA4cBS3X5ow6umJ5Gri+W3K vC5HIjuluQrnvcY1Zl7U+gJ62ctFdoE9BWM2V0tbz102wZnm3TD/sSRc+DltivCOP2BN gohLdu+HNUPzDi7I3Kklh9XMvl9jjosJrRt/xl7CsZhVSNslp118Dkx5gA2EqYq8SXoG xXTThbX+VBFFtkicE1RjMEzt9AwZ4/TfN0BOYNW68I6V6AzFQ5Zobu00QOoFd/GVMtIC X7YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=7xc5tC618XhUUtvQ3Z1PAzBSmAgl3QHMxMG5VJ8m47Y=; b=4EJvpbifyGNXuent2BP8Mjd30cF/AybDJ46p/38QklBrTgjkVZ6Ub33l5o3utiCasO f+V9gSnek16dUj7PSbsHBWL7bDORJ510Z/ateg8+mymxMasraNUOHMXeDlqjpPOTYXE6 5JIiHpgtMtP1+MUDD1q+UvBlLnrtOFWZ+1N3Lzo0MutIdcpNjxrq668+9SDsA0+wHqhD gff2UNjrvFgyRRZgRWLXIoGT9Y9B0vqe5XuHMUEvi6yyh0J3fPML/Xe4RZs4pE245HKw LZoKfqOR/+GTHEfLpBItTSXKW37RsIlyJPzTdKw9pWMxFqz7FXt7nBD0UY6BGlokRnIG nuBQ== X-Gm-Message-State: AOAM533QsP3ObbMfg/Ovx3Oi/BCMKCNZRtAwXXzagCPcLzbshkHDTcyu BwC4XWdCmv8IDwCWtTcYsFo= X-Google-Smtp-Source: ABdhPJw4wD8/vGtqzUAXd/EKy10np6OLJEeXvarnrqfXuA6K+V0yrnBMRk6r9dD6QydXkbr6aA/qMQ== X-Received: by 2002:a5d:6d8a:0:b0:203:6efe:7960 with SMTP id l10-20020a5d6d8a000000b002036efe7960mr6073449wrs.291.1647565923065; Thu, 17 Mar 2022 18:12:03 -0700 (PDT) Original-Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id bg42-20020a05600c3caa00b00380deeaae72sm7288962wmb.1.2022.03.17.18.12.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Mar 2022 18:12:02 -0700 (PDT) Content-Language: en-US In-Reply-To: <87ilsgvo2q.fsf@mbork.pl> 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:228524 Archived-At: On 14.03.2022 12:13, Marcin Borkowski wrote: > > 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. I'm fairly certain it's not a very popular style, but we should try to cater to it as well, of course. >> 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.) I think it would be better to add a more semantically-named user option. This indentation feature was ported from js2-mode at some point, where it is guarded by the (on by default) user option js2-pretty-multiline-declarations. The option itself was lost in transition. See js2-old-indent.el for more info.