unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free
       [not found] <E1VV5za-0006lz-QY@vcs.savannah.gnu.org>
@ 2013-10-14  2:06 ` Dmitry Gutov
  2013-10-14 13:44   ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Gutov @ 2013-10-14  2:06 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 15594, emacs-devel

Hi Stefan,

thanks for starting on this feature. Comments and questions follow.

> revno: 114639
> revision-id: monnier@iro.umontreal.ca-20131012204050-2kntbtokz1wa3mk5
> parent: eggert@cs.ucla.edu-20131012200038-eeyl9fi1y3vr0vwy
> committer: Stefan Monnier <monnier@iro.umontreal.ca>
> branch nick: trunk
> timestamp: Sat 2013-10-12 16:40:50 -0400

> ...

> +(defun ruby-smie--args-separator-p (pos)
> +  (and
> +   (eq ?w (char-syntax (char-before)))
> +   (< pos (point-max))
> +   (memq (char-syntax (char-after pos)) '(?w ?\"))))

I've made a change to the first condition in 114655, but the last line
is still very inadequate.

The first argument can be any kind of literal, parenthesized expression,
or even (if we want to get fancy) something like `begin foo; bar end'.
(See new examples is indent/ruby.rb).

So basically, I think we'd like to check if the token following POS is
either not "special", or if it is, it begins an expression. Can we do
that?

> === modified file 'test/indent/ruby.rb'
> --- a/test/indent/ruby.rb	2013-10-11 20:45:14 +0000
> +++ b/test/indent/ruby.rb	2013-10-12 20:40:50 +0000
> @@ -170,3 +170,7 @@
>  if foo &&
>      bar
>  end
> +
> +method1 arg1,                   # bug#15594
> +        method2 arg2,
> +                arg3

Please note that you've added the example to the "currently failing"
part of the file. I've moved it now.



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

* Re: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free
  2013-10-14  2:06 ` trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Dmitry Gutov
@ 2013-10-14 13:44   ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2013-10-14 13:44 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 15594, emacs-devel

> So basically, I think we'd like to check if the token following POS is
> either not "special", or if it is, it begins an expression.  Can we do
> that?

I don't see anything that would stop us.  But it'll be more difficult to handle

    method(arg1),
          arg2
or
    method{arg1},
          arg2

since there's no space to use as "implicit method call infix operator".
          

        Stefan


=== modified file 'test/indent/ruby.rb'
--- test/indent/ruby.rb	2013-10-14 01:51:20 +0000
+++ test/indent/ruby.rb	2013-10-14 13:39:08 +0000
@@ -177,10 +177,12 @@
 foo_bar_tee(1, 2, 3)
   .qux
 
+# Shouldn't "bar" be aligned with "foo"?  --Stef
 if foo &&
     bar
 end
 
+# Shouldn't "arg2" be aligned with "!" rather than with "arg1"?  --Stef
 method !arg1,
         arg2
 




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

end of thread, other threads:[~2013-10-14 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <E1VV5za-0006lz-QY@vcs.savannah.gnu.org>
2013-10-14  2:06 ` trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Dmitry Gutov
2013-10-14 13:44   ` Stefan Monnier

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).