GNU bug report logs - #15594
24.3; Indentation of method arguments without parentheses in ruby-mode is broken

Previous Next

Package: emacs;

Reported by: Bozhidar Batsov <bozhidar.batsov <at> gmail.com>

Date: Sat, 12 Oct 2013 06:26:02 UTC

Severity: normal

Found in version 24.3

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15594 <at> debbugs.gnu.org
Subject: bug#15594: trunk r114639: * lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Add rule for paren-free
Date: Mon, 21 Oct 2013 10:02:38 +0400
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.




This bug report was last modified 11 years and 208 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.