From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [ruby-mode] Private/protected method definition layout in Ruby 2.1 Date: Wed, 15 Jan 2014 11:24:49 -0500 Message-ID: References: <0E94BE5F9874463D9B4C2A039A3C24E9@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389803103 8397 80.91.229.3 (15 Jan 2014 16:25:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Jan 2014 16:25:03 +0000 (UTC) Cc: emacs-devel To: Bozhidar Batsov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 15 17:25:09 2014 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 1W3THA-0000Zt-Ft for ged-emacs-devel@m.gmane.org; Wed, 15 Jan 2014 17:25:08 +0100 Original-Received: from localhost ([::1]:55760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3THA-0005Qj-3W for ged-emacs-devel@m.gmane.org; Wed, 15 Jan 2014 11:25:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3TH1-0005NQ-5T for emacs-devel@gnu.org; Wed, 15 Jan 2014 11:25:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W3TGr-0000f3-WB for emacs-devel@gnu.org; Wed, 15 Jan 2014 11:24:59 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:59792) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W3TGr-0000ez-SB for emacs-devel@gnu.org; Wed, 15 Jan 2014 11:24:49 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFMCoyj/2dsb2JhbABEhke4Rxdzgh4BAQQBIzMjBQsLGgIYDgICFBgNJIgeBq5fkk6BI45UgRMDiGGcGYFegxU X-IPAS-Result: Av8EABK/CFFMCoyj/2dsb2JhbABEhke4Rxdzgh4BAQQBIzMjBQsLGgIYDgICFBgNJIgeBq5fkk6BI45UgRMDiGGcGYFegxU X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="45017863" Original-Received: from 76-10-140-163.dsl.teksavvy.com (HELO pastel.home) ([76.10.140.163]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 15 Jan 2014 11:24:49 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 25E7C6048B; Wed, 15 Jan 2014 11:24:49 -0500 (EST) In-Reply-To: <0E94BE5F9874463D9B4C2A039A3C24E9@gmail.com> (Bozhidar Batsov's message of "Wed, 15 Jan 2014 16:41:33 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:168466 Archived-At: > Ruby 2.1 has made it possible to define private/protected/public > methods on a per method basis (because a `def` now returns a symbol > instead of nil). It means that now it=E2=80=99s possible to write code li= ke > this: > private def map(attribute, to:) > @rules[attribute] =3D to > end > We currently don=E2=80=99t support such an indentation scheme, as `def` is > always aligned with `end`: > private def map(attribute, to:) > @rules[attribute] =3D to > end I presume you meant private def map(attribute, to:) @rules[attribute] =3D to end > I=E2=80=99m not saying the first alignment is preferable, That's surprising. The current alignment just looks like a plain bug to me and can't think of any reason why someone would prefer it over private def map(attribute, to:) @rules[attribute] =3D to end Of course, I don't know Ruby very well, so maybe this just shows my ignoran= ce. In any case, what I wanted to say here, is that in my experience, the easiest way to handle such things with SMIE is to make the token code treat "private def" as a single token (and to call it "def"). This may sound silly, but trying to DTRT (for similar issues in other modes) by tweaking grammar plus indentation rules has proved a lot more painful. Stefan