Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code to deal with sending large regions to the inferior process. #21

Closed
wants to merge 2 commits into from

Conversation

kalifg
Copy link

@kalifg kalifg commented May 10, 2013

There is a long standing problem in emacs with sending large strings via comint.
See (http://stackoverflow.com/questions/5541622/comint-mode-inserts-line-break-every-4096-characters)
for some reference. This can cause a problem if for instance you have a
variable value being initialied to a large string. You will receive an error
like :

irb(main):122:0>
SyntaxError: /home/mdwyer/Desktop/CarTalk/download.rb:6: unterminated string meets end of file
from (irb):122:in eval' from (irb):122 from /usr/bin/irb:12:in

'

This patch adds code to ruby-send-region that pages the input to be sent every
comint-max-input-size characters. Each page is terminated with a newline
which works around the comint bug. The newline is swallowed by comint, so no
extraneous newlines are sent to the inferior process.

There is a long standing problem in emacs with sending large strings via comint.
See (http://stackoverflow.com/questions/5541622/comint-mode-inserts-line-break-every-4096-characters)
for some reference.  This can cause a problem if for instance you have a
variable value being initialied to a large string.  You will receive an error
like :

> irb(main):122:0>
> SyntaxError: /home/mdwyer/Desktop/CarTalk/download.rb:6: unterminated string meets end of file
> 	from (irb):122:in `eval'
>	from (irb):122
>	from /usr/bin/irb:12:in `<main>'

This patch adds code to `ruby-send-region` that pages the input to be sent every
`comint-max-input-size` characters.  Each page is terminated with a newline
which works around the comint bug.  The newline is swallowed by comint, so no
extraneous newlines are sent to the inferior process.
There is a long standing problem in emacs with sending large strings via comint.
See (http://stackoverflow.com/questions/5541622/comint-mode-inserts-line-break-every-4096-characters)
for some reference.  This can cause a problem if for instance you have a
variable value being initialied to a large string.  You will receive an error
like :

> irb(main):122:0>
> SyntaxError: /home/mdwyer/Desktop/CarTalk/download.rb:6: unterminated string meets end of file
> 	from (irb):122:in \`eval'
>	from (irb):122
>	from /usr/bin/irb:12:in \`<main>'

This patch adds code to `ruby-send-region` that pages the input to be sent every
`comint-max-input-size` characters.  Each page is terminated with
`comint-send-eof`, which works around the comint bug.
@nonsequitur
Copy link
Owner

Please excuse my late response.

I'm getting a
SyntaxError: (irb):20: can't find string "--inf-ruby-ad2ea72-20896-42840-633000--" anywhere before EOF
for both Ruby 1.9.3 and 1.8.7 when sending this test file with your patched ruby-send-region.

On which OS/Ruby platform did you test the patch?

(For me: Ubuntu 12.04, Emacs 24.3.1)

@kalifg
Copy link
Author

kalifg commented May 25, 2013

No problem! I was on Ubuntu 13.04, default ruby (I think 1.9.1). I don't have access to that machine at the moment, but I will try your test file and get you better info add soon add I can!

@dgutov dgutov closed this Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants