[ESS] Windows Emacs: still hangs on install.packages(); no fix?

Vitalie Spinu spinuvit at gmail.com
Wed Sep 19 12:02:59 CEST 2012


Hello, 

The freezing problem is most likely gone in beta. ESS no longer waits
for the output to arrive, and long running (or never-ending like in this
case) commands no longer stall emacs.

  >> "Ponting, Keith (Keith)" <kponting at avaya.com>
  >> on Wed, 19 Sep 2012 04:19:42 -0400 wrote:

  > Hi Paul,
  > Another not what you want, but here goes. I get similar but not identical
  > behaviour - (Vista, emacs 24.1.1 from Vincent Goulet's excellent bundle
  > emacs-24.1-modified-1, including ESS 12.04-4). If I <ctrl>C <ctrl>C with the
  > cursor in the *R* buffer on the line which says "--- Please select a C RAN
  > mirror for use in this session ---", then the minibuffer responds "no command on
  > this line", but if I move the cursor up to a command prompt line (beginning ">
  > "), then the interrupt works.

The C-c C-c problem is also solved in beta. It should now work everywhere, not
only on input lines.

  > More like what you want: I have the following in my .emacs - you
  > could try something like this in site-start.el with your solutions 1
  > or 2 replacing my max.print option:

  > (defun my-ess-post-run-hook ()
  >   (ess-execute-screen-options) ; from ESS-help Digest vol 77 issue 10
  >   (local-set-key "\C-cw" 'ess-execute-screen-options)
  >   (if (string= ess-dialect "R") (ess-eval-linewise "options(max.print=100)" nil nil nil (quote wait)))
  > )
  > (add-hook 'ess-post-run-hook 'my-ess-post-run-hook)

This is indeed the way to go. 

(defun my-ess-execute-options ()
  (when (string-match-p "^R" ess-dialect)
    (ess-command "options(menu.graphics = FALSE)\n")))
(add-hook 'ess-post-run-hook 'my-ess-post-run-hook)

Use ess-eval-linewise instead if you want your users to see the code in their
buffers. Same for your CRAN code, enclose it in {...} and don't forget
to put "\n" at the end.

In beta it's even easier because there is a specialized R post-run hook:

(defun my-R-execute-options ()
    (ess-command "options(menu.graphics = FALSE)\n"))
(add-hook 'ess-R-post-run-hook 'my-R-execute-options)

I wonder if this option should be set by ESS. Tcltk menus are pretty annoying.

There is also an ESS interface ess-install.packages which pops an IDO
interface for CRAN selection. You can access it directly with M-x or
with comma in *R* buffer through handy-commands.

In beta ess-handy-commands are bound to C-c h. So C-c h inst RET should
do the job for you.

So as you can see there are many reasons to wait for the next release ;)

    Vitalie

  > Keith Ponting
  > Aurix Ltd, Malvern WR14 3SZ  UK
  > Any opinions are those of the author not the company.

  >> -----Original Message-----
  >> From: ess-help-bounces at r-project.org [mailto:ess-help-bounces at r-
  >> project.org] On Behalf Of Joshua Wiley
  >> Sent: 19 September 2012 06:20
  >> To: Paul Johnson
  >> Cc: ess-help
  >> Subject: Re: [ESS] Windows Emacs: still hangs on install.packages(); no
  >> fix?
  >> 
  >> Hi Paul,
  >> 
  >> Probably not really what you want but note that:
  >> 
  >> require(tcltk)
  >> 
  >> before running will also fix it.  If you have access to global emacs
  >> files, perhaps a system R profile?  I'm not sure of a pure ESS approach,
  >> but maybe other smarter folks will chime in.
  >> 
  >> Cheers,
  >> 
  >> Josh
  >> 
  >> On Tue, Sep 18, 2012 at 9:45 PM, Paul Johnson <pauljohn32 at gmail.com>
  >> wrote:
  >> > Greetings ESS developers:
  >> >
  >> > After my impassioned plea in favor of Emacs and ESS
  >> > (http://pj.freefaculty.org/guides/Rcourse/emacs-ess/emacs-ess.pdf),> > a few of the students relented and tried it out. It is mostly working
  >> > as I expect, but a widespread problem has developed. The ESS session
  >> > hangs if the user runs commands that need CRAN access. A command like
  >> >
  >> >> install.packages("lmtest")
  >> >
  >> > hangs the session.  The ESS buffer says choose CRAN repository from
  >> > list, but the list never pops up. Is this a tcltk problem? (In Linux,
  >> > the CRAN chooser is a tcltk thing, I wonder if Windows uses same).
  >> >
  >> > I've found a few posts about this problem, which proposes some
  >> > workarounds, but none are great.
  >> >
  >> > https://stat.ethz.ch/pipermail/ess-help/2008-January/004470.html> >
  >> > That one says that C-c C-c will break the freeze, but it does not do
  >> > that in Emacs 24.1 or 24.2 for Windows. For me, Emacs stays frozen,
  >> > the minibuffer says "Text is read only".
  >> >
  >> > I wish this problem could be fixed on your end, but in lieu of that, I
  >> > need a "solution" that I can engineer for all users on a system,
  >> > something to put in site-start.d. When I go from one machine to
  >> > another, I can't remember to re-run these workarounds every single
  >> > time.
  >> >
  >> > Here are the workarounds that do work, but they aren't great.
  >> >
  >> > 1. Remember to run this every time you start R in ESS:
  >> >
  >> >> chooseCRANmirror(graphics = FALSE)
  >> >
  >> > That gives a text chooser for the desired CRAN mirror. That's fine.
  >> >
  >> > It is hard to remember to do that every time.
  >> >
  >> > 2. In  ~/.Rprofile file, put such:
  >> >
  >> > local({r <- getOption("repos")
  >> >         r["CRAN"] <- "http://rweb.quant.ku.edu/cran"> >         options(repos=r)})
  >> >
  >> > The only problem there is that you have to re-do that when you go to a
  >> > new computer or run in a different user account.  It is driving me
  >> > insane.
  >> >
  >> > Is there something I can put in the Emacs startup file system-wide
  >> > that forces all CRAN chooser things to obey the graphics=FALSE policy?
  >> > In the old days, Emacs for Windows had the problem that the file
  >> > chooser menu could not let the user choose a file.  TO address that, I
  >> > put this in init.el:
  >> >
  >> > (if (eq system-type 'windows-nt)
  >> >     (setq use-file-dialog nil))
  >> >
  >> > If there were something I could put in there to tell ESS to NOT try to
  >> > open the CRAN mirror chooser, I could be happy.
  >> >
  >> > --
  >> > Paul E. Johnson
  >> > Professor, Political Science    Assoc. Director
  >> > 1541 Lilac Lane, Room 504     Center for Research Methods
  >> > University of Kansas               University of Kansas
  >> > http://pj.freefaculty.org            http://quant.ku.edu> >
  >> > ______________________________________________
  >> > ESS-help at r-project.org mailing list
  >> > https://stat.ethz.ch/mailman/listinfo/ess-help> 
  >> 
  >> 
  >> --
  >> Joshua Wiley
  >> Ph.D. Student, Health Psychology
  >> Programmer Analyst II, Statistical Consulting Group University of
  >> California, Los Angeles https://joshuawiley.com/> 
  >> ______________________________________________
  >> ESS-help at r-project.org mailing list
  >> https://stat.ethz.ch/mailman/listinfo/ess-help

  > ______________________________________________
  > ESS-help at r-project.org mailing list
  > https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list