在emacs中运行irb(通过运行ruby)与我键入的所有内容相呼应

在emacs中运行irb(通过运行ruby)与我键入的所有内容相呼应,ruby,emacs,Ruby,Emacs,我运行的是WindowsVista和Emacs23.1.1,我使用“一键式Ruby安装程序”安装了Ruby。然后,我按照inf-Ruby.el中的指定安装了与Ruby一起安装的Emacs Lisp文件 当我运行runruby(M-x runruby)函数时,irb启动,但每次我按Enter键时,irb都会打印出我刚才键入的行。例如: irb(main):001:0> def foo() def foo() 3 + 4 3 + 4

我运行的是WindowsVista和Emacs23.1.1,我使用“一键式Ruby安装程序”安装了Ruby。然后,我按照inf-Ruby.el中的指定安装了与Ruby一起安装的Emacs Lisp文件

当我运行runruby(M-x runruby)函数时,irb启动,但每次我按Enter键时,irb都会打印出我刚才键入的行。例如:

irb(main):001:0> def foo()
def foo()
                   3 + 4
3 + 4
                 end
end
nil
$ irb.bat --inf-ruby-mode
irb(main):001:0> def foo()
                   3 + 4
                   end
nil
这很烦人。如果我只是在cygwin命令shell中运行irb,则不会执行任何回显。例如:

irb(main):001:0> def foo()
def foo()
                   3 + 4
3 + 4
                 end
end
nil
$ irb.bat --inf-ruby-mode
irb(main):001:0> def foo()
                   3 + 4
                   end
nil

如何关闭Emacs中的回声?谢谢

低级Ruby模式建立在comint模式之上

我注意到有一个名为comint process Echoses的comint变量

我将这个变量设置为t(true),回声停止

下面是我如何设置变量的:

;;; Define Ruby Mode Hook
(defun my-ruby-mode-hook ()
  (progn
    (setq comint-process-echoes t)
    (turn-on-font-lock)
    (auto-fill-mode)
    (yas/minor-mode)
    (inf-ruby-keys)))

;;; Register Ruby Mode Hook
(add-hook 'ruby-mode-hook 'my-ruby-mode-hook)
应该是这样的:

(defun echo false() (setq comint过程回声t))

(添加钩子'comint mode钩子'echo false)


仅供参考,您不需要程序。我不认为答案需要所有不相关的定制,而不是解决OP问题(如YASnippet等)