Hi,
maybe I found a fix for that issue (at least my test script now runs :) ):
The new R.tmbundle stuff I host at https://github.com/avian/r.tmbundle/ thus here the code which should be tested.
Please replace everything in between
STDOUT.sync = true {... and ...} STDOUT.flush
in file tmR.rb by:
STDOUT.sync = false STDERR.sync = false
descriptors = [stdout, stderr] descriptors.each { |fd| fd.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) } until descriptors.empty? select(descriptors).shift.each do |io| begin str = io.readline rescue descriptors.delete io io.close break end if str.nil? or str.empty? descriptors.delete io io.close elsif io == stderr # just in case print hideStartMessageJS print %{<span style="color: red">#{esc str}</span>} elsif io == stdout print hideStartMessageJS str.each_line do |line| # line counter for top level source if line.include?("#{linecountermarker}") linecounter += 1 line.sub!("#{linecountermarker}", '') end # check for a comment sign at the beginning of a line if line.match(/>\s*#/) print "<i><font color=blue>#{esc line.chomp}</font></i>\n" # check for a comment within a line - regexp should be improved yet! elsif m=line.match(/(.*?)(#[^"']*)$/) print esc(m[1]).gsub(/^(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') print "<i><font color=blue>#{esc(m[2]).chomp}</font></i>\n" # check for error messages elsif m=line.match(/(?i)^\s*(error|erreur|fehler|errore|erro)( |:)/) where = (isSelection) ? " of selection" : "" print "<span style='color: red'>#{esc str.gsub(%r{(?m).*?#{m[1]}},m[1]).chomp}<br /><i>RMate</i> stopped at <a href='txmt://open?line=#{linecounter}'>line #{linecounter-selectionlinestart}#{where}</a></span><br />".gsub(%r{source("(.*?)")},'source("<a href="txmt://open?url=file://\1">\1</a>")') print "<hr noshade width='300' size='2' align='left' color=lightgrey>" break # check for warnings elsif line.match(/^\s*(Warning|Warning messages?|Message d.avis|Warnmeldung|Messaggio di avvertimento|Mensagem de aviso):/) print "<span style='color: gray'>#{esc line}</span>" # print line simply with hyperlinked prompt if given elsif line.match(/_\x8./) print "#{line.gsub(/_\x8(.)/,'<b>\1</b>')}" else print esc(line).gsub(/^[\x0-\x9]?(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') end end end end end
STDOUT.flush
Feedback is welcome :)
Cheers, --Hans
On 04-02-2012, at 18:16, Hans-Jörg Bibiko wrote:
Hi,
maybe I found a fix for that issue (at least my test script now runs :) ):
The new R.tmbundle stuff I host at https://github.com/avian/r.tmbundle/ thus here the code which should be tested.
Please replace everything in between
STDOUT.sync = true {... and ...} STDOUT.flush
in file tmR.rb by:
STDOUT.sync = false STDERR.sync = false
descriptors = [stdout, stderr] descriptors.each { |fd| fd.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) } until descriptors.empty? select(descriptors).shift.each do |io| begin str = io.readline rescue descriptors.delete io io.close break end if str.nil? or str.empty? descriptors.delete io io.close elsif io == stderr # just in case print hideStartMessageJS print %{<span style="color: red">#{esc str}</span>} elsif io == stdout print hideStartMessageJS str.each_line do |line| # line counter for top level source if line.include?("#{linecountermarker}") linecounter += 1 line.sub!("#{linecountermarker}", '') end # check for a comment sign at the beginning of a line if line.match(/>\s*#/) print "<i><font color=blue>#{esc line.chomp}</font></i>\n" # check for a comment within a line - regexp should be improved yet! elsif m=line.match(/(.*?)(#[^"']*)$/) print esc(m[1]).gsub(/^(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') print "<i><font color=blue>#{esc(m[2]).chomp}</font></i>\n" # check for error messages elsif m=line.match(/(?i)^\s*(error|erreur|fehler|errore|erro)( |:)/) where = (isSelection) ? " of selection" : "" print "<span style='color: red'>#{esc str.gsub(%r{(?m).*?#{m[1]}},m[1]).chomp}<br /><i>RMate</i> stopped at <a href='txmt://open?line=#{linecounter}'>line #{linecounter-selectionlinestart}#{where}</a></span><br />".gsub(%r{source("(.*?)")},'source("<a href="txmt://open?url=file://\1">\1</a>")') print "<hr noshade width='300' size='2' align='left' color=lightgrey>" break # check for warnings elsif line.match(/^\s*(Warning|Warning messages?|Message d.avis|Warnmeldung|Messaggio di avvertimento|Mensagem de aviso):/) print "<span style='color: gray'>#{esc line}</span>" # print line simply with hyperlinked prompt if given elsif line.match(/_\x8./) print "#{line.gsub(/_\x8(.)/,'<b>\1</b>')}" else print esc(line).gsub(/^[\x0-\x9]?(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') end end end end end
STDOUT.flush
Feedback is welcome :)
I have been running quite a lot of scripts to see what happens now. No error messages have been issued by Ruby.
Thanks a lot for finding a fix.
But to enlighten me/us: what was the cause?
Berend
Works for me, so far! Thank you very much!
Unfortunately, "live updating" of print-messages is not working anymore, right?
So if you execute this:
library(audio)
for(i in 1:10) { wait(1.0) print(i)
}
… the print messages appear after the whole execution is finished and not after every iteration of the loop.
On 05.02.2012, at 15:20, Berend Hasselman wrote:
On 04-02-2012, at 18:16, Hans-Jörg Bibiko wrote:
Hi,
maybe I found a fix for that issue (at least my test script now runs :) ):
The new R.tmbundle stuff I host at https://github.com/avian/r.tmbundle/ thus here the code which should be tested.
Please replace everything in between
STDOUT.sync = true {... and ...} STDOUT.flush
in file tmR.rb by:
STDOUT.sync = false STDERR.sync = false
descriptors = [stdout, stderr] descriptors.each { |fd| fd.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) } until descriptors.empty? select(descriptors).shift.each do |io| begin str = io.readline rescue descriptors.delete io io.close break end if str.nil? or str.empty? descriptors.delete io io.close elsif io == stderr # just in case print hideStartMessageJS print %{<span style="color: red">#{esc str}</span>} elsif io == stdout print hideStartMessageJS str.each_line do |line| # line counter for top level source if line.include?("#{linecountermarker}") linecounter += 1 line.sub!("#{linecountermarker}", '') end # check for a comment sign at the beginning of a line if line.match(/>\s*#/) print "<i><font color=blue>#{esc line.chomp}</font></i>\n" # check for a comment within a line - regexp should be improved yet! elsif m=line.match(/(.*?)(#[^"']*)$/) print esc(m[1]).gsub(/^(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') print "<i><font color=blue>#{esc(m[2]).chomp}</font></i>\n" # check for error messages elsif m=line.match(/(?i)^\s*(error|erreur|fehler|errore|erro)( |:)/) where = (isSelection) ? " of selection" : "" print "<span style='color: red'>#{esc str.gsub(%r{(?m).*?#{m[1]}},m[1]).chomp}<br /><i>RMate</i> stopped at <a href='txmt://open?line=#{linecounter}'>line #{linecounter-selectionlinestart}#{where}</a></span><br />".gsub(%r{source("(.*?)")},'source("<a href="txmt://open?url=file://\1">\1</a>")') print "<hr noshade width='300' size='2' align='left' color=lightgrey>" break # check for warnings elsif line.match(/^\s*(Warning|Warning messages?|Message d.avis|Warnmeldung|Messaggio di avvertimento|Mensagem de aviso):/) print "<span style='color: gray'>#{esc line}</span>" # print line simply with hyperlinked prompt if given elsif line.match(/_\x8./) print "#{line.gsub(/_\x8(.)/,'<b>\1</b>')}" else print esc(line).gsub(/^[\x0-\x9]?(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') end end end end end
STDOUT.flush
Feedback is welcome :)
I have been running quite a lot of scripts to see what happens now. No error messages have been issued by Ruby.
Thanks a lot for finding a fix.
But to enlighten me/us: what was the cause?
Berend
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Dear Hans,
Now it happened to me, that a script was actually finished, but the loading-circle of the textmate-window still indicated, that the script is running. (I saw that it actually was finished by the files it generates).
I also didn't get any print-messages that were in the code.
best, martin
On 04.02.2012, at 18:16, Hans-Jörg Bibiko wrote:
Hi,
maybe I found a fix for that issue (at least my test script now runs :) ):
The new R.tmbundle stuff I host at https://github.com/avian/r.tmbundle/ thus here the code which should be tested.
Please replace everything in between
STDOUT.sync = true {... and ...} STDOUT.flush
in file tmR.rb by:
STDOUT.sync = false STDERR.sync = false
descriptors = [stdout, stderr] descriptors.each { |fd| fd.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK) } until descriptors.empty? select(descriptors).shift.each do |io| begin str = io.readline rescue descriptors.delete io io.close break end if str.nil? or str.empty? descriptors.delete io io.close elsif io == stderr # just in case print hideStartMessageJS print %{<span style="color: red">#{esc str}</span>} elsif io == stdout print hideStartMessageJS str.each_line do |line| # line counter for top level source if line.include?("#{linecountermarker}") linecounter += 1 line.sub!("#{linecountermarker}", '') end # check for a comment sign at the beginning of a line if line.match(/>\s*#/) print "<i><font color=blue>#{esc line.chomp}</font></i>\n" # check for a comment within a line - regexp should be improved yet! elsif m=line.match(/(.*?)(#[^"']*)$/) print esc(m[1]).gsub(/^(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') print "<i><font color=blue>#{esc(m[2]).chomp}</font></i>\n" # check for error messages elsif m=line.match(/(?i)^\s*(error|erreur|fehler|errore|erro)( |:)/) where = (isSelection) ? " of selection" : "" print "<span style='color: red'>#{esc str.gsub(%r{(?m).*?#{m[1]}},m[1]).chomp}<br /><i>RMate</i> stopped at <a href='txmt://open?line=#{linecounter}'>line #{linecounter-selectionlinestart}#{where}</a></span><br />".gsub(%r{source("(.*?)")},'source("<a href="txmt://open?url=file://\1">\1</a>")') print "<hr noshade width='300' size='2' align='left' color=lightgrey>" break # check for warnings elsif line.match(/^\s*(Warning|Warning messages?|Message d.avis|Warnmeldung|Messaggio di avvertimento|Mensagem de aviso):/) print "<span style='color: gray'>#{esc line}</span>" # print line simply with hyperlinked prompt if given elsif line.match(/_\x8./) print "#{line.gsub(/_\x8(.)/,'<b>\1</b>')}" else print esc(line).gsub(/^[\x0-\x9]?(>|+)/,'<a class="prompt" href="txmt://open?line='+linecounter.to_s+'">\1</a>') end end end end end
STDOUT.flush
Feedback is welcome :)
Cheers, --Hans
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Hi,
I've uploaded a slightly changed version of the R.tmbundle to https://github.com/avian/R.tmbundle/ . For my test cases the fix (simply wait for some µsecs before reading a stream) works and the output appears synchronously again.
Could you please give it a test?
Best, --Hans
On 08-03-2012, at 11:00, Hans-Jörg Bibiko wrote:
Hi,
I've uploaded a slightly changed version of the R.tmbundle to https://github.com/avian/R.tmbundle/ . For my test cases the fix (simply wait for some µsecs before reading a stream) works and the output appears synchronously again.
Could you please give it a test?
I'm quite prepared to test but I don't yet use TM2. I'm still on TM1.5.
Does this version work on TM1.5? And how do I get this version of the R.bundle? I can download a tar.gz, which is what I have done.
Or do I just/only copy the new tmR.rb to the R.bundle for TM1.5?
best
Berend
On 8 Mar 2012, at 11:27, Berend Hasselman wrote:
On 08-03-2012, at 11:00, Hans-Jörg Bibiko wrote:
Hi,
I've uploaded a slightly changed version of the R.tmbundle to https://github.com/avian/R.tmbundle/ . For my test cases the fix (simply wait for some µsecs before reading a stream) works and the output appears synchronously again.
Could you please give it a test?
I'm quite prepared to test but I don't yet use TM2. I'm still on TM1.5.
Does this version work on TM1.5?
Yes - it should but not tried yet.
And how do I get this version of the R.bundle? I can download a tar.gz, which is what I have done.
After decompressing you will have a normal R.tmbundle which can be installed as usual.
Or do I just/only copy the new tmR.rb to the R.bundle for TM1.5?
Yes - in that case this should be the easiest.
--Hans
On 08-03-2012, at 12:01, Hans-Jörg Bibiko wrote:
On 8 Mar 2012, at 11:27, Berend Hasselman wrote:
On 08-03-2012, at 11:00, Hans-Jörg Bibiko wrote:
Hi,
I've uploaded a slightly changed version of the R.tmbundle to https://github.com/avian/R.tmbundle/ . For my test cases the fix (simply wait for some µsecs before reading a stream) works and the output appears synchronously again.
Could you please give it a test?
I have tested by copying the tmR.rb to the R bundle for TM1.5. The problem as reported some time ago is solved, so it seems. Output comes quickly, synchronized and nothing has been skipped.
Very nice and thanks a lot.
Berend
I'm quite prepared to test but I don't yet use TM2. I'm still on TM1.5.
Does this version work on TM1.5?
Yes - it should but not tried yet.
And how do I get this version of the R.bundle? I can download a tar.gz, which is what I have done.
After decompressing you will have a normal R.tmbundle which can be installed as usual.
Or do I just/only copy the new tmR.rb to the R.bundle for TM1.5?
Yes - in that case this should be the easiest.