From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Felix H. Dahlke" Newsgroups: gmane.emacs.bugs Subject: bug#8576: 23.2; js-mode doesn't support multi-line variable declarations Date: Tue, 17 Jul 2012 10:24:50 +0200 Message-ID: <20120717102450.17551uqiod45bkg0@webmail.ubercode.de> References: <4DB915B0.7010605@ubercode.de> <5004F15E.9040101@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=_7a370so3b8cg"; protocol="application/pgp-signature"; micalg="pgp-sha1" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1342513520 13232 80.91.229.3 (17 Jul 2012 08:25:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 17 Jul 2012 08:25:20 +0000 (UTC) Cc: 8576@debbugs.gnu.org, Dmitry Gutov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 17 10:25:19 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sr35p-0003ER-Ml for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Jul 2012 10:25:17 +0200 Original-Received: from localhost ([::1]:48607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sr35o-0005hZ-QE for geb-bug-gnu-emacs@m.gmane.org; Tue, 17 Jul 2012 04:25:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:43136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sr35j-0005gI-4G for bug-gnu-emacs@gnu.org; Tue, 17 Jul 2012 04:25:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sr35e-0001Rr-TI for bug-gnu-emacs@gnu.org; Tue, 17 Jul 2012 04:25:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sr35e-0001Rj-PQ for bug-gnu-emacs@gnu.org; Tue, 17 Jul 2012 04:25:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Sr3BO-0006yj-FL for bug-gnu-emacs@gnu.org; Tue, 17 Jul 2012 04:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Felix H. Dahlke" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jul 2012 08:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8576 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8576-submit@debbugs.gnu.org id=B8576.134251382325643 (code B ref 8576); Tue, 17 Jul 2012 08:31:02 +0000 Original-Received: (at 8576) by debbugs.gnu.org; 17 Jul 2012 08:30:23 +0000 Original-Received: from localhost ([127.0.0.1]:45211 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sr3Ak-0006ea-Gp for submit@debbugs.gnu.org; Tue, 17 Jul 2012 04:30:23 -0400 Original-Received: from vserver2179.vserver-on.de ([84.38.67.140]:42379) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sr3Ag-0006W9-8v for 8576@debbugs.gnu.org; Tue, 17 Jul 2012 04:30:20 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by vserver2179.vserver-on.de (Postfix) with ESMTP id 3256B1FF001; Tue, 17 Jul 2012 10:24:50 +0200 (CEST) Original-Received: from p578bacbb.dip0.t-ipconnect.de (p578bacbb.dip0.t-ipconnect.de [87.139.172.187]) by webmail.ubercode.de (Horde Framework) with HTTP; Tue, 17 Jul 2012 10:24:50 +0200 In-Reply-To: User-Agent: Internet Messaging Program (IMP) 4.3.3 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:62031 Archived-At: This message is in MIME format and has been PGP signed. --=_7a370so3b8cg Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit Quoting Stefan Monnier : > Thank you for your efforts trying to find a good fix for this problem. > I'd like to install your changes (or some future version of them once > the wrinkles are worked out), but it's sufficiently non-trivial that > we need you to sign some copyright paperwork. I already sent a signed CA to the FSF, it should arrive shortly. >> const a = 5, >> b = 6; > > Yup, that'd be a bug. Depends, IMO. Do we want to indent on the column, or by the configured indentation level? I personally want to indent on column, so that would indeed be a problem for me (never noticed because I use a tab size of 4 and no const keyword). Should this be configurable? If we don't make it configurable, I'd vote for going with Dmitry's variant, as that seems to be the more popular style. >> I meant that nobody will care, most likely. But the implementation >> shouldn't be too hard either - add a function to `post-command-hook' >> which would check if the command is `self-insert-command', check if we >> inserted a comma, skip backward to the previous non-whitespace char, see >> if it's } or ], etc. > > Rather than a post-command-hook, that would be a post-self-insert-hook. > And that would need to be conditional on some js-electric-foo variable > (or better yet, be made to work with electric-indent-mode). > > Note that looking forward during indentation, while occasionally > annoying, is not that big of a problem in practice: contrary to popular > belief, we don't write code quite as linearly as one might think. > We at least as frequently edit code in place. > > BTW, rather than a post-self-insert-hook, you could put a special > text-property `js--indent-depends-on-next-line' on the line, and then > when indenting a line, you could check if the previous line has that > property and if so indent both lines. I'm not claiming it's a better > approach, just an alternative one. Thanks for the hints Dmitry and Stefan, as you undoubtly noticed, I am quite new to Emacs development, but willing to learn :) But I'd rather get this patch in in the simple form first, and enhance the behaviour with another one. --=_7a370so3b8cg Content-Type: application/pgp-signature Content-Description: PGP Digital Signature Content-Disposition: inline Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEABECAAYFAlAFIVEACgkQJc3crOgfbuZfVQCeIOO9/MX13fMhpjQYivIIObnv uSkAnRB2Myp52/VdcAYC8mJjMKVjxMIH =jzOo -----END PGP SIGNATURE----- --=_7a370so3b8cg--