From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Problem case for ruby-mode indentation Date: Mon, 04 Nov 2013 12:58:31 +0200 Message-ID: <52777DD7.1020305@yandex.ru> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1383562732 23072 80.91.229.3 (4 Nov 2013 10:58:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Nov 2013 10:58:52 +0000 (UTC) Cc: emacs-devel To: Steve Purcell Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 04 11:58:56 2013 Return-path: Envelope-to: ged-emacs-devel@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 1VdHs0-000193-D9 for ged-emacs-devel@m.gmane.org; Mon, 04 Nov 2013 11:58:56 +0100 Original-Received: from localhost ([::1]:49094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdHrz-0007IQ-QP for ged-emacs-devel@m.gmane.org; Mon, 04 Nov 2013 05:58:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdHrq-0007HS-Ki for emacs-devel@gnu.org; Mon, 04 Nov 2013 05:58:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdHrk-0003ud-14 for emacs-devel@gnu.org; Mon, 04 Nov 2013 05:58:46 -0500 Original-Received: from mail-ee0-x22a.google.com ([2a00:1450:4013:c00::22a]:59724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdHrj-0003uP-No for emacs-devel@gnu.org; Mon, 04 Nov 2013 05:58:39 -0500 Original-Received: by mail-ee0-f42.google.com with SMTP id c1so614057eek.29 for ; Mon, 04 Nov 2013 02:58:38 -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=Ts5wc9vo0IvK3c55iaJ1ZyWsczdpM9Ganu3GH745y2k=; b=ESvyVO+ji3GMMweT38nnGpTHq74fu+IaQAkQoq4DmAlMcSSKN0UsGnuzgevfvK/INI 5WFDTfc3X/qCetTtFiiD+PF3ARepSA+O/CrynSFnK7ZmhYeFG+/BF7qWUHHCP+S+WBB5 RdWjuPyCBbOQEg0zC/1lVjne8EEIQe3DoWcn46pzV5AxM6tkBohN4FJkuotRtl7RRfNa ycNvfD9X7lwOiHeqxgAJ1bSMenHkdXREgW/WhYk5M2T84zUD0hmAJjuC7uVFHx4QhSbo OB/49gQX7YDqEiqHVio2Zu84a+xyFRzJGzFnbmT6ZQgy8Ai2SAlP71+AaFvZqwU6QISR wn3Q== X-Received: by 10.15.41.3 with SMTP id r3mr2564703eev.74.1383562718430; Mon, 04 Nov 2013 02:58:38 -0800 (PST) Original-Received: from [192.168.10.2] (93-17-100.netrun.cytanet.com.cy. [93.109.17.100]) by mx.google.com with ESMTPSA id x47sm45013774eea.16.2013.11.04.02.58.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Nov 2013 02:58:37 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::22a X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164919 Archived-At: Hi Steve, On 03.11.2013 15:22, Steve Purcell wrote: > I noticed a case in which heredoc indentation gets messed up with ruby-mode from Emacs HEAD: > > if something_wrong? # ruby-move-to-block-skips-heredoc > ActiveSupport::Deprecation.warn(<<-eowarn, foo) > boo hoo > end (bah) > eowarn > foo > end > > Seems like it’s the parens inside the heredoc which confuse matters. It’s the same with/without `ruby-use-smie`. You probably didn't switch major mode after changing the value of `ruby-use-smie'. It only takes effect in `ruby-mode' function, so you'd have to `M-x text-mode', `M-x ruby-mode'. I do see different indentation with SMIE enabled than with it disabled. Should be fixed now, in 114935 (with SMIE). Although, as usual, I'm not sure whether that solution is the best one. > Here’s another example from some proprietary code, which seems to confirm that issue: > > connection.execute sanitize_sql_array([<<-end_sql, charity.id, Markup.db_regexp_for_references("charity", charity.all_names), charity.id]) > INSERT INTO charities_news_items (charity_id, news_item_id) > SELECT ? AS charity_id, id AS news_item_id > FROM news_items WHERE text ~ ? > AND id NOT IN (SELECT news_item_id FROM charities_news_items WHERE charity_id = ?) > end_sql > > (Make sure you view this with a monospaced font, of course.) Also looks fixed now. > To be fair, this has never really worked perfectly, but I think this is a little more broken than I remember it. :-) The old indentation engine reinvents parse-partial-sexp, poorly, so it doesn't really consider the insides of heredoc as a string. SMIE has its difficulties, but it handles syntax entities better. P.S. Please do use `M-x report-emacs-bug', or at least write to emacs-devel. I'm not the only person taking care of ruby-mode now. There's at least Stefan, and looks like Bozhidar is also joining the fray.