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 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’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. > >