Create
Learn
Share

el4r

rename
Updated 2007-06-05 10:41

Summary

The el4r emacs package lets you run ruby in emacs (with access to the emacs API).

Basics

Question Answer
el4r is short for...elisp 4 ruby
el4r analogue of .emacs~/.el4r/init.rb
insert text into bufferinsert "foo"
creator of el4rrubikitch
method to eval elisp from rubyel4r_lisp_eval
map key to some ruby codedefine_key :global_map, "\C-z" do ... end
memorize

Translating from elisp

in elispin ruby
(next-line 1)next_line 1
(insert "foo")insert "foo"
(replace-regexp "\\w+" "xx")replace_regexp /\w+/, "xx"
(setq x "foo")elvar.x = "foo"
(save-excursion ... )with(:save_excursion) do ... end
(defun foo () (interactive) ... )defun(:foo, :interactive => "") do ... end
memorize

Namespaces

Question Answer
can ruby transparently call elisp functions?yes
can ruby transparently access elisp vars?no (use elvar.)
can elisp transparently call ruby methods?no (use el4r-ruby-eval)
can elisp transparently access ruby vars?no (use el4r-ruby-eval)
memorize