pezra / rspec-mode

An RSpec minor mode for Emacs
256 stars 112 forks source link

binding.pry doesn't work #86

Closed joshrendek closed 10 years ago

joshrendek commented 10 years ago

I get this when inserting a binding.pry:

[0GWARNING: terminal is not fully functional
-  (press RETURN)
dgutov commented 10 years ago

Try putting this into your init file:

(setenv "PAGER" (executable-find "cat"))

Also see #45.

jhirn commented 10 years ago

I set the pager env and it did print out the prompt for pry, but I was unable to type or do anything interactive in the buffer. I didn't see anything in #45 that jumped out on how to help make the buffer interactive, but that could just be my lack of understanding.

Very interested to make this work. Willing to make a PR if you could explain exactly what needs to be done.

dgutov commented 10 years ago

I didn't see anything in #45 that jumped out on how to help make the buffer interactive, but that could just be my lack of understanding.

  • Install inf-ruby.
  • Put (add-hook 'after-init-hook 'inf-ruby-switch-setup) into your init file.
  • When you see the Pry prompt, press C-x C-q to switch the mode.
jhirn commented 10 years ago

Nice. I was just coming back to comment that all I needed to do was hit C-x C-q to switch read-only off =)

It's slightly annoying that I have to type this before every command. Do you know of a way to either keep read-only disabled or automatically disable it once the returning to the prompt? Or is that nonstandard usage of comint mode?

dgutov commented 10 years ago

all I needed to do was hit C-x C-q to switch read-only off =)

You're not really switching read-only. With the added binding, you're switching to inf-ruby-mode.

Do you know of a way to either keep read-only disabled or automatically disable it once the returning to the prompt? Or is that nonstandard usage of comint mode?

There may be different ways, but as soon as we switch to inf-ruby-mode, we lose the highlighting of RSpec compilation errors (until we switch back). That's a definite drawback.

It might be worth exploring whether running compilation in a mode deriving from inf-ruby-mode can be not less performant, would also highlight errors, etc. inf-ruby-mode also enables compilation-shell-minor-mode, which should provide most or all of the related features, so it should be mostly a matter of porting new font-lock rules and error regexp settings.

The default compile command also has the option of running in comint-mode (when called with prefix). I'm not sure, though, why the separation even exists.