Note that there are some explanatory texts on larger screens.

plurals
  1. POEmacs Ruby Electric Does Not Insert End
    primarykey
    data
    text
    <p>I have Ruby Electric mode installed via ELPA.</p> <p>I have visited a ruby file <code>~/test.rb</code></p> <p><code>C-h m</code> reveals that ruby electric mode is enabled as is font lock, see output below</p> <pre><code>Enabled minor modes: Auto-Compression Auto-Encryption Blink-Cursor Column-Number Delete-Selection File-Name-Shadow Global-Font-Lock Global-Linum Iswitchb Line-Number Menu-Bar Mouse-Wheel Shell-Dirtrack Tooltip Transient-Mark </code></pre> <p>However when I enter code like;</p> <pre><code>class Test def foo() </code></pre> <p>I don't get any <code>end</code> auto inserted on hitting <code>RET</code></p> <p><strong>UPDATE</strong></p> <p>I installed via <code>package-list</code> as that was recommended on the page I found, which I thought belonged to the author. Looking at the source of <code>~/emacs.d/elpa/ruby-electric-1.1/ruby-electric.el</code> I see the following;</p> <pre><code>;; FIXME: it should be available in next versions of ruby-mode.el (defun ruby-insert-end () (interactive) (insert "end") (ruby-indent-line t) (end-of-line)) </code></pre> <p>So it looks like I might have a bad file, will try another.</p> <p><strong>UPDATE</strong></p> <p>I used <code>ruby-electric.el</code> downloaded from <a href="http://svn.ruby-lang.org/repos/ruby/tags/v1_9_2_0/misc/ruby-electric.el" rel="noreferrer">http://svn.ruby-lang.org/repos/ruby/tags/v1_9_2_0/misc/ruby-electric.el</a></p> <p>Linked to from this article <a href="http://appsintheopen.com/articles/1-setting-up-emacs-for-rails-development/part/7-emacs-ruby-foo" rel="noreferrer">http://appsintheopen.com/articles/1-setting-up-emacs-for-rails-development/part/7-emacs-ruby-foo</a></p> <p>Then took this gist <a href="https://gist.github.com/1213051" rel="noreferrer">https://gist.github.com/1213051</a> adding this to <code>ruby-electric.el</code></p> <pre><code>(defun ruby-insert-end () "Insert \"end\" at point and reindent current line." (interactive) (insert "end") (ruby-indent-line t) (end-of-line)) </code></pre> <p>And this hook into my <code>.emacs</code>, it also appears to work without the hook</p> <pre><code>(add-hook 'ruby-mode-hook (lambda () (require 'ruby-electric) (ruby-electric-mode t))) </code></pre> <p>As discussed in this google groups thread; <a href="https://groups.google.com/forum/?fromgroups#!msg/emacs-on-rails/Cuh_x5eCK_M/KDwjY4K6X1YJ" rel="noreferrer">https://groups.google.com/forum/?fromgroups#!msg/emacs-on-rails/Cuh_x5eCK_M/KDwjY4K6X1YJ</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload