syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.64k stars 4.89k forks source link

ruby layer freeze on Windows #1584

Closed Vodurden closed 8 years ago

Vodurden commented 9 years ago

Using inf-ruby or robe-mode on Windows causes an immediate freeze. This occurs using both NTEmacs and MinGW emacs running under MSYS2 installed with pacman -S emacs.

Emacs Version: 24.5 (both) Ruby Version: ruby 2.1.6p336 (2015-04-13 revision 50298) [i386-mingw32]. Windows version installed from the Ruby website. Also has DevKit installed.

Steps to reproduce:

Using toggle-debug-on-quit and pressing C-g after freezing produces the following trace:

Debugger entered--Lisp error: (quit)
  accept-process-output(#<process pry>)
  comint-send-input()
  call-interactively(comint-send-input nil nil)
  command-execute(comint-send-input)

Using pry from cmd.exe works fine:

cmd.exe:
pry
[1] pry(main)> puts "Hi"
Hi
=> nil

It also works fine from MSYS2's MinGW console:

C:\msys64\usr\bin\sh.exe -c 'MSYSTEM=MINGW64 exec /bin/sh --login -i':
pry
[1] pry(main)> puts "Hi"
Hi
=> nil

It also works fine when testing in a project

cd /c/Code/MyProject
bundle exec pry
[1] pry(main)> puts "Hi"
Hi
=> nil

I'm not sure if this is spacemacs specific or if this issue would be better placed on inf-ruby but I decided to come here first since spacemacs is what I'm using. I'm happy to move the issue if it makes more sense on another repository.

jclosure commented 8 years ago

This looks like a bug with inf-ruby. https://github.com/nonsequitur/inf-ruby/blob/master/inf-ruby.el. I'm having same behavior in MinGW with emacs 24.5, without spacemacs.

jclosure commented 8 years ago

This looks like a bug with inf-ruby. https://github.com/nonsequitur/inf-ruby/blob/master/inf-ruby.el. I'm having same behavior with emacs 24.5, without spacemacs

M-x inf-ruby

pry> puts "Hello"

Freeze:

Debugger entered--Lisp error: (quit) accept-process-output(#) comint-send-input()

(comint-send-input nil nil)

ad-Advice-call-interactively(# comint-send-input nil nil) apply(ad-Advice-call-interactively # (comint-send-input nil nil)) call-interactively(comint-send-input nil nil) command-execute(comint-send-input)

StreakyCobra commented 8 years ago

@jclosure @Vodurden Do you managed to resolve this issue? Is it still happening with the last spacemacs release?

jclosure commented 8 years ago

I had the same issue with Pry in windows. Turns out, it's an issue with readline. Here's my ~/.pryrc that fixes the issue:

works around issues with emacs + pry

note that you need to install the pry-byebug and awesome_print gems for this to work

class Emacsable def self.readline(prompt) print prompt (gets || '').chomp end end Pry.config.input = Emacsable

Pry.config.pager = false if ENV["INSIDE_EMACS"] Pry.config.correct_indent = false if ENV["INSIDE_EMACS"] Pry.config.print = proc { |output, value| output.puts "=> #{value.inspect}" } Pry.config.exceptionhandler = proc do |output, exception, | output.puts "#{exception.class}: #{exception.message}" output.puts "from #{exception.backtrace.first}" end

note awesome_print should be installed for nice printing

require "awesome_print" AwesomePrint.pry!

StreakyCobra commented 8 years ago

@jclosure Thanks for sharing!

@Vodurden Does this method work in your case?

Vodurden commented 8 years ago

@StreakyCobra I'm no longer using emacs on windows so I'm unfortunately unable to test.

StreakyCobra commented 8 years ago

Ok, thanks for your response! A workaround have been proposed and nobody else seems to have this problem anymore, I'm closing this issue then.

If anybody encounters this bug again, let us know by opening a new issue, or posting a message here (I'll reopen it if it's the case) :relaxed: