From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#16811: 24.3.50; [ruby-mode] Implicit hash indentation bug Date: Sun, 23 Feb 2014 07:55:37 +0200 Message-ID: <53098D59.1000007@yandex.ru> References: <87fvnes3qn.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1393134977 16623 80.91.229.3 (23 Feb 2014 05:56:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Feb 2014 05:56:17 +0000 (UTC) Cc: 16811-done@debbugs.gnu.org, Bozhidar Batsov To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 23 06:56:24 2014 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 1WHS34-0005Fi-6t for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Feb 2014 06:56:22 +0100 Original-Received: from localhost ([::1]:51881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHS33-0007Q9-Pp for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Feb 2014 00:56:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHS2t-0007PC-KA for bug-gnu-emacs@gnu.org; Sun, 23 Feb 2014 00:56:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WHS2m-0007lT-3C for bug-gnu-emacs@gnu.org; Sun, 23 Feb 2014 00:56:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WHS2l-0007lP-VN for bug-gnu-emacs@gnu.org; Sun, 23 Feb 2014 00:56:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WHS2l-0008LW-96 for bug-gnu-emacs@gnu.org; Sun, 23 Feb 2014 00:56:03 -0500 Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Feb 2014 05:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 16811 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 16811@debbugs.gnu.org, dgutov@yandex.ru, bozhidar@batsov.com Original-Received: via spool by 16811-done@debbugs.gnu.org id=D16811.139313495232058 (code D ref 16811); Sun, 23 Feb 2014 05:56:02 +0000 Original-Received: (at 16811-done) by debbugs.gnu.org; 23 Feb 2014 05:55:52 +0000 Original-Received: from localhost ([127.0.0.1]:36212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WHS2Z-0008L0-9W for submit@debbugs.gnu.org; Sun, 23 Feb 2014 00:55:51 -0500 Original-Received: from mail-ee0-f48.google.com ([74.125.83.48]:62275) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WHS2W-0008Kf-7r for 16811-done@debbugs.gnu.org; Sun, 23 Feb 2014 00:55:48 -0500 Original-Received: by mail-ee0-f48.google.com with SMTP id t10so2393115eei.35 for <16811-done@debbugs.gnu.org>; Sat, 22 Feb 2014 21:55:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ynXdj6B0ungYvGoAObXF3qvt/ipHFws9BXCp5qDtM4w=; b=j+k+2eAckauA/FU6d6IfrWuZ8RbGYVxDXfn3Y9sGfPq874s4aGZQqwDrdrdhmsXDzH Os1JPCL/2jHBaHq3Sok0lwKvcb05po5gqdZG5gjupU42iI/ZZhfNyOkjKqAlcStlK9o2 TV/1ooEcwV0OpA7dIqhh9O86lJVTWHEvaJnM8Xb5xiMnla8IGkqOJI0ACzq1YEbVnYL1 c0N+KbDPjsx1hY5N4ofRAZI+oc554USN42x3/niNaAIRcXxiDyUceW7h70nSNT0K6hWy Bsi/1ezHmM8DbiI27FToCwBvaDg54JRMriXmjgrgCkEZVc1xPHPY3/lCEKGe4gV9r5Lp bU5w== X-Received: by 10.15.98.68 with SMTP id bi44mr17512560eeb.67.1393134942051; Sat, 22 Feb 2014 21:55:42 -0800 (PST) Original-Received: from [192.168.10.2] ([93.109.195.252]) by mx.google.com with ESMTPSA id u6sm47076628eep.11.2014.02.22.21.55.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Feb 2014 21:55:40 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:86053 Archived-At: On 20.02.2014 16:11, Stefan Monnier wrote: >> The problem seems to be that (let (smie--parent) (smie-indent--parent)) > > Which does little more than (smie-backward-sexp 'halfsexp) in this case. Yes. >> called between "=>" and "{" doesn't stop at "=>", but goes straight to >> the parent "{". > > Which seems correct. Maybe according to the current grammar. But not if we want expressions after `=>' to have consistent additional indentation. Which I'm now thinking we probably don't, since otherwise, if it works right, { 'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, would turn into { 'HashSyntax' => { 'EnforcedStyle' => 'ruby19', 'SupportedStyles' => %w(ruby19 hash_rockets) }, and that doesn't look good. So indenting the left and right sides of `=>' to the same level is probably the way to go. Changed in revision 116534, fixing this bug. Thanks for the questions! > This said, I don't understand why > > { > 'HashSyntax' => { > 'EnforcedStyle' => 'ruby19', > 'SupportedStyles' => %w(ruby19 hash_rockets) > }, > 'SpaceAroundOperators' => { 'Enabled' => true } > } > > is indented differently from > > {'HashSyntax' => { > 'EnforcedStyle' => 'ruby19', > 'SupportedStyles' => %w(ruby19 hash_rockets) > }, > 'SpaceAroundOperators' => { > 'Enabled' => true }} > > It seems like "it jumps back to { instead of =>" is not the full explanation. That's because we always insert an implicit semicolon after { at eol, and that's because it's hard to distinguish between a curly that's opening a hash and a curly than opens a curly block. And we need those after block-opening curlies, otherwise some token on the first line of the block might consider the curly as its parent, align to it, and block-opening curlies themselves align to the beginning of the statement. So it("is too!") { bar .qux } turns into it("is too!") { bar .qux }