From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free Date: Mon, 14 Oct 2013 05:06:38 +0300 Message-ID: <87a9icobbl.fsf@yandex.ru> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1381716418 2924 80.91.229.3 (14 Oct 2013 02:06:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Oct 2013 02:06:58 +0000 (UTC) Cc: 15594@debbugs.gnu.org, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 14 04:07:02 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VVXYj-0006sk-Sg for ged-emacs-devel@m.gmane.org; Mon, 14 Oct 2013 04:07:01 +0200 Original-Received: from localhost ([::1]:35037 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVXYj-0007B6-65 for ged-emacs-devel@m.gmane.org; Sun, 13 Oct 2013 22:07:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43352) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVXYb-0007Ap-J4 for emacs-devel@gnu.org; Sun, 13 Oct 2013 22:06:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VVXYW-0001OI-7H for emacs-devel@gnu.org; Sun, 13 Oct 2013 22:06:53 -0400 Original-Received: from mail-ee0-x232.google.com ([2a00:1450:4013:c00::232]:36109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VVXYV-0001OC-Vo for emacs-devel@gnu.org; Sun, 13 Oct 2013 22:06:48 -0400 Original-Received: by mail-ee0-f50.google.com with SMTP id d51so3088791eek.9 for ; 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) Original-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) In-Reply-To: (Stefan Monnier's message of "Sat, 12 Oct 2013 20:40:54 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164188 Archived-At: 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.