问题描述
我尝试使用el4r,这是一种。
I tried to instll el4r, which is kind of a EmacsRuby.
我基本上安装了所有内容作为描述
I basically installed everything as descibed here
我的设置
我使用emacs 24从Ubuntu 12.10和rbenv默认提供的默认ruby版本是ruby 1.9.3p286(2012-10-12修订版37165)[x86_64-linux]
I use emacs 24 as provided by default from Ubuntu 12.10 with rbenv and my default ruby version is ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]
虽然我测试了所有我有一个简约的.emacs文件,其中包含以下文本
While I tested everything I had a minimalistic .emacs file containing the following text
;; Source: http://marc-bowes.com/2012/03/10/rbenv-with-emacs.html
;; Setting rbenv path
(setenv "PATH" (concat (getenv "HOME") "/.rbenv/shims:"
(getenv "HOME") "/.rbenv/bin:"
(getenv "PATH")))
(setq exec-path (cons (concat (getenv "HOME") "/.rbenv/shims")
(cons (concat (getenv "HOME") "/.rbenv/bin")
exec-path)))
;; Beginning of the el4r block:
;; RCtool generated this block automatically. DO NOT MODIFY this block!
(add-to-list 'load-path "/home/mars/.rbenv/versions/1.9.3-p286/share/emacs/site-lisp")
(require 'el4r)
(el4r-boot)
;; End of the el4r block.
;; User-setting area is below this line.
当我使用--debug-init启动emacs时,会收到以下错误:
When I start emacs with --debug-init I get the following errors:
Debugger entered--Lisp error: (el4r-ruby-error)
signal(el4r-ruby-error nil)
(condition-case err (eval (setq expr (read result))) (el4r-ruby-error (signal (quote el4r-ruby-error) nil)) (error (setq el4r-error-lisp-expression expr) (signal (car err) (cdr err))))
(let ((result (el4r-recv)) expr) (while (eq (length result) 0) (el4r-wait-expr) (setq result (el4r-recv))) (condition-case err (eval (setq expr (read result))) (el4r-ruby-error (signal (quote el4r-ruby-error) nil)) (error (setq el4r-error-lisp-expression expr) (signal (car err) (cdr err)))))
el4r-get()
(let ((result (el4r-get))) (el4r-leave-call) result)
el4r-ruby-eval("el4r_boot")
el4r-boot()
eval-buffer(#<buffer *load*> nil "/home/mars/.emacs" nil t) ; Reading at buffer position 567
load-with-code-conversion("/home/mars/.emacs" "/home/mars/.emacs" t t)
load("~/.emacs" t t)
#[0 "\205\262
日志文件/ tmp / el4r-mars.13757.log看起来像这样:
The log file /tmp/el4r-mars.13757.log looks like this:
2012-11-09 18:00:58 +0100:Starting, waiting for expression.
2012-11-09 18:00:58 +0100:Error: cannot load such file -- test/unit/ui/console/testrunner (LoadError)
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:846:in `instance_eval'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:491:in `require'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:889:in `el4r_install_test_unit_testrunner'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:882:in `el4r_install_unittest_stuff'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:877:in `el4r_install_builtin_functions'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:723:in `el4r_boot__noinit'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:735:in `el4r_boot'
from (eval):1:in `el4r_ruby_eval'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:846:in `instance_eval'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:846:in `el4r_ruby_eval'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:791:in `el4r_get'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:768:in `block in el4r_wait_expr'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:835:in `el4r_with_call'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:765:in `el4r_wait_expr'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:760:in `el4r_wait_expr_loop'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:1094:in `<main>'
2012-11-09 18:01:03 +0100:wrong number of arguments (1 for 0) (ArgumentError)
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:1084:in `block in <main>'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:760:in `call'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:760:in `eof?'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:760:in `el4r_wait_expr_loop'
from /home/mars/.rbenv/versions/1.9.3-p286/bin/el4r-instance:1094:in `<main>'
2012-11-09 18:01:03 +0100:Exiting.
我不明白问题,我如何解决它。 ,但是针对的是xiki。仍然我尝试了没有成功的答案。
I do not understand the problem and how I can fix it. Here is similar question but it is directed at xiki. Still I tried the answers with no success.
推荐答案
我的工作正常。
基本上@Tass是对的。原来的el4r项目似乎已经死了,但是有更新的叉似乎工作了。这是非常令人困惑的,因为文档真的很奇怪。新项目安装例程使用旧的脚本,但您无法完全遵循。
Basically @Tass is right. The original el4r project seems to be dead, but there are newer forks that seem to work. It is very confusing because the documentation is really weird. The new projects install routines use the old scripts but you cannot follow them exactly.
安装
这是您必须遵循的步骤才能使其正常工作。
Here are the steps you have to follow to get it to work.
# Install http://rubygems.org/gems/trogdoro-el4r, but do not follow instructions on page
# Do not download the original el4r sources and files.
gem install trogdoro-el4r
# Go to the gem directory. For me it is:
cd /home/mars/.rbenv/versions/1.9.3-p286/lib/ruby/gems/1.9.1/gems/trogdoro-el4r-1.0.7
# Run the "original" setup commands
ruby setup.rb
cd bin
ruby -S el4r-rctool -p
ruby -S el4r-rctool -i
# Add `el4r_load "el4r-mode.rb"` to ~/.el4r/init.rb or execute this command
echo 'el4r_load "el4r-mode.rb"' >> ~/.el4r/init.rb
# Fix your .emacs.el or .emacs.d by adding the code from the newly generated ~/.emacs file
# Use the ruby you have installed the gem with. In my case rbenv ruby 1.9.3-p286
# You need to re-install el4r if you change your ruby version
配置
对于rbenv,您必须从问题添加片段:
For rbenv you have to add snippet from the question:
;; Source: http://marc-bowes.com/2012/03/10/rbenv-with-emacs.html
;; Setting rbenv path
(setenv "PATH" (concat (getenv "HOME") "/.rbenv/shims:"
(getenv "HOME") "/.rbenv/bin:"
(getenv "PATH")))
(setq exec-path (cons (concat (getenv "HOME") "/.rbenv/shims")
(cons (concat (getenv "HOME") "/.rbenv/bin")
exec-path)))
;; Beginning of the el4r block:
;; RCtool generated this block automatically. DO NOT MODIFY this block!
(add-to-list 'load-path "/home/mars/.rbenv/versions/1.9.3-p286/share/emacs/site-lisp")
(require 'el4r)
(el4r-boot)
;; End of the el4r block.
;; User-setting area is below this line.
测试一切是否正常
将以下行添加到〜/ el4r / init.rb文件
Add the following lines to your ~/el4r/init.rb file
defun(:stackoverflow_ruby_func) { |a|
insert_string("It works!: '#{a}'"); newline
}
启动emacs并转到您的 scratch 缓冲区。
Start emacs and to to your scratch buffer.
插入(stackoverflow-ruby-func 42)
并进行评估。你的缓冲区应该是这样的:
Insert (stackoverflow-ruby-func 42)
and evaluate. Your buffer should look something like this:
(stackoverflow-ruby-func 42)It works!: '42'
更多信息位于doc目录下的doc /和test /.
More information is in the gem directory under doc/ and test/.
这篇关于如何在emacs 24中安装el4r?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!