From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.help Subject: Re: Ruby and RubyOn Rails setup - Cannot enable indentation and snippets Date: Wed, 02 Jan 2013 18:52:03 +0400 Message-ID: <87pq1neiy4.fsf@yandex.ru> References: <558f5257-18a8-46c4-8a41-71ea6066449e@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1357138356 6928 80.91.229.3 (2 Jan 2013 14:52:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Jan 2013 14:52:36 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Sayth Renshaw Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 02 15:52:52 2013 Return-path: Envelope-to: geh-help-gnu-emacs@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 1TqPgX-0000Cd-8r for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Jan 2013 15:52:49 +0100 Original-Received: from localhost ([::1]:59856 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqPgI-00018n-99 for geh-help-gnu-emacs@m.gmane.org; Wed, 02 Jan 2013 09:52:34 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:38593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqPg5-00016m-5p for help-gnu-emacs@gnu.org; Wed, 02 Jan 2013 09:52:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqPfs-0007rI-JE for help-gnu-emacs@gnu.org; Wed, 02 Jan 2013 09:52:21 -0500 Original-Received: from mail-la0-f49.google.com ([209.85.215.49]:60703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqPfs-0007r2-7N for help-gnu-emacs@gnu.org; Wed, 02 Jan 2013 09:52:08 -0500 Original-Received: by mail-la0-f49.google.com with SMTP id fk20so6038455lab.8 for ; Wed, 02 Jan 2013 06:52:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=Wz76gvaOP4svfdkVQ2BMd49CYhm69A/rEfJZo2f51ag=; b=y6GYRXw+89q7XqvQ2EuWgpx6zmr7cve0Z6fB0SeIhNVqajve/vHov2L0dcQ+nRpCxH kcJe9URdXprq5uWLLGzrrEAqhfV5ZG7OxpwRtFhPWgfAzbMUHxXEGvPsB+f4JXt83HVA QLbUCHkLdOMqMDu1KLtvteulMNrLFBJI8H9PGygN/DvmEGfL94I2lF+Z5K5/vcEsWPF6 RDScjiv9SmTEkjHXO6YyxWHpjKcOyiQeCabKQzsK/Abgnug+m8eqQ+QRXi16MEkETfoL yYKMkq6MZf62OnMaZ3DJzyFa0vV7qZmCPJM4OqAvGH147iD/T5YtXuGi9a40VncHDh/9 yoiw== X-Received: by 10.112.87.104 with SMTP id w8mr19118819lbz.49.1357138326355; Wed, 02 Jan 2013 06:52:06 -0800 (PST) Original-Received: from SOL ([178.252.98.87]) by mx.google.com with ESMTPS id fe4sm16144473lbb.1.2013.01.02.06.52.03 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 Jan 2013 06:52:04 -0800 (PST) In-Reply-To: (Sayth Renshaw's message of "Wed, 2 Jan 2013 05:24:41 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.215.49 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88393 Archived-At: Sayth Renshaw 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.