help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ruby and RubyOn Rails setup - Cannot enable indentation and snippets


From: Dmitry Gutov
Subject: Re: Ruby and RubyOn Rails setup - Cannot enable indentation and snippets
Date: Wed, 02 Jan 2013 18:52:03 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt)

Sayth Renshaw <flebber.crue@gmail.com> writes:

>> Please open an .rb file in Emacs, evaluate (M-:) the following 
>> expressions and send the values returned (for long values, you can look 
>> in the *Messages* buffer, or use esk-eval-and-replace from 
>> emacs-starter-kit): 
>
>> major-mode 
>> indent-line-function 
>> (find-library-name "ruby-mode") 
>> emacs-version
>
> The first 3 returned no match and provided no output.

I think you were pressing `M-x', instead of `M-:' (which should be the
same as `M-S-;' on most keyboards). Alternatively, you can try putting the
cursor at the end of each line above and pressing `C-x C-e'.

So, please try again.

> GNU Emacs 24.2.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.6.1) of 2012-11-17 
> on buildvm-13.phx2.fedoraproject.org

Looks good, Emacs 24.2 should handle your example just fine.

>> I have tried several variations all done by hand by myself, emacs-starter-kit
>> with ruby loaded, prelude emacs(indents end keyword correctly but does not
>> indent the block) with ruby loaded and cannot get proper indentation, 
>> snippets
>> and/or autocompletion. I can get some bits in the installs but it is not
>> ideal.
>
>>> That sounds positively broken.
>
> Should clarify I tried them individually not all at once. When one failed I
> zipped the .emacs and emacs.d up and started fresh. I have nothing other than 
> my
> file currently.

No, I meant your description of how indentation doesn't work. 

If I were troubleshooting it myself, I'd first start with zero
configuration, verify that indentation works okay (it very well should),
and then add new pieces one by one, watching for the one that breaks it.

By the way, does starting fresh mean that you also removed all installed
ELPA packages? There's an outdated ruby-mode package on Marmalade, which
has been reported to cause some troubles with indentation. But not to
the degree you're describing, though.

>> (require 'yasnippet-bundle) 
>
>> try to install yasnippet from git 
>> (https://github.com/capitaomorte/yasnippet/), or from Melpa, 
>> mentioned in the README there. 
>
> I used marmalade and elpa is that ok?

Hmm, if you're using GNU ELPA (the default package repository in Emacs
24), you should be fine. I just noticed it has the updated version (0.8).

But you'll need to install `yasnippet', not `yasnippet-bundle', and
update the configuration (replace "/" with "-", for example).

>> (setq ruby-indent-level 4) 
>
>>> The example at the beginning of your email has a 2-space indentation. 
>>> Why are you setting this to 4?
>
> just experimenting to try and get some indenting to work.

No need to change the default value, which is 2.

>> rhtml-mode is also irrelevant.
>
> I thought it was the better option of nxhtml and mumamo on linux.

I mean it doesn't do anything for pure Ruby files.

I'm not sure it's better, but it's definitely simpler than the other
packages you mentioned.

I have written a `mmm-mode' based package which works better for me than
any of the above, but it's more complicated to set up, a bit slower, and
it requires you to install `mmm-mode' from Melpa.

And see additional instructions in the commentary:

https://github.com/purcell/mmm-mode/blob/master/mmm-erb.el

Again, this is just for template files.

>> I'd like know what gave you the impression that installing 
>> rails-reloaded is a good idea. Here's a recent user complaint:
>
> Read this article from Nov 2011
> http://tuxdna.wordpress.com/2011/11/12/turbocharge-your-emacs-for-ruby-on-rails-with-rinari-and-rails-reloaded/

Thanks, I'll leave a warning comment there.

But the article is more than a year old now, so we can assume that the
author was using Emacs 23 (24.1 was released in June 2012).

Anyway, I hate those kind of articles: describing how to setup, but now
why, or how it will work. The rinari screencast linked there is also
quite old, though less outdated.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]