all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Problem case for ruby-mode indentation
       [not found] <F0657697-BC48-4B13-918F-4C42C36D936D@sanityinc.com>
@ 2013-11-04 10:58 ` Dmitry Gutov
  2013-11-04 13:44   ` Bozhidar Batsov
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Gutov @ 2013-11-04 10:58 UTC (permalink / raw)
  To: Steve Purcell; +Cc: emacs-devel

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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem case for ruby-mode indentation
  2013-11-04 10:58 ` Problem case for ruby-mode indentation Dmitry Gutov
@ 2013-11-04 13:44   ` Bozhidar Batsov
  2013-11-04 13:50     ` Steve Purcell
  0 siblings, 1 reply; 3+ messages in thread
From: Bozhidar Batsov @ 2013-11-04 13:44 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Steve Purcell, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2401 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3288 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Problem case for ruby-mode indentation
  2013-11-04 13:44   ` Bozhidar Batsov
@ 2013-11-04 13:50     ` Steve Purcell
  0 siblings, 0 replies; 3+ messages in thread
From: Steve Purcell @ 2013-11-04 13:50 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Bozhidar Batsov, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 2664 bytes --]

Thanks — only hours after sending the email did it occur to me that a bug report might have been a better idea…

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


[-- Attachment #2: Type: text/html, Size: 4172 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-04 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <F0657697-BC48-4B13-918F-4C42C36D936D@sanityinc.com>
2013-11-04 10:58 ` Problem case for ruby-mode indentation Dmitry Gutov
2013-11-04 13:44   ` Bozhidar Batsov
2013-11-04 13:50     ` Steve Purcell

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.