Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running irb in emacs (via run-ruby) echos everything I type

Tags:

emacs

ruby

I'm running Windows Vista and Emacs 23.1.1 and I have installed Ruby using the "One Click Ruby Installer". I then installed the Emacs Lisp files that were installed with Ruby as specified in inf-ruby.el.

When I run the run-ruby (M-x run-ruby) function, irb starts but every time I press Enter, irb prints out the line I just typed. For example:

irb(main):001:0> def foo()
def foo()
                   3 + 4
3 + 4
                 end
end
nil

This is annoying. If I just run irb in a cygwin command shell, no echoing is performed. For example:

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

How do I turn off the echoing in Emacs? Thanks!

like image 394
Tim Stewart Avatar asked Jan 24 '23 07:01

Tim Stewart


2 Answers

The inferior Ruby mode is built on top of comint-mode.

I noticed that there was a comint variable named comint-process-echoes.

I set this variable to t (true) and the echoing stopped.

Here's how I set the variable:

;;; 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)
like image 128
Tim Stewart Avatar answered Jan 30 '23 23:01

Tim Stewart


should be this:

(defun echo-false () (setq comint-process-echoes t))

(add-hook 'comint-mode-hook 'echo-false)

like image 36
Little Jack Avatar answered Jan 30 '23 23:01

Little Jack