Re: [O] Hang on incomplete input

2011-12-01 Thread Ken Williams

Rafael wrote:

 In Ubuntu 10.10, emacs 23.2 and recent org, I get an *Org-Babel Error
 Output* buffer, saying:

 Error: unexpected '}' in:
 ddply(x,
 }
 Execution halted

I'm using:

GNU Emacs 23.3 (from http://vgoulet.act.ulaval.ca/en/emacs/windows/)
Windows 7
org-mode 7.7
ESS 5.14

What version of ESS do you have?  Maybe that's the difference?

Any suggestions for how to debug a hang like this?  Is there a signal I can 
send it, to generate a stack trace (if signals are even possible in Windows, 
I'm not even sure)?

 -Ken

CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended 
recipient(s) and may contain confidential and privileged information. Any 
unauthorized review, use, disclosure or distribution of any kind is strictly 
prohibited. If you are not the intended recipient, please contact the sender 
via reply e-mail and destroy all copies of the original message. Thank you.



Re: [O] Hang on incomplete input

2011-12-01 Thread Nick Dokos
Ken Williams ken.willi...@windlogics.com wrote:

 
 Rafael wrote:
 
  In Ubuntu 10.10, emacs 23.2 and recent org, I get an *Org-Babel Error
  Output* buffer, saying:
 
  Error: unexpected '}' in:
  ddply(x,
  }
  Execution halted
 
 I'm using:
 
 GNU Emacs 23.3 (from http://vgoulet.act.ulaval.ca/en/emacs/windows/)
 Windows 7
 org-mode 7.7
 ESS 5.14
 
 What version of ESS do you have?  Maybe that's the difference?
 

FWIW, I got the same thing as Rafael:

Linux 2.6.35-28-generic #50-Ubuntu SMP Fri Mar 18 18:42:20 UTC 2011 x86_64 
GNU/Linux
GNU Emacs 24.0.90.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.22.0) of 
2011-10-27
Org-mode version 7.7 (release_7.7.617.gb1f2)

Forgive my ignorance: how do I check the ESS version? And what does ESS have
to do with R? I thought this was an R code block, but as you can probably
tell, I'm an ignoRamus.

When I start R interactively, I get 

,
| R version 2.11.1 (2010-05-31)
| Copyright (C) 2010 The R Foundation for Statistical Computing
| ISBN 3-900051-07-0
`

 Any suggestions for how to debug a hang like this?  Is there a signal I can 
 send it, to generate a stack trace (if signals are even possible in Windows, 
 I'm not even sure)?
 

Probably the best thing to do is cut out the middleman: execute the code
snippet in the appropriate environment directly - no emacs, no org, no
babel - and see if you have the problem. There are differences of course
that babel tries to minimize but it can only simulate certain cases. E.g
when I enter the incomplete form in the interactive session, it keeps giving
me a secondary prompt attempting to convince me to do something sensible:

,
| 
|   dply(x,
| + 
| + 
| + )
| Error: could not find function dply
| 
`

babel does not have that luxury.

If that does not bear fruit, you can M-x toggle-debug-on-quit, run the
code block and press C-g to get a backtrace. Rinse, repeat to see
whether you always stop at the same point. It's somewhat hit-or-miss but
it can be effective sometimes.

Nick





Re: [O] Hang on incomplete input

2011-12-01 Thread Ken Williams


 -Original Message-
 From: n...@dokosmarshall.org [mailto:n...@dokosmarshall.org] On Behalf
 Of Nick Dokos
 Sent: Thursday, December 01, 2011 9:21 AM

 Forgive my ignorance: how do I check the ESS version? And what does ESS
 have to do with R? I thought this was an R code block, but as you can
 probably tell, I'm an ignoRamus.

ESS is the mechanism by which org-mode interfaces with a running R process.

And I think I left out a crucial piece of information in my first message: I 
run R in a session buffer, my full .org file looks like this:

###
#+TITLE: Test doc
#+AUTHOR: Ken Williams
#+BABEL: :session *Rt*

* My Header

Some code:

#+begin_src R
ddply(x,
#+end_src
###

With that change, is the hang reproducible?


 If that does not bear fruit, you can M-x toggle-debug-on-quit, run the code
 block and press C-g to get a backtrace. Rinse, repeat to see whether you
 always stop at the same point. It's somewhat hit-or-miss but it can be
 effective sometimes.

I could *SWEAR* I had tried C-g to abort the running R command (and C-c C-c, 
and C-c C-g, and about a dozen other things), but couldn't get it to react.  
Now it aborts as desired.  I must have not actually tried a simple C-g.  I can 
never remember which keys abort which aspect of operation.

When I'm armed with that C-g, the hang is a much smaller issue!

 -Ken


CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended 
recipient(s) and may contain confidential and privileged information. Any 
unauthorized review, use, disclosure or distribution of any kind is strictly 
prohibited. If you are not the intended recipient, please contact the sender 
via reply e-mail and destroy all copies of the original message. Thank you.



Re: [O] Hang on incomplete input

2011-12-01 Thread Nick Dokos
Ken Williams ken.willi...@windlogics.com wrote:

 
 
  -Original Message-
  From: n...@dokosmarshall.org [mailto:n...@dokosmarshall.org] On Behalf
  Of Nick Dokos
  Sent: Thursday, December 01, 2011 9:21 AM
 
  Forgive my ignorance: how do I check the ESS version? And what does ESS
  have to do with R? I thought this was an R code block, but as you can
  probably tell, I'm an ignoRamus.
 
 ESS is the mechanism by which org-mode interfaces with a running R process.
 

Ok, thanks! I must have set it up at some point, but I had completely forgotten
about it. The README says it's 5.11.

 And I think I left out a crucial piece of information in my first message: =
 I run R in a session buffer, my full .org file looks like this:
 
 ###
 #+TITLE: Test doc
 #+AUTHOR: Ken Williams
 #+BABEL: :session *Rt*
 
 * My Header
 
 Some code:
 
 #+begin_src R
 ddply(x,
 #+end_src
 ###
 
 With that change, is the hang reproducible?
 

Yup - I did it twice and got the backtrace at the bottom of this mail
both times.  One funky thing is that it only happens every second C-c C-c
for me.

Note also that #+BABEL: is obsolete for versions of org more recent than
Oct. 20 or so. You seem to still be running 7.7 from late July or early
August, so you should still be OK, but when you next upgrade, you will
need to make changes to your files. I had to change it to #+PROPERTIES:
...  for my org version.

A good starting point on this change  is Eric Schulte's message entitled

  Standardized code block syntax and Property Accumulation merged into Master

Nick


 
  If that does not bear fruit, you can M-x toggle-debug-on-quit, run the co=
 de
  block and press C-g to get a backtrace. Rinse, repeat to see whether you
  always stop at the same point. It's somewhat hit-or-miss but it can be
  effective sometimes.
 
 I could *SWEAR* I had tried C-g to abort the running R command (and C-c C-c=
 , and C-c C-g, and about a dozen other things), but couldn't get it to reac=
 t.  Now it aborts as desired.  I must have not actually tried a simple C-g.=
   I can never remember which keys abort which aspect of operation.
 
 When I'm armed with that C-g, the hang is a much smaller issue!
 
  -Ken
 
 
 CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the inte=
 nded recipient(s) and may contain confidential and privileged information. =
 Any unauthorized review, use, disclosure or distribution of any kind is str=
 ictly prohibited. If you are not the intended recipient, please contact the=
  sender via reply e-mail and destroy all copies of the original message. Th=
 ank you.
 

Backtrace:

Debugger entered--Lisp error: (quit)
  file-exists-p(/tmp/babel-5986bN8/R-5986N_O)
  (not (file-exists-p file))
  (while (not (file-exists-p file)) (sit-for (or period 0.25)))
  org-babel-comint-eval-invisibly-and-wait-for-file(*Rt* 
/tmp/babel-5986bN8/R-5986N_O 
{function(object,transfer.file){object;invisible(if(inherits(try({tfile-tempfile();write.table(object,file=tfile,sep=\\\t\,na=\nil\,row.names=FALSE,col.names=FALSE,quote=FALSE);file.rename(tfile,transfer.file)},silent=TRUE),\try-error\)){if(!file.exists(transfer.file))file.create(transfer.file)})}}(object=.Last.value,transfer.file=\/tmp/babel-5986bN8/R-5986N_O\))
  (let ((tmp-file (org-babel-temp-file R-))) 
(org-babel-comint-eval-invisibly-and-wait-for-file session tmp-file (format 
org-babel-R-write-object-command (if row-names-p TRUE FALSE) (if 
column-names-p (if row-names-p NA TRUE) FALSE) .Last.value 
(org-babel-process-file-name tmp-file (quote noquote 
(org-babel-R-process-value-result (org-babel-import-elisp-from-file tmp-file 
(quote (16))) column-names-p))
  (cond ((eql result-type (quote value)) (with-temp-buffer (insert 
(org-babel-chomp body)) (let ((ess-local-process-name (process-name 
(get-buffer-process session (ess-eval-buffer nil))) (let ((tmp-file 
(org-babel-temp-file R-))) (org-babel-comint-eval-invisibly-and-wait-for-file 
session tmp-file (format org-babel-R-write-object-command (if row-names-p 
TRUE FALSE) (if column-names-p (if row-names-p NA TRUE) FALSE) 
.Last.value (org-babel-process-file-name tmp-file (quote noquote 
(org-babel-R-process-value-result (org-babel-import-elisp-from-file tmp-file 
(quote (16))) column-names-p))) ((eql result-type (quote output)) (mapconcat 
(function org-babel-chomp) (butlast (delq nil (mapcar (lambda (line) (when ... 
line)) (mapcar (lambda ... ...) (org-babel-comint-with-output ... ... ...) 
\n)))
  (case result-type (value (with-temp-buffer (insert (org-babel-chomp body)) 
(let ((ess-local-process-name (process-name (get-buffer-process session 
(ess-eval-buffer nil))) (let ((tmp-file (org-babel-temp-file R-))) 
(org-babel-comint-eval-invisibly-and-wait-for-file session tmp-file (format 
org-babel-R-write-object-command (if row-names-p TRUE FALSE) (if 
column-names-p (if row-names-p NA TRUE) FALSE) .Last.value 

Re: [O] Hang on incomplete input

2011-12-01 Thread Ken Williams


 -Original Message-
 From: nicholas.dokos
 Sent: Thursday, December 01, 2011 12:19 PM

 Note also that #+BABEL: is obsolete for versions of org more recent than Oct.
 20 or so. You seem to still be running 7.7 from late July or early August, so 
 you
 should still be OK, but when you next upgrade, you will need to make
 changes to your files. I had to change it to #+PROPERTIES:
 ...  for my org version.

 A good starting point on this change  is Eric Schulte's message entitled

   Standardized code block syntax and Property Accumulation merged into
 Master

Thanks for the heads up, I'll make the change.  But it seems like the thread 
you referenced might only be tangentially related to a BABEL-PROPERTIES change:

  http://thread.gmane.org/gmane.emacs.orgmode/49247/focus=49309

Or if it's there, I'm not seeing it. =)

 -Ken


CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended 
recipient(s) and may contain confidential and privileged information. Any 
unauthorized review, use, disclosure or distribution of any kind is strictly 
prohibited. If you are not the intended recipient, please contact the sender 
via reply e-mail and destroy all copies of the original message. Thank you.



Re: [O] Hang on incomplete input

2011-12-01 Thread Nick Dokos
Ken Williams ken.willi...@windlogics.com wrote:

 
  A good starting point on this change  is Eric Schulte's message entitled
 
Standardized code block syntax and Property Accumulation merged into
  Master
 
 Thanks for the heads up, I'll make the change.  But it seems like the thread 
 you referenced might only be tangentially related to a BABEL-PROPERTIES 
 change:
 
   http://thread.gmane.org/gmane.emacs.orgmode/49247/focus=49309
 
 Or if it's there, I'm not seeing it. =)
 

You are probably right - I haven't had the time to keep up with the discussion,
This change is slightly older and it was discussed a lot during October.

And I got it wrong too: it's #+PROPERTY: , not #+PROPERTIES: ...
Sorry about that.

In a recent version of the info version of the manual, check out (info (org) 
Buffer-wide header arguments)

Nick




[O] Hang on incomplete input

2011-11-30 Thread Ken Williams
Apparently, org-mode Babel (or maybe Emacs, or ESS) will hang when given 
incomplete input, like the following:

#+begin_src R
ddply(x,
#+end_src

I was just tearing my hair out trying to figure out why my code was hanging, 
because of course it's much longer and I didn't notice the missing paren.

Is this replicable on other people's platforms too?  I'm using GNU Emacs on 
Windows, with org-mode 7.7 and ESS 5.14.

There are other situations where I really wish org-mode (or Emacs, or ESS) 
didn't freeze up while evaluating R code - for example if I accidentally did 
'debug()' on a function that's now being called, or even just on long-running 
calculations.  Any chance evaluation could be done in a separate thread or 
something?

Thanks.

--
Ken Williams, Senior Research Scientist
WindLogics
http://windlogics.com


CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the intended 
recipient(s) and may contain confidential and privileged information. Any 
unauthorized review, use, disclosure or distribution of any kind is strictly 
prohibited. If you are not the intended recipient, please contact the sender 
via reply e-mail and destroy all copies of the original message. Thank you.



Re: [O] Hang on incomplete input

2011-11-30 Thread Rafael
Ken Williams ken.willi...@windlogics.com writes:

 Apparently, org-mode Babel (or maybe Emacs, or ESS) will hang when
 given incomplete input, like the following:

 #+begin_src R
 ddply(x,
 #+end_src

 I was just tearing my hair out trying to figure out why my code was
 hanging, because of course it's much longer and I didn't notice the
 missing paren.

 Is this replicable on other people's platforms too?  I'm using GNU
 Emacs on Windows, with org-mode 7.7 and ESS 5.14.

 There are other situations where I really wish org-mode (or Emacs, or
 ESS) didn't freeze up while evaluating R code - for example if I
 accidentally did 'debug()' on a function that's now being called, or
 even just on long-running calculations.  Any chance evaluation could
 be done in a separate thread or something?

In Ubuntu 10.10, emacs 23.2 and recent org, I get an *Org-Babel Error
Output* buffer, saying:

Error: unexpected '}' in:
ddply(x,
}
Execution halted