From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: 24.3; Indentation of method arguments without parentheses in ruby-mode is broken Resent-From: Bozhidar Batsov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2013 06:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 15594@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.138155912823930 (code B ref -1); Sat, 12 Oct 2013 06:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Oct 2013 06:25:28 +0000 Received: from localhost ([127.0.0.1]:43940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUsdh-0006Dq-1I for submit@debbugs.gnu.org; Sat, 12 Oct 2013 02:25:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34995) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUsdb-0006Dc-7a for submit@debbugs.gnu.org; Sat, 12 Oct 2013 02:25:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUsdS-00050k-Ko for submit@debbugs.gnu.org; Sat, 12 Oct 2013 02:25:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUsdS-00050g-Hc for submit@debbugs.gnu.org; Sat, 12 Oct 2013 02:25:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUsdJ-0001vc-VK for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 02:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUsdB-0004j3-I7 for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 02:25:01 -0400 Received: from mail-ee0-x234.google.com ([2a00:1450:4013:c00::234]:63617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUsdB-0004is-Au for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 02:24:53 -0400 Received: by mail-ee0-f52.google.com with SMTP id c41so2310300eek.11 for ; Fri, 11 Oct 2013 23:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:subject:mime-version:content-type; bh=L13XekaX7o/cz9ptCxBxoNi770IbjlVlJ6vYlxI6Zqc=; b=gOVrZWiaPfq8tYB20dEj4aIaDnrABIfFjqcdyrTt4rTqWK6FlkfOH7OXvODZo9XohX dxc9J0CJu/Ma8OYoWmQ0C08OiRlbw0sLbZ/9U/jUBn8REOooy0BVCTvlZpRBs3sz6o9J z72x+PsMuHQ9kBFHj5H5Hn5azYgMKqTi9bGUSJXgnRUOlMVdklnewldWkDrjDw5wTxK5 gAhsbAj4wMp/tCPJlCbkcQu/f8VUSZT6xVaTrj3HaC+dQEG1rfk0mq7PXeFwy/9YEZgz +vKlNkrd62AjO8/c4/x5txCxYuUBhh7RWtQ9b8BarzExqdKyxNYxowJbFWwVf7x407RW h6ag== X-Received: by 10.15.101.137 with SMTP id bp9mr912177eeb.53.1381559092403; Fri, 11 Oct 2013 23:24:52 -0700 (PDT) Received: from [10.0.1.4] (93-152-182-45.ddns.onlinedirect.bg. [93.152.182.45]) by mx.google.com with ESMTPSA id h45sm123626540eeg.5.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 11 Oct 2013 23:24:51 -0700 (PDT) Date: Sat, 12 Oct 2013 09:24:49 +0300 From: Bozhidar Batsov Message-ID: <755585C36CA244F598A91F3A4C76E258@gmail.com> X-Mailer: sparrow 1.6.4 (build 1178) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="5258eb31_520eedd1_30e" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --5258eb31_520eedd1_30e Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline In Ruby one can invoke methods with or without parentheses: some_method(arg1, arg2) some_method arg1, arg2 ruby-mode currently does not handle properly the indentation of calls without parentheses that span several lines: # indented properly in 24.3 some_method(arg1, arg2) # not indented at all in 24.3 some_method arg1, arg2 Ideally the second code example would be indented by ruby-mode like this: some_method arg1, arg2 -- Cheers, Bozhidar --5258eb31_520eedd1_30e Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
In Ruby one can = invoke methods with or without parentheses:

= some=5Fmethod(arg1, arg2)
some=5Fmethod arg1, arg2

ruby-mode currentl= y does not handle properly the indentation of calls without parentheses t= hat span several lines:

=23 indented = properly in 24.3
some=5F= method(arg1,
  &nbs= p;                  arg2)

=23 not indented at all in 24.3
<= div>some=5Fmethod arg1,
= arg2

Ideall= y the second code example would be indented by ruby-mode like this:

some=5Fmethod arg1,
               = ;      arg2

-- 
Cheers,
Bozhidar=

--5258eb31_520eedd1_30e-- From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: 24.3; Indentation of method arguments without parentheses in ruby-mode is broken Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2013 14:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Bozhidar Batsov Cc: 15594@debbugs.gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.13815886409237 (code B ref 15594); Sat, 12 Oct 2013 14:38:02 +0000 Received: (at 15594) by debbugs.gnu.org; 12 Oct 2013 14:37:20 +0000 Received: from localhost ([127.0.0.1]:44412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV0Jj-0002Ov-Jy for submit@debbugs.gnu.org; Sat, 12 Oct 2013 10:37:19 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:39333) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV0Ji-0002Oi-HQ for 15594@debbugs.gnu.org; Sat, 12 Oct 2013 10:37:18 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCreE/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFMCreE/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35344602" Received: from 76-10-183-132.dsl.teksavvy.com (HELO pastel.home) ([76.10.183.132]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 12 Oct 2013 10:33:22 -0400 Received: by pastel.home (Postfix, from userid 20848) id 7043460C0B; Sat, 12 Oct 2013 10:37:17 -0400 (EDT) From: Stefan Monnier Message-ID: References: <755585C36CA244F598A91F3A4C76E258@gmail.com> Date: Sat, 12 Oct 2013 10:37:17 -0400 In-Reply-To: <755585C36CA244F598A91F3A4C76E258@gmail.com> (Bozhidar Batsov's message of "Sat, 12 Oct 2013 09:24:49 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > In Ruby one can invoke methods with or without parentheses: > some_method(arg1, arg2) > some_method arg1, arg2 Interesting. How is the following parsed, then: some_method arg1, other_method arg2, arg3, arg4 -- Stefan From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: 24.3; Indentation of method arguments without parentheses in ruby-mode is broken Resent-From: Bozhidar Batsov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2013 14:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 15594@debbugs.gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.13815890589903 (code B ref 15594); Sat, 12 Oct 2013 14:45:02 +0000 Received: (at 15594) by debbugs.gnu.org; 12 Oct 2013 14:44:18 +0000 Received: from localhost ([127.0.0.1]:44422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV0QT-0002Zf-GK for submit@debbugs.gnu.org; Sat, 12 Oct 2013 10:44:17 -0400 Received: from mail-bk0-f50.google.com ([209.85.214.50]:39269) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VV0QS-0002ZX-0H for 15594@debbugs.gnu.org; Sat, 12 Oct 2013 10:44:16 -0400 Received: by mail-bk0-f50.google.com with SMTP id mz11so2026404bkb.37 for <15594@debbugs.gnu.org>; Sat, 12 Oct 2013 07:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-type; bh=xq0VsT2IbpJhbkftoTWL0wUsIn2dJarZN1yETrM4Rmw=; b=LTSuyIw99XK9LfjB6qOoqQmOyfsZv426Xog7Z4dTZ/5ymXZWJ5/0pjGtazjYtNmO18 qZIuzwYdzzEFdX4VYVlYaj4tkZsOKyPxGuX9ETqdVn+kOOu/CdH0FL+mSELr+fjR+fzy z5+W9hGndTDV46uSEeq0q0b04YjBDkFOXfLTKxjM5OBeII0N6CMB05N+Qv+7L+Xr8/He qxKfCupxe0kolXYB/rMUeBekeZxSyQGKqrjEDdmOuu2YfwXIIcHXoZD2XLQMxBTDLyxH WFSdzc1rTfeLodMGt9s0ftappkokEn6pxQYZIHquz9mjPkrkNAShccHzyp/f+/JT1MD2 pBAg== X-Received: by 10.204.121.201 with SMTP id i9mr22573441bkr.13.1381589055004; Sat, 12 Oct 2013 07:44:15 -0700 (PDT) Received: from [10.0.1.4] (93-152-182-45.ddns.onlinedirect.bg. [93.152.182.45]) by mx.google.com with ESMTPSA id z6sm33896849bkn.8.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 12 Oct 2013 07:44:14 -0700 (PDT) Date: Sat, 12 Oct 2013 17:44:11 +0300 From: Bozhidar Batsov Message-ID: In-Reply-To: References: <755585C36CA244F598A91F3A4C76E258@gmail.com> X-Mailer: sparrow 1.6.4 (build 1178) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="5259603b_6a5ee64_30e" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --5259603b_6a5ee64_30e Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Saturday, October 12, 2013 at 5:37 PM, Stefan Monnier wrote: > > In Ruby one can invoke methods with or without parentheses: > > some_method(arg1, arg2) > > some_method arg1, arg2 > > > > > Interesting. How is the following parsed, then: > > some_method arg1, other_method arg2, arg3, arg4 There are some limitations, of course. Ambiguous cases generally result in parsing errors: Parser::CurrentRuby.parse('some_method arg1, other_method arg2, arg3, arg4') (string):1:32: error: unexpected token tIDENTIFIER some_method arg1, other_method arg2, arg3, arg4 ^^^^ Parser::SyntaxError: unexpected token tIDENTIFIER If we remove arg1, however, there is no ambiguity: [21] pry(main)> Parser::CurrentRuby.parse('some_method other_method arg2, arg3, arg4') => (send nil :some_method (send nil :other_method (send nil :arg2) (send nil :arg3) (send nil :arg4))) > > > -- Stefan --5259603b_6a5ee64_30e Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
On S= aturday, October 12, 2013 at 5:37 PM, Stefan Monnier wrote:
In Ruby one can invoke methods with or without parentheses:
= some=5Fmethod(arg1, arg2)
some=5Fmethod arg1, arg2
<= /blockquote>

Interesting. How is the following parsed= , then:

some=5Fmethod arg1, other=5Fmethod ar= g2, arg3, arg4
There are some limitations, of course. Ambiguous cases ge= nerally result in parsing errors:

Parser:= :CurrentRuby.parse('some=5Fmethod arg1, other=5Fmethod arg2, arg3, arg4')=
(string):1:32: error: unexpected token tIDENTI=46IER
some=5Fmethod arg1, other=5Fmethod arg2, arg3, arg4
  &nb= sp;                    =                     &n= bsp;     =5E=5E=5E=5E
Parser::SyntaxError: unexpected= token tIDENTI=46IER 

If we remove arg1, however, there is no ambiguity:

=5B21=5D= pry(main)> Parser::CurrentRuby.parse('some=5Fmethod other=5Fmethod ar= g2, arg3, arg4')
=3D> (send nil :some=5Fmethod
&nb= sp; (send nil :other=5Fmethod
    (send nil :arg2)
    (send nil :arg3)
    (send nil = :arg4)))
=


-- Stefan
<= /span> =20 =20 =20 =20
=20

--5259603b_6a5ee64_30e-- From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Oct 2013 02:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 15594@debbugs.gnu.org, emacs-devel@gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.13817164154309 (code B ref 15594); Mon, 14 Oct 2013 02:07:02 +0000 Received: (at 15594) by debbugs.gnu.org; 14 Oct 2013 02:06:55 +0000 Received: from localhost ([127.0.0.1]:47090 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVXYc-00017R-SV for submit@debbugs.gnu.org; Sun, 13 Oct 2013 22:06:55 -0400 Received: from mail-ea0-f177.google.com ([209.85.215.177]:58151) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVXYa-00017E-QA for 15594@debbugs.gnu.org; Sun, 13 Oct 2013 22:06:53 -0400 Received: by mail-ea0-f177.google.com with SMTP id f15so2984835eak.8 for <15594@debbugs.gnu.org>; Sun, 13 Oct 2013 19:06:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=5o7SKvy3AfV4umTjiEt+QYi1Q5E6L57iqe77B2Utm7Y=; b=lpU5e0liZ2Y4ljXv4IAKUNetKX7c88oweo+fNWYb13xinWz7jZAp5rBic8fSlPb/yH iIsGz43Z5LYllDMd1/NTjZPPL2hVhKaUICbOr2FEzlhGWo2ErOmh4vKL53PFW71Ks+Vd fqNRnPBm3O4jN+0PWDRaTwXg8WKwCj/oQAowV9QMrDyXyI+XvhtGW26SEmEHKeVpGgIz oz9ScS6fnFzo1j+m7bZqN21nmmi2q8Ezidi8nojpr/M2d1OGMuArMW0EEH4rUxCdgDrj zTXEg0rlYtPCuKAG/80Yaf4hLmBJhsxYZWiSRLPivuoOvBTroT4IC0SQO+4LKbWXcJDy GiAw== X-Received: by 10.14.29.67 with SMTP id h43mr52383845eea.7.1381716407129; Sun, 13 Oct 2013 19:06:47 -0700 (PDT) Received: from axl (93-113-74.netrun.cytanet.com.cy. [93.109.113.74]) by mx.google.com with ESMTPSA id d8sm147212006eeh.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 13 Oct 2013 19:06:46 -0700 (PDT) From: Dmitry Gutov References: Date: Mon, 14 Oct 2013 05:06:38 +0300 In-Reply-To: (Stefan Monnier's message of "Sat, 12 Oct 2013 20:40:54 +0000") Message-ID: <87a9icobbl.fsf@yandex.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) 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 > 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. From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Oct 2013 13:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 15594@debbugs.gnu.org, emacs-devel@gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.138175825625589 (code B ref 15594); Mon, 14 Oct 2013 13:45:02 +0000 Received: (at 15594) by debbugs.gnu.org; 14 Oct 2013 13:44:16 +0000 Received: from localhost ([127.0.0.1]:48598 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VViRT-0006ee-CS for submit@debbugs.gnu.org; Mon, 14 Oct 2013 09:44:15 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:35353) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VViRR-0006eO-2B for 15594@debbugs.gnu.org; Mon, 14 Oct 2013 09:44:13 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFMCqeW/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCwsOJhIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av8EABK/CFFMCqeW/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCwsOJhIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35448000" Received: from 76-10-167-150.dsl.teksavvy.com (HELO pastel.home) ([76.10.167.150]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 14 Oct 2013 09:40:05 -0400 Received: by pastel.home (Postfix, from userid 20848) id B376C60A97; Mon, 14 Oct 2013 09:44:06 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87a9icobbl.fsf@yandex.ru> Date: Mon, 14 Oct 2013 09:44:06 -0400 In-Reply-To: <87a9icobbl.fsf@yandex.ru> (Dmitry Gutov's message of "Mon, 14 Oct 2013 05:06:38 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > 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 From unknown Tue Jun 17 22:24:34 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Bozhidar Batsov Subject: bug#15594: closed (Re: bug#15594: 24.3; Indentation of method arguments without parentheses in ruby-mode is broken) Message-ID: References: <755585C36CA244F598A91F3A4C76E258@gmail.com> X-Gnu-PR-Message: they-closed 15594 X-Gnu-PR-Package: emacs Reply-To: 15594@debbugs.gnu.org Date: Mon, 14 Oct 2013 18:58:05 +0000 Content-Type: multipart/mixed; boundary="----------=_1381777085-27646-1" This is a multi-part message in MIME format... ------------=_1381777085-27646-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #15594: 24.3; Indentation of method arguments without parentheses in ruby-m= ode is broken which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 15594@debbugs.gnu.org. --=20 15594: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15594 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1381777085-27646-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 15594-done) by debbugs.gnu.org; 14 Oct 2013 18:57:31 +0000 Received: from localhost ([127.0.0.1]:49274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVnKd-00076p-16 for submit@debbugs.gnu.org; Mon, 14 Oct 2013 14:57:31 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:46562) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVnKa-00076I-F5 for 15594-done@debbugs.gnu.org; Mon, 14 Oct 2013 14:57:29 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r9EIvPWg019118; Mon, 14 Oct 2013 14:57:26 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 38F7B662FD; Sat, 12 Oct 2013 16:41:26 -0400 (EDT) From: Stefan Monnier To: Bozhidar Batsov Subject: Re: bug#15594: 24.3; Indentation of method arguments without parentheses in ruby-mode is broken Message-ID: References: <755585C36CA244F598A91F3A4C76E258@gmail.com> Date: Sat, 12 Oct 2013 16:41:26 -0400 In-Reply-To: (Bozhidar Batsov's message of "Sat, 12 Oct 2013 17:44:11 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 2 Rules triggered GEN_SPAM_FEATRE=0.2, RV4731=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4731> : inlines <142> : streams <1055822> : uri <1565255> X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 15594-done Cc: 15594-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) >> > In Ruby one can invoke methods with or without parentheses: >> > some_method(arg1, arg2) >> > some_method arg1, arg2 I just added some support for it, thank you, Stefan ------------=_1381777085-27646-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 12 Oct 2013 06:25:28 +0000 Received: from localhost ([127.0.0.1]:43940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUsdh-0006Dq-1I for submit@debbugs.gnu.org; Sat, 12 Oct 2013 02:25:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34995) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUsdb-0006Dc-7a for submit@debbugs.gnu.org; Sat, 12 Oct 2013 02:25:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUsdS-00050k-Ko for submit@debbugs.gnu.org; Sat, 12 Oct 2013 02:25:18 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33511) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUsdS-00050g-Hc for submit@debbugs.gnu.org; Sat, 12 Oct 2013 02:25:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36683) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUsdJ-0001vc-VK for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 02:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VUsdB-0004j3-I7 for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 02:25:01 -0400 Received: from mail-ee0-x234.google.com ([2a00:1450:4013:c00::234]:63617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VUsdB-0004is-Au for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2013 02:24:53 -0400 Received: by mail-ee0-f52.google.com with SMTP id c41so2310300eek.11 for ; Fri, 11 Oct 2013 23:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:message-id:subject:mime-version:content-type; bh=L13XekaX7o/cz9ptCxBxoNi770IbjlVlJ6vYlxI6Zqc=; b=gOVrZWiaPfq8tYB20dEj4aIaDnrABIfFjqcdyrTt4rTqWK6FlkfOH7OXvODZo9XohX dxc9J0CJu/Ma8OYoWmQ0C08OiRlbw0sLbZ/9U/jUBn8REOooy0BVCTvlZpRBs3sz6o9J z72x+PsMuHQ9kBFHj5H5Hn5azYgMKqTi9bGUSJXgnRUOlMVdklnewldWkDrjDw5wTxK5 gAhsbAj4wMp/tCPJlCbkcQu/f8VUSZT6xVaTrj3HaC+dQEG1rfk0mq7PXeFwy/9YEZgz +vKlNkrd62AjO8/c4/x5txCxYuUBhh7RWtQ9b8BarzExqdKyxNYxowJbFWwVf7x407RW h6ag== X-Received: by 10.15.101.137 with SMTP id bp9mr912177eeb.53.1381559092403; Fri, 11 Oct 2013 23:24:52 -0700 (PDT) Received: from [10.0.1.4] (93-152-182-45.ddns.onlinedirect.bg. [93.152.182.45]) by mx.google.com with ESMTPSA id h45sm123626540eeg.5.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 11 Oct 2013 23:24:51 -0700 (PDT) Date: Sat, 12 Oct 2013 09:24:49 +0300 From: Bozhidar Batsov To: bug-gnu-emacs@gnu.org Message-ID: <755585C36CA244F598A91F3A4C76E258@gmail.com> Subject: 24.3; Indentation of method arguments without parentheses in ruby-mode is broken X-Mailer: sparrow 1.6.4 (build 1178) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="5258eb31_520eedd1_30e" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --5258eb31_520eedd1_30e Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline In Ruby one can invoke methods with or without parentheses: some_method(arg1, arg2) some_method arg1, arg2 ruby-mode currently does not handle properly the indentation of calls without parentheses that span several lines: # indented properly in 24.3 some_method(arg1, arg2) # not indented at all in 24.3 some_method arg1, arg2 Ideally the second code example would be indented by ruby-mode like this: some_method arg1, arg2 -- Cheers, Bozhidar --5258eb31_520eedd1_30e Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
In Ruby one can = invoke methods with or without parentheses:

= some=5Fmethod(arg1, arg2)
some=5Fmethod arg1, arg2

ruby-mode currentl= y does not handle properly the indentation of calls without parentheses t= hat span several lines:

=23 indented = properly in 24.3
some=5F= method(arg1,
  &nbs= p;                  arg2)

=23 not indented at all in 24.3
<= div>some=5Fmethod arg1,
= arg2

Ideall= y the second code example would be indented by ruby-mode like this:

some=5Fmethod arg1,
               = ;      arg2

-- 
Cheers,
Bozhidar=

--5258eb31_520eedd1_30e-- ------------=_1381777085-27646-1-- From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Oct 2013 01:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 15594@debbugs.gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.13818002436401 (code B ref 15594); Tue, 15 Oct 2013 01:25:02 +0000 Received: (at 15594) by debbugs.gnu.org; 15 Oct 2013 01:24:03 +0000 Received: from localhost ([127.0.0.1]:49576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVtMg-0001f9-FU for submit@debbugs.gnu.org; Mon, 14 Oct 2013 21:24:02 -0400 Received: from mail-ee0-f52.google.com ([74.125.83.52]:57163) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVtMd-0001eV-Qq for 15594@debbugs.gnu.org; Mon, 14 Oct 2013 21:24:00 -0400 Received: by mail-ee0-f52.google.com with SMTP id c41so3765279eek.11 for <15594@debbugs.gnu.org>; Mon, 14 Oct 2013 18:23:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=/p8OGEVHIFWFtQconBaCKjZAwxSVCSrQsss+4ICOSB8=; b=Ua0weSIwShAPYHynzs6gSInYwgwg+Zrqw8aG+ucHkbbmkNluTNTvLYvZc4WSHUU6Vv 1DcndhcdH1ieMCS+pNPblQd9KmaUiNcHbA3pB19pheWdawAA7ysxM3ChU8eIfZsO9v1q VNv9oZNmSvrfGe+ZnrEOdOJh++rNxpHPWkiSKbYKI0Fr/3aT8AnyiGivSzRzNj5oqEov qFazMKMIi3HZ0P7Ds38puZrQKOzd7Qs/t4B14krGxDBzAH3DUEdj7LE+UMNHtSEMkwOT LTkNapLxKOnrdJmNq91SklphRIYmXG3Uh3gtDX6FAPGTJYI7/WJtfWqsVe44zcOzvL/B AlfQ== X-Received: by 10.14.216.136 with SMTP id g8mr166284eep.61.1381800233959; Mon, 14 Oct 2013 18:23:53 -0700 (PDT) Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id d8sm159969549eeh.8.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Oct 2013 18:23:53 -0700 (PDT) Message-ID: <525C9926.9030202@yandex.ru> Date: Tue, 15 Oct 2013 04:23:50 +0300 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 References: <87a9icobbl.fsf@yandex.ru> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 14.10.2013 16:44, Stefan Monnier wrote: >> 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? > > ...(+) But it'll be more difficult to handle >...(++) > since there's no space to use as "implicit method call infix operator". No, space is significant(++), I'm not suggesting to revert the addition of the " @ " token. But we need a better predicate in `ruby-smie--args-separator-p' to check that the thing after POS is probably an argument. "Starts with a word character" is too narrow. > (+) I don't see anything that would stop us. How would that look? (unless (member (save-excursion (ruby-smie--forward-token) '("]" "}" "end" "+" "-" "?" ":" ...))) ? Can we extract the "prohibited" list from the already defined grammar? Or should the check be more like "is the next token in `ruby-smie-grammar', and if yes, is its left priority more than ' @ 's right priority"? (++) > method(arg1), > arg2 > or > method{arg1}, > arg2 > Both examples would result in syntax errors. The second one doubly so, since the first arg there is not a hash, but a block, and a block can only come after all other arguments. Even if the first argument were {:a => 1, :b => 2}, actually, it won't work because "{" in this position is parsed as the beginning of a block (that means one of the examples I added is wrong, sorry!). You've probably already found this, but on the off chance you haven't, here's its syntax in (incomplete, somewhat outdated, etc) BNF form: http://www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf > +# Shouldn't "bar" be aligned with "foo"? --Stef > if foo && > bar > end Maybe. Either option would be better than the current behavior. I've picked this one because the old engine indents it like so, and additional indentation of 2 (compared to the if body) would likely be more useful that 1, when reading the code. > +# Shouldn't "arg2" be aligned with "!" rather than with "arg1"? --Stef > method !arg1, > arg2 Yes, sorry. Fixed, and added a couple of new examples, like usual. From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 15 Oct 2013 03:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 15594@debbugs.gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.138180788418480 (code B ref 15594); Tue, 15 Oct 2013 03:32:01 +0000 Received: (at 15594) by debbugs.gnu.org; 15 Oct 2013 03:31:24 +0000 Received: from localhost ([127.0.0.1]:49663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVvLw-0004o0-5t for submit@debbugs.gnu.org; Mon, 14 Oct 2013 23:31:24 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:49873) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVvLt-0004nm-Dd for 15594@debbugs.gnu.org; Mon, 14 Oct 2013 23:31:22 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjkFABK/CFG4rw4O/2dsb2JhbABEFrovhEkXc4IeAQEDAQFWIwULCw4mEhQYDSSIHgYMwSGOLoJcA6R6gV6Caik X-IPAS-Result: AjkFABK/CFG4rw4O/2dsb2JhbABEFrovhEkXc4IeAQEDAQFWIwULCw4mEhQYDSSIHgYMwSGOLoJcA6R6gV6Caik X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35492158" Received: from 184-175-14-14.dsl.teksavvy.com (HELO pastel.home) ([184.175.14.14]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 14 Oct 2013 23:27:11 -0400 Received: by pastel.home (Postfix, from userid 20848) id 79C2560C0D; Mon, 14 Oct 2013 23:31:15 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87a9icobbl.fsf@yandex.ru> <525C9926.9030202@yandex.ru> Date: Mon, 14 Oct 2013 23:31:15 -0400 In-Reply-To: <525C9926.9030202@yandex.ru> (Dmitry Gutov's message of "Tue, 15 Oct 2013 04:23:50 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > No, space is significant(++), I guess we're lucky. > I'm not suggesting to revert the addition of > the " @ " token. But we need a better predicate in > ruby-smie--args-separator-p' to check that the thing after POS is probably > an argument. "Starts with a word character" is too narrow. > How would that look? > (unless (member (save-excursion (ruby-smie--forward-token) '("]" "}" "end" > "+" "-" "?" ":" ...))) (looking-at "\\s)\\|\\s.") ? > Or should the check be more like "is the next token in `ruby-smie-grammar', > and if yes, is its left priority more than ' @ 's right priority"? Calling ruby-smie--forward-token is a bit dangerous since that function might itself be called from ruby-smie--forward-token. It might work, but you'll have to think hard about why an inf-loop is not possible. > You've probably already found this, but on the off chance you haven't, > here's its syntax in (incomplete, somewhat outdated, etc) BNF form: > http://www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf Please add this URL in a comment somewhere near ruby-smie-grammar (for example). >> +# Shouldn't "bar" be aligned with "foo"? --Stef >> if foo && >> bar >> end > Maybe. Either option would be better than the current behavior. I've picked > this one because the old engine indents it like so, and additional > indentation of 2 (compared to the if body) would likely be more useful that > 1, when reading the code. Getting `foo' and `bar' aligned is just a matter of adding && to the set of infix operators (i.e. completing the table of infix operators). Getting `bar' to be indented one more than `foo' here but not in other cases of "foo && \n bar" would require more work. Stefan From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Oct 2013 06:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 15594@debbugs.gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.13823353715101 (code B ref 15594); Mon, 21 Oct 2013 06:03:01 +0000 Received: (at 15594) by debbugs.gnu.org; 21 Oct 2013 06:02:51 +0000 Received: from localhost ([127.0.0.1]:59805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VY8Zn-0001KD-3y for submit@debbugs.gnu.org; Mon, 21 Oct 2013 02:02:51 -0400 Received: from mail-ea0-f174.google.com ([209.85.215.174]:32840) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VY8Zl-0001Jz-5c for 15594@debbugs.gnu.org; Mon, 21 Oct 2013 02:02:49 -0400 Received: by mail-ea0-f174.google.com with SMTP id z15so3241446ead.33 for <15594@debbugs.gnu.org>; Sun, 20 Oct 2013 23:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=YOagwMVHFpMW11o1q7j0JX30DQCUS5d7fGoDLf8sIp4=; b=XfHLUeub9tyU+yrGZ5OKBCSShnZuv8+l3L78PjeHES0P/6o4BjQsMtKG6ViLI2efz3 GyuWabQybisuvKFDiS4Odb5DgeG6dH1w1uCN3jFXb0ASh1Cxyf3XxTiJyjNoCRI/itud 3hyqMSLpl/A8+VCL2nRS4slxZsa4s6LOkkFeuetLq6+lK+o9XNRzhajco8eay6zQ9Lel apbxIuIKde0G2R9nEvORecTcfdbmBdlBLhpevSps/M3LDkF/xdNaPXgw0CjSjZzfSWI7 yMSwRl1StOXvYpS6HpbKn62F4NHsaFN2OfBFRW2jolZK/TEe02O3rIiudfasNcAGhhkO 00CQ== X-Received: by 10.15.45.135 with SMTP id b7mr170637eew.135.1382335363274; Sun, 20 Oct 2013 23:02:43 -0700 (PDT) Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id x47sm39442761eea.16.2013.10.20.23.02.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 20 Oct 2013 23:02:42 -0700 (PDT) Message-ID: <5264C37E.6080300@yandex.ru> Date: Mon, 21 Oct 2013 10:02:38 +0400 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 References: <87a9icobbl.fsf@yandex.ru> <525C9926.9030202@yandex.ru> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 15.10.2013 07:31, Stefan Monnier wrote: >> How would that look? >> (unless (member (save-excursion (ruby-smie--forward-token) '("]" "}" "end" >> "+" "-" "?" ":" ...))) > > (looking-at "\\s)\\|\\s.") ? I guess this is better, but it has both false negatives (unary operators like -, ~ and !) and false positives (all non-opener keywords). >> Or should the check be more like "is the next token in `ruby-smie-grammar', >> and if yes, is its left priority more than ' @ 's right priority"? > > Calling ruby-smie--forward-token is a bit dangerous since that function > might itself be called from ruby-smie--forward-token. It might work, > but you'll have to think hard about why an inf-loop is not possible. Hopefully because both `ruby-smie--forward-token' and `ruby-smie--backward-token' would only call `ruby-smie--forward-token', and only when (> pos (point)), IOW there has to be some whitespace skipping done between the recursive calls. >> You've probably already found this, but on the off chance you haven't, >> here's its syntax in (incomplete, somewhat outdated, etc) BNF form: >> http://www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf > > Please add this URL in a comment somewhere near ruby-smie-grammar (for > example). Done. > Getting `foo' and `bar' aligned is just a matter of adding && to the set > of infix operators (i.e. completing the table of infix operators). > Getting `bar' to be indented one more than `foo' here but not in other > cases of "foo && \n bar" would require more work. Ok, let's go with the former for now. From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Oct 2013 13:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 15594@debbugs.gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.138236191819653 (code B ref 15594); Mon, 21 Oct 2013 13:26:02 +0000 Received: (at 15594) by debbugs.gnu.org; 21 Oct 2013 13:25:18 +0000 Received: from localhost ([127.0.0.1]:60426 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYFTw-00056u-TN for submit@debbugs.gnu.org; Mon, 21 Oct 2013 09:25:17 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:59059) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYFTt-00056b-9O for 15594@debbugs.gnu.org; Mon, 21 Oct 2013 09:25:13 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxLCX/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAsOJhIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFFxLCX/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAsOJhIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35965889" Received: from 69-196-176-151.dsl.teksavvy.com (HELO pastel.home) ([69.196.176.151]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 21 Oct 2013 09:25:07 -0400 Received: by pastel.home (Postfix, from userid 20848) id 8E03C6032F; Mon, 21 Oct 2013 09:25:07 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87a9icobbl.fsf@yandex.ru> <525C9926.9030202@yandex.ru> <5264C37E.6080300@yandex.ru> Date: Mon, 21 Oct 2013 09:25:07 -0400 In-Reply-To: <5264C37E.6080300@yandex.ru> (Dmitry Gutov's message of "Mon, 21 Oct 2013 10:02:38 +0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> Calling ruby-smie--forward-token is a bit dangerous since that function >> might itself be called from ruby-smie--forward-token. It might work, >> but you'll have to think hard about why an inf-loop is not possible. > Hopefully because both `ruby-smie--forward-token' and > ruby-smie--backward-token' would only call `ruby-smie--forward-token', and > only when (> pos (point)), IOW there has to be some whitespace skipping done > between the recursive calls. Only recursing in one direction (only forward or only backward) is a good way to guarantee progress, indeed. But currently ruby-smie--implicit-semi-p calls ruby-smie--backward-token, so beware. Stefan From unknown Tue Jun 17 22:24:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 26 Oct 2013 01:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15594 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 15594@debbugs.gnu.org Received: via spool by 15594-submit@debbugs.gnu.org id=B15594.13827503549731 (code B ref 15594); Sat, 26 Oct 2013 01:20:01 +0000 Received: (at 15594) by debbugs.gnu.org; 26 Oct 2013 01:19:14 +0000 Received: from localhost ([127.0.0.1]:44263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZsX3-0002Ws-Og for submit@debbugs.gnu.org; Fri, 25 Oct 2013 21:19:13 -0400 Received: from mail-lb0-f182.google.com ([209.85.217.182]:42029) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZsX1-0002Wd-W4 for 15594@debbugs.gnu.org; Fri, 25 Oct 2013 21:19:12 -0400 Received: by mail-lb0-f182.google.com with SMTP id w6so1310876lbh.13 for <15594@debbugs.gnu.org>; Fri, 25 Oct 2013 18:19:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=hTP9xlszuw4+PQqIIb7vupJ9dYl27JPlXxbu1bNr7EI=; b=ucPjkpBpwm/GrWjAD4hAC6IiXtZa7aNGigvzKNLwNFlVS/UL0eMbhkIPx8Ph4TjQYN /CMiRljByVGp/0OdbOtg4CCii85br+wq3iGbCNeSChdtGFXSKI/ZsifKM7X2E2PsX7bE +e5yP7PoudbMrU+WdviyzGvhBe2caMs5rpVVhTnl00lYFREflO3j87bBSQUYn2BUBaL9 G3YRuGp9vnOLa7vwuntfX+YcdS1EC/JD7cF36O5KVdITZEtYufNb0roilrCz87Jq8xZi T/jkcqwsy39036be/gWuejGU2IvJHBJ3wF8oYk2ZS8S0r/QucV4htzw+9YS1rdRvepNg l0PQ== X-Received: by 10.112.64.36 with SMTP id l4mr3952380lbs.15.1382750345964; Fri, 25 Oct 2013 18:19:05 -0700 (PDT) Received: from [192.168.1.3] ([178.252.98.87]) by mx.google.com with ESMTPSA id ac2sm4248445lbc.10.2013.10.25.18.19.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 25 Oct 2013 18:19:05 -0700 (PDT) Message-ID: <526B1887.1000004@yandex.ru> Date: Sat, 26 Oct 2013 05:19:03 +0400 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 References: <87a9icobbl.fsf@yandex.ru> <525C9926.9030202@yandex.ru> <5264C37E.6080300@yandex.ru> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 21.10.2013 17:25, Stefan Monnier wrote: >>> Calling ruby-smie--forward-token is a bit dangerous since that function >>> might itself be called from ruby-smie--forward-token. It might work, >>> but you'll have to think hard about why an inf-loop is not possible. >> Hopefully because both `ruby-smie--forward-token' and >> ruby-smie--backward-token' would only call `ruby-smie--forward-token', and >> only when (> pos (point)), IOW there has to be some whitespace skipping done >> between the recursive calls. > > Only recursing in one direction (only forward or only backward) is > a good way to guarantee progress, indeed. But currently > ruby-smie--implicit-semi-p calls ruby-smie--backward-token, so beware. That's a good point. And this would probably be more expensive approach, so I went with local search, for now.