[ESS] Emacs 23.1 hangs on starting R process - sometimes

Nick Bell mail at nickbell.org
Thu Sep 3 18:55:34 CEST 2009


Dear List,

My first posting so be gentle! I'm using:
	
- ESS-5.4
- GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600) (self-compiled from CVS on
2009-08-24)
- Stock R-2.9.2
- XPSP3 (I know)

(The reason for using the CVS version is the fact that orgmode crashes
when pressing S+TAB in Indent mode.)

Problem: ess-site.el loads OK, an *ESS* buffer appears. I am asked to
choose a starting directory, I do so (doesn't matter which, or whether
there are any .Rdata/history files there).

If I have checked "Enter Debugger On Error" /sometimes/ an R process is
started:
*R*:

>> options(chmhelp = FALSE)
>> 
>> Save workspace image? [y/n/c]: > 

*Backtrace*:
> 
>> Debugger entered--Lisp error: (file-error "writing to process" "invalid argument" #<process R>)
>>   process-send-string(#<process R> "options(chmhelp = FALSE)\n")
>>   (while (or (setq txt-gt-0 ...) even-empty) (if even-empty (setq even-empty nil)) (if txt-gt-0 (progn ... ... ...) (setq com "\n")) (goto-char (marker-position ...)) (if (not invisibly) (let ... ... ...)) (setq start-of-output (marker-position ...)) (process-send-string sprocess com) (if (or wait-last-prompt ...) (while ...)))
>>   (let* ((deactivate-mark) (cbuffer ...) (sprocess ...) (sbuffer ...) (text ...) start-of-output com pos txt-gt-0) (unless (numberp timeout-ms) (setq timeout-ms 100)) (set-buffer sbuffer) (when (string= ess-language "STA") (if ess-sta-delimiter-friendly ...) (setq invisibly t)) (goto-char (marker-position ...)) (if (stringp invisibly) (insert-before-markers ...)) (while (or ... even-empty) (if even-empty ...) (if txt-gt-0 ... ...) (goto-char ...) (if ... ...) (setq start-of-output ...) (process-send-string sprocess com) (if ... ...)) (goto-char (marker-position ...)) (if eob (progn ... ...) (set-buffer cbuffer)) (if (numberp sleep-sec) (sleep-for sleep-sec)))
>>   (if (ess-ddeclient-p) (ess-eval-linewise-ddeclient text-withtabs invisibly eob even-empty (if wait-last-prompt ess-eval-ddeclient-sleep)) (let* (... ... ... ... ... start-of-output com pos txt-gt-0) (unless ... ...) (set-buffer sbuffer) (when ... ... ...) (goto-char ...) (if ... ...) (while ... ... ... ... ... ... ... ...) (goto-char ...) (if eob ... ...) (if ... ...)))
>>   ess-eval-linewise("options(chmhelp = FALSE)" nil nil nil wait)
>>   (if (string= ess-dialect "R") (ess-eval-linewise "options(chmhelp = FALSE)" nil nil nil (quote wait)))
>>   (lambda nil (if (string= ess-dialect "R") (ess-eval-linewise "options(chmhelp = FALSE)" nil nil nil ...)))()
>>   run-hooks(ess-post-run-hook)
>>   (let* ((symbol-string ...) (switches-symbol ...) (switches ...) (buf-name-str ...)) (ess-write-to-dribble-buffer (format "(ess-multi 0):  inf-ess-start-args=%s, comint-..echoes=%s\n" inf-ess-start-args comint-process-echoes)) (set-buffer buffer) (inferior-ess-mode) (ess-write-to-dribble-buffer (format "(ess-multi post inf-ess: start-args=%s, comint-echoes=%s\n" inf-ess-start-args comint-process-echoes)) (setq ess-local-process-name proc-name) (goto-char (point-max)) (setq comint-input-ring-file-name (expand-file-name ess-history-file ess-directory)) (comint-read-input-ring) (ess-write-to-dribble-buffer (format "(ess-multi 1):  start-args=%s \n" inf-ess-start-args)) (set-buffer (if switches ... ...)) (set-process-sentinel (get-process proc-name) (quote ess-process-sentinel)) (let (...) (if conselt nil ...)) (ess-make-buffer-current) (inferior-ess-wait-for-prompt) (goto-char (point-max)) (setq ess-sl-modtime-alist nil) (setq ess-sp-change t) (set-process-filter (get-proce

ss proc-name) (quote inferior-ess-output-filter)) (run-hooks (quote 
ess-post-run-hook)))
>>   (if (and proc (comint-check-proc ...)) (pop-to-buffer (process-buffer proc)) (let* (... ... ... ...) (ess-write-to-dribble-buffer ...) (set-buffer buffer) (inferior-ess-mode) (ess-write-to-dribble-buffer ...) (setq ess-local-process-name proc-name) (goto-char ...) (setq comint-input-ring-file-name ...) (comint-read-input-ring) (ess-write-to-dribble-buffer ...) (set-buffer ...) (set-process-sentinel ... ...) (let ... ...) (ess-make-buffer-current) (inferior-ess-wait-for-prompt) (goto-char ...) (setq ess-sl-modtime-alist nil) (setq ess-sp-change t) (set-process-filter ... ...) (run-hooks ...)) (if (and inferior-ess-same-window ...) (switch-to-buffer ...) (pop-to-buffer ...)))
>>   (let* ((proc-name name) (special-display-regexps nil) (special-display-frame-alist inferior-ess-frame-alist) (proc ...)) (if inferior-ess-own-frame (setq special-display-regexps ...)) (if (and proc ...) (pop-to-buffer ...) (let* ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...) (if ... ... ...)))
>>   ess-multi("R" #<buffer *R*> "--ess  ")
>>   (let ((ess-directory ...)) (ess-multi procname buf inferior-ess-start-args))
>>   (let* ((process-environment process-environment) (defdir ...) (temp-dialect ...) (temp-lang temp-ess-lang) (procname ...) (startdir nil) (buf nil) (buf-name-str ...)) (ess-write-to-dribble-buffer (format "(inf-ess 1.1): procname=%s temp-dialect=%s, buf-name=%s \n" procname temp-dialect buf-name-str)) (cond (... ... ... ...) (... ... ...) (... ... ... ...)) (set-buffer buf) (ess-setq-vars-local ess-customize-alist) (if ess-start-args (setq inferior-ess-start-args ess-start-args)) (ess-write-to-dribble-buffer (format "(inf-ess 2.1): ess-language=%s, ess-dialect=%s buf=%s \n" ess-language ess-dialect ...)) (ess-write-to-dribble-buffer (format "(inf-ess 2.2): start args = %s, inf-ess-start-args=%s \n" ess-start-args inferior-ess-start-args)) (ess-write-to-dribble-buffer (format "(inf-ess finish [%s(%s), %s(%s,%s)]\n" ess-language ess-dialect inferior-ess-program ess-current-process-name ess-local-process-name)) (if startdir (setq default-directory startdir)) (setq-default e

ss-history-file (concat "." ess-dialect "history")) (let (...) 
(ess-multi procname buf inferior-ess-start-args)))
>>   (let ((temp-ess-dialect ...) (temp-ess-lang ...)) (save-excursion (set-buffer ess-dribble-buffer) (make-local-variable ...) (ess-setq-vars-default ess-customize-alist) (setq-default comint-use-prompt-regexp-instead-of-fields nil)) (run-hooks (quote ess-pre-run-hook)) (ess-write-to-dribble-buffer (format "(inf-ess 1): lang=%s, dialect=%s, tmp-dialect=%s, buf=%s\n" ess-language ess-dialect temp-ess-dialect ...)) (let* (... ... ... ... ... ... ... ...) (ess-write-to-dribble-buffer ...) (cond ... ... ...) (set-buffer buf) (ess-setq-vars-local ess-customize-alist) (if ess-start-args ...) (ess-write-to-dribble-buffer ...) (ess-write-to-dribble-buffer ...) (ess-write-to-dribble-buffer ...) (if startdir ...) (setq-default ess-history-file ...) (let ... ...)))
>>   inferior-ess("--ess  ")
>>   (let* ((r-always-arg ...) (r-start-args ...)) (if ess-microsoft-p (setq default-process-coding-system ...)) (inferior-ess r-start-args) (ess-write-to-dribble-buffer (format "(R): inferior-ess-language-start=%s\n" inferior-ess-language-start)) (if (ess-current-R-at-least ...) (progn ...) (ess-eval-linewise "if(!exists(\"baseenv\", mode=\"function\")) baseenv <- function() NULL" nil nil nil ...)) (if inferior-ess-language-start (ess-eval-linewise inferior-ess-language-start nil nil nil ...)))
>>   R(nil)
>>   call-interactively(R t nil)
>>   execute-extended-command(nil)
>>   call-interactively(execute-extended-command nil nil)

Something wierd appears to be being sent to the buffer as it's
immediately trying to quit.

If I /don't/ have "Enter Debugger On Error" checked, I sometimes get:

	while: writing to process: invalid argument, R

in *Messages*, the same *R* buffer as above, and the following in *ESS*:

> [ess-site.el]: ess-customize-alist=nil 
> [ess-site.el _2_]: ess-customize-alist=nil 
> (ess-find-rterm): ess-R-root-dir = 'c:/Program Files/R/'
> (R): ess-r-versions-create making M-x defuns for 
>  c:/Program Files/R/R-2.9.2/bin/Rterm.exe
> 
> (R): ess-dialect=nil, buf=*scratch*, start-arg=nil
>  current-prefix-arg=nil
> (inferior-ess 0): ess-start-args=--ess   
> ess-setq-vars-default 0: ess-language=Initial, -dialect=nil, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
> ess-setq-vars-default 1: ess-language=S, -dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
> (inf-ess 1): lang=S, dialect=R, tmp-dialect=R, buf=*scratch*
> (inf-ess 1.1): procname=R temp-dialect=R, buf-name=*R* 
> (inferior-ess) Method #3 start=c:/Documents and Settings/nick/My Documents/Tosh/ buf=*R*
> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
> (inf-ess 2.1): ess-language=S, ess-dialect=R buf=*R* 
> (inf-ess 2.2): start args = --ess  , inf-ess-start-args=--ess   
> (inf-ess finish [S(R), Rterm(nil,nil)]
> (ess-multi 0):  inf-ess-start-args=--ess  , comint-..echoes=nil
> (i-ess 1): buf=*R*, lang=S, comint..echo=nil, comint..sender=comint-simple-send,
> (i-ess 2): buf=*R*, lang=S, comint..echo=t, comint..sender=inferior-R-input-sender,
> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, comint..sender=inferior-R-input-sender
> (i-ess 3): curr-buf=*R*, comint..echo=t, comint..sender=inferior-R-input-sender,
> (ess-multi post inf-ess: start-args=--ess  , comint-echoes=t
> (ess-multi 1):  start-args=--ess   
> Making Process...Buf *R*, Proc R, Prog Rterm
>  Start File=nil, Args= --ess  .

8 times out of 10 emacs just hangs after my choosing the startup directory.

.emacs:

> (setq load-path (cons "c:/emacs-CVS/site-lisp/org-6.30c/lisp" load-path))
> (setq load-path (cons "c:/emacs-CVS/site-lisp" load-path))
> (setq load-path (cons "c:/emacs-cvs/site-lisp/ess-5.4/lisp" load-path))
> ;;(load "C:/emacs-CVS/site-lisp/ess-5.4/lisp/ess-site")
> ;;(setq inferior-R-program-name "c:/progra~1/R/R-2.9.2/bin/Rterm.exe")
> (require 'ess-site)

Any ideas? Many thanks

Nick



More information about the ESS-help mailing list