2

I am using Emacs + ESS + Sweave to write a document. When I do multiline copy of noweb commands using M-w, switch to R buffer and execute them (C-y, RET), Emacs will sometimes freeze, forcing me to kill Emacs and start over. This also happens with C-c C-c'ing of a text block.

EDIT: I am using Emacs 24.3.1, ESS 14.09, R 3.1.2.

EDIT: After some testing, the following file will reproduce this problem. Specifically, the first chunk will cause Emacs to hang. The only resolution is to first C-g then switch to the R buffer and C-q C-c to return full control.

\documentclass[10pt]{article}
\usepackage{graphicx, verbatim, geometry,amsmath,amssymb, natbib, float, enumerate, courier, underscore}
\usepackage[utf8x]{inputenc}
\geometry{margin=1in}
\setlength{\textwidth}{6.5in} 
\setlength{\textheight}{9in}

\begin{document}

<<>>=
library(ggplot2)
dat <- matrix(runif(100), nrow=10)
    cc <- apply(dat, 1, function(xx){
    sum(cos(xx))
})
@ 

The quick brown fox jumps over the lazy dog.

<<>>=
bcc <- sapply(cc, function(xx){
    fft(xx)
})
@ 

\end{document}
Tyler
  • 22,234
  • 1
  • 54
  • 94
learner
  • 203
  • 2
  • 5
  • 1
    Next time it happens, do a kill -USR2 <emacs-pid> which will break most hangs and produce a backtrace. For extra info do M-x profiler-start when you start Emacs and M-x profiler-report after you kill. – PythonNut Feb 01 '15 at 17:03
  • It's a long trace. Is there something specific you are looking for? – learner Feb 01 '15 at 17:08
  • Something similar happens to me sometimes when I try to yank a shell buffer with a lot of text in it (a log of some sort), I think that it is either clipboard- or history-related. If you wait for a while (this isn't guaranteed to happen) but if you are up for experiment, some times it might pop up a *Warnings* buffer with a text about maximum undo steps exceeded. If that sounds familiar, I think it might make sense to file a bug to Emacs developers. – wvxvw Feb 01 '15 at 20:18
  • Does it happen when you send-region instead? I think it's C-c C-r, which should be available from a Rnw document. – Tyler Feb 01 '15 at 20:23
  • This is weird. It isn't related to tons of text, and does happen with send-region as well. Actually, it seems that sending \\wapply() calls using one of {C-c C-c, C-c C-r, M-w C-y} seems to be what kills it. Then it hangs at starting evaluation... – learner Feb 02 '15 at 12:10
  • 1
    I should add that Sweave-ing the document doesn't produce a hang up, nor does manually entering calls that when yanked/sent would freeze. – learner Feb 02 '15 at 12:16
  • Can you post a MWE that sometimes reproduces this? – Tyler Feb 02 '15 at 15:55
  • It works fine for me. What version of Emacs and ESS are you using? I recall having a similar problem, but it was years ago now. – Tyler Feb 02 '15 at 17:35
  • I'm using Emacs 24.3.1, ESS 14.09 – learner Feb 02 '15 at 17:42
  • Try updating ESS, thats quite a dated version the current stable is 18.10.2 or you can install the development version from MELPA with M-x package-install ess. – slackline Dec 07 '18 at 14:02

0 Answers0