From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Steve Purcell Newsgroups: gmane.emacs.devel Subject: Re: Problem case for ruby-mode indentation Date: Mon, 4 Nov 2013 13:50:23 +0000 Message-ID: References: <52777DD7.1020305@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1816\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_D32C52F9-2FAB-4E37-BF6D-9432CA5299E0" X-Trace: ger.gmane.org 1383573086 13943 80.91.229.3 (4 Nov 2013 13:51:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Nov 2013 13:51:26 +0000 (UTC) Cc: Bozhidar Batsov , emacs-devel To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 04 14:51:30 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 1VdKYw-0005gT-IX for ged-emacs-devel@m.gmane.org; Mon, 04 Nov 2013 14:51:26 +0100 Original-Received: from localhost ([::1]:50027 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdKYv-0001Cd-Q9 for ged-emacs-devel@m.gmane.org; Mon, 04 Nov 2013 08:51:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdKY6-0000Dl-FO for emacs-devel@gnu.org; Mon, 04 Nov 2013 08:50:39 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdKY1-0008FG-DT for emacs-devel@gnu.org; Mon, 04 Nov 2013 08:50:34 -0500 Original-Received: from h1189701.stratoserver.net ([85.214.32.38]:41835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdKY0-0008Ea-Vm for emacs-devel@gnu.org; Mon, 04 Nov 2013 08:50:29 -0500 Original-Received: from [192.168.1.112] (host81-129-28-125.range81-129.btcentralplus.com [81.129.28.125]) by h1189701.stratoserver.net (Postfix) with ESMTPSA id EF82E1118049; Mon, 4 Nov 2013 14:50:24 +0100 (CET) In-Reply-To: X-Mailer: Apple Mail (2.1816) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 85.214.32.38 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:164923 Archived-At: --Apple-Mail=_D32C52F9-2FAB-4E37-BF6D-9432CA5299E0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Thanks =97 only hours after sending the email did it occur to me that a = bug report might have been a better idea=85 I=92ll make a point of addressing the group directly next time. Really exciting to see all the work being done on ruby-mode recently! -Steve On 4 Nov 2013, at 13:44, Bozhidar Batsov wrote: > I'll probably start testing more extensively the smie indentation = logic soon. So far things are looking pretty good, I'm sure that by the = time 24.4 gets released we'll have the best indentation implementation = ruby-mode has ever had. >=20 >=20 > On 4 November 2013 12:58, Dmitry Gutov wrote: > Hi Steve, >=20 > 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: >=20 > if something_wrong? # ruby-move-to-block-skips-heredoc > ActiveSupport::Deprecation.warn(<<-eowarn, foo) > boo hoo > end (bah) > eowarn > foo > end >=20 > Seems like it=92s the parens inside the heredoc which confuse matters. = It=92s the same with/without `ruby-use-smie`. >=20 > 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. >=20 > Should be fixed now, in 114935 (with SMIE). Although, as usual, I'm = not sure whether that solution is the best one. >=20 > Here=92s another example from some proprietary code, which seems to = confirm that issue: >=20 > 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 =3D ?) > end_sql >=20 > (Make sure you view this with a monospaced font, of course.) >=20 > Also looks fixed now. >=20 > To be fair, this has never really worked perfectly, but I think this = is a little more broken than I remember it. :-) >=20 > 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. >=20 > 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. >=20 >=20 --Apple-Mail=_D32C52F9-2FAB-4E37-BF6D-9432CA5299E0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 Thanks = =97 only hours after sending the email did it occur to me that a bug = report might have been a better idea=85

I=92ll make a = point of addressing the group directly next = time.

Really exciting to see all the work being = done on ruby-mode = recently!

-Steve


=

On 4 Nov 2013, at 13:44, Bozhidar Batsov <bozhidar@batsov.com> = wrote:

I'll probably start testing more = extensively the smie indentation logic soon. So far things are looking = pretty good, I'm sure that by the time 24.4 gets released we'll have the = best indentation implementation ruby-mode has ever had.


On 4 = November 2013 12:58, Dmitry Gutov <dgutov@yandex.ru> wrote:
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=92s the parens inside the heredoc which confuse matters. = It=92s 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=92s 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 =3D ?)
                    = 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.



= --Apple-Mail=_D32C52F9-2FAB-4E37-BF6D-9432CA5299E0--