[ESS] ess-mode 5.3.6; ESS locks up with par(ask = TRUE) etc and C-c C-r
Gavin Simpson
gavin.simpson at ucl.ac.uk
Wed Feb 6 22:42:48 CET 2008
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
On Wed, 2008-02-06 at 13:42 -0500, Richard M. Heiberger wrote:
> LifeCycleSavings <- data.frame(matrix(rnorm(100), 20, 5,
> dimnames=list(
> NULL,
> c("sr","pop15","pop75","dpi","ddpi"))))
>
> par(ask = TRUE)
>
> lm.SR <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
> plot(lm.SR)
> summary(lm.SR)
>
>
> ctrl-G gets emacs control back. On Windows, clicking the R Graphics window
> once per graph is the way I got R control back. The graphics device said
> that
> ENTER (implied in the *R* buffer) would get the additional graphs to show.
> It didn't. Only clicking the graph window got it back.
Thanks Richard. Ctrl-g when focussed on the Emacs window worked for me
--- at least I know how to get control back now.
>
> [complaint: you didn't put par(ask=TRUE) in the list of R statements, only
> in the subject line. That cost a few minutes trying to figure out what the
> problem
> was.]
Sorry, par(ask = TRUE) is implied in plot.lm given the code chunk I
provided and it was this behaviour that I meant to be unforeseeable,
rather than with an explicit par(ask = TRUE), which one wouldn't
normally issue in a script.
I was looking for the simplest way to recreate the behaviour and had
tracked down the problem to the implicit par(ask = TRUE) in plot.lm
given the scenario I used as an example.
>
> I normally do par(mfrow=c(2,2)) before a plot.lm(). This specific set of
> graphs is
> not usually worth a full page each. That may not be relevant if this
> example is
> a portable example for some other more complex set of graphs. Another style
> issue
> is that I always have graphic history recording on with
> options(graphics.record=TRUE)
> So I would just page back through the graph window to look at the earlier
> graphs.
Yes I do too. I was looking for a simple way to illustrate the problem.
I encountered this with mgcv:::plot.gam which uses readline(......) to
prompt for the user to display the next plot, even if the plotting
region was split into enough regions to take all the requested plots.
So even if one does:
op <- par(mfrow = c(2,1))
plot(gam(rnorm(100) ~ s(rnorm(100) + s(rnorm(100)))
par(op)
in an R buffer and C-c C-r to commit that region, you get stuck with
Emacs/ESS waiting for you to respond to the prompt. Now I know about C-g
I can get out of this problem.
Many thanks,
G
>
> -----Original Message-----
> From: ess-help-bounces at stat.math.ethz.ch
> [mailto:ess-help-bounces at stat.math.ethz.ch] On Behalf Of Gavin Simpson
> Sent: Wednesday, February 06, 2008 01:00 PM
> To: ess-help at stat.math.ethz.ch
> Subject: [ESS] ess-mode 5.3.6; ESS locks up with par(ask = TRUE) etc and C-c
> C-r
>
> hits=0.0 tests=none
> X-USF-Spam-Flag: NO
>
> Dear list:
>
> Consider the following code chunk in an ESS R buffer:
>
> lm.SR <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
> plot(lm.SR)
> summary(lm.SR)
>
> If one highlights this region and does C-c C-r (to evaluate the region),
> Emacs+ESS+R lock up completely and no matter what I cannot regain
> control.
>
> As it is not immediately obvious which functions are going to do this to
> you, is there any way that ESS can work around the asking for user input
> in the middle of a region commit?
>
> Is there a key-combo that I am missing that would allow me to regain
> control? At the moment I am resorting to killing R and Emacs as C-c C-c
> and C-c C-z don't appear to do anything.
>
> All the best,
>
> G
>
> ## info copied from the bug reporting tool in ESS (wasn't sure if Emacs
> would send mail as I've never configured it to do so)
>
> [ess-site.el]: ess-customize-alist=nil
> [ess-site.el _2_]: ess-customize-alist=nil
> (S): ess-s-versions-create making M-x defuns for
>
> (R): ess-r-versions-create making M-x defuns for
>
> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil,
> comint..sender=comint-simple-send
> (ess-mode-1): ess-language=S, ess-dialect=R buf=time_series_analysis_guide.R
>
> (ess-mode-1.5): alist=((ess-local-customize-alist quote R-customize-alist)
> (ess-dialect . R) (ess-suffix . R) (ess-dump-filename-template
> ess-replace-regexp-in-string S$ ess-suffix ess-dump-filename-template-proto)
> (ess-mode-syntax-table . R-syntax-table) (ess-mode-editing-alist .
> R-editing-alist) (ess-change-sp-regexp . ess-R-change-sp-regexp)
> (ess-help-sec-regex . ess-help-R-sec-regex) (ess-help-sec-keys-alist .
> ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout)
> (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern .
> ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el)
> (ess-imenu-mode-function quote ess-imenu-R) (inferior-ess-program .
> inferior-R-program-name) (inferior-ess-objects-command .
> inferior-R-objects-command) (inferior-ess-font-lock-keywords .
> inferior-ess-R-font-lock-keywords) (inferior-ess-search-list-command .
> search()
> ) (inferior-ess-help-command . help("%s", htmlhelp=FALSE)
> ) (inferior-ess-help-filetype) (inferior-ess-exit-command . q())
> (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: )
> (inferior-ess-primary-prompt . \([A-Z][][A-Za-z0-9.]*\)*> )
> (inferior-ess-secondary-prompt . + ?) (inferior-ess-start-file)
> (inferior-ess-start-args . ) (ess-STERM . iESS) (ess-editor . R-editor)
> (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
> ) (inferior-ess-language-start eval inferior-S-language-start)
> (comint-use-prompt-regexp-instead-of-fields . t))
> (ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\|
> page-delimiter) (paragraph-separate concat \s-*$\| page-delimiter)
> (paragraph-ignore-fill-prefix . t) (require-final-newline . t)
> (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *)
> (comment-column . 40) (indent-line-function quote S-indent-line)
> (parse-sexp-ignore-comments . t) (ess-set-style . ess-default-style)
> (ess-local-process-name) (ess-mode-syntax-table . S-syntax-table)
> (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[
> ]*function) (font-lock-defaults quote (ess-R-mode-font-lock-keywords nil nil
> ((46 . w) (95 . w)))))
> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil,
> comint..sender=comint-simple-send
>
> Finished setting up ESS-mode.
>
>
> Emacs : GNU Emacs 22.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.12.1)
> of 2007-11-06 on xenbuilder2.fedora.redhat.com
> Package: ess-mode 5.3.6
>
> current state:
> ==============
> (setq
> ess-language "S"
> ess-dialect "R"
> ess-ask-for-ess-directory t
> ess-ask-about-transfile nil
> ess-directory nil
> ess-keep-dump-files "always"
> ess-source-directory "/tmp/"
> )
>
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the ESS-help
mailing list