run ruby from emacs buffer

前端 未结 2 524
独厮守ぢ
独厮守ぢ 2021-02-08 12:13

How can I run a ruby piece of code from a buffer, without actually saving the buffer in a file? A scenario would be to a) switch to the scratch buffer b) M-x ruby-mode c) type

2条回答
  •  耶瑟儿~
    2021-02-08 12:29

    You can do this with inf-ruby.el.

    With inf-ruby installed, M-x inf-ruby starts a new ruby interpreter in the background, to which you can send code using the ruby-send-* commands, such as ruby-send-region (bound by default to C-c C-r). To send the whole buffer, select all with C-x h then hit C-c C-r.

    Update, 2011-09-02: The latest version of inf-ruby.el (2.1.1, available in ELPA) is that maintained by 'nonsequitur' on github, and snapshot packages are available in Melpa.

提交回复
热议问题