unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Bozhidar Batsov <bozhidar@batsov.com>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: [ruby-mode] Private/protected method definition layout in Ruby 2.1
Date: Wed, 15 Jan 2014 20:18:19 +0200	[thread overview]
Message-ID: <87lhyh2jo4.fsf@yandex.ru> (raw)
In-Reply-To: <jwvr489xlpo.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 15 Jan 2014 11:24:49 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I’m 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

I also think it looks like a bug, but it's just indentation of an
arguments in a paren-less function call. `private' is a method, called
with the expression `def ... end`.

That said, I think indenting it to the beginning of `private' would be
preferable, as it's consistent with Vim and examples on the Web.

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

I believe we can also handle this in the rules-function. Add a new rule
for (:before . "def"), see if the preceding token is one of `private',
`public', `protected', and if so, indent to its beginning column.

Can we install such a change, with either of the approaches, during the
feature freeze?



  reply	other threads:[~2014-01-15 18:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 14:41 [ruby-mode] Private/protected method definition layout in Ruby 2.1 Bozhidar Batsov
2014-01-15 16:24 ` Stefan Monnier
2014-01-15 18:18   ` Dmitry Gutov [this message]
2014-01-15 18:51     ` Stefan Monnier
2014-01-16  5:47 ` Dmitry Gutov
2014-01-16 10:15   ` Bozhidar Batsov
2014-01-16 13:37     ` Dmitry Gutov
2014-01-16 14:26       ` Bozhidar Batsov
2014-01-16 18:40         ` Dmitry Gutov
2014-01-16 19:38           ` Bozhidar Batsov
2014-01-17  3:17             ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lhyh2jo4.fsf@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=bozhidar@batsov.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).