all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Steve Purcell <steve@sanityinc.com>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Problem case for ruby-mode indentation
Date: Mon, 04 Nov 2013 12:58:31 +0200	[thread overview]
Message-ID: <52777DD7.1020305@yandex.ru> (raw)
In-Reply-To: <F0657697-BC48-4B13-918F-4C42C36D936D@sanityinc.com>

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.



       reply	other threads:[~2013-11-04 10:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <F0657697-BC48-4B13-918F-4C42C36D936D@sanityinc.com>
2013-11-04 10:58 ` Dmitry Gutov [this message]
2013-11-04 13:44   ` Problem case for ruby-mode indentation Bozhidar Batsov
2013-11-04 13:50     ` Steve Purcell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52777DD7.1020305@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=steve@sanityinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.