[ESS] Failure to parse long R functions when ess-eval-visibly nil

Robert McGehee rmcgehee at gmail.com
Wed Oct 7 19:47:48 CEST 2015


Hello,
I'm having an issue in which sufficiently long and complex functions will
fail to correctly evaluate in R (with e.g. ess-eval-function) if
ess-eval-visibly is nil rather than true. Instead I receive syntax errors
part way through the function that seem to indicate that a line or
character was accidentally dropped during the ess eval making the function
un-parsable. If I turn on visibility (ess-eval-visibly t), the problem
disappears but the evaluation takes a long time due to latency on my setup.
Moreover, the problem isn't perfectly reproducible as the syntax error will
occur somewhat at random. However, with a sufficiently long and complex
function (e.g. 300+ lines) I'm virtually guaranteed an error.

Unfortunately, my setup is likely unusual so I'm not sure if this is an ESS
error. However, I wanted to post in case anyone had any ideas on a fix
(besides just turning ess-eval-visibly to true).

For my setup, I run emacs 24.5.1 on my local (USA) Windows box via Cygwin
and have ESS 15.09 installed from source. I connect to a remote (European)
Linux server via emacs shell and ssh, then start R (3.2.2) and start
ESS-mode with M-x ess-remote. I run emacs locally rather than on the server
side as I'm connecting to a server across the Atlantic ocean and latency is
too high for X11 forwarding. Additionally, given the latency, I have to
wait a considerable amount of time to eval an R function visibly, whereas
it happens extremely fast if I turn off visible eval. Thus, I'd much prefer
a working non-visible eval.

Here's a simple function I used to generate the syntax error. It has the
advantage of nearly guaranteeing a parsing failure if any character is
missing.

a <- function(x) {
    if (a(b,"c"))
        x <- d(e(f(g,"H"),"I"),"J",k="L")
    if (a(b,"c"))
        x <- d(e(f(g,"H"),"I"),"J",k="L")
<...snip... repeated ~300 times>
    if (a(b,"c"))
        x <- d(e(f(g,"H"),"I"),"J",k="L")
}

## Here is the error I got indicating two closing parentheses "))" were
dropped during eval:
Error: unexpected symbol in:
"    if (a(b,"c"
        x"

(Possibly unrelated, if any line has two consecutive tab characters, then
ESS will actually print the contents of the home directory of the remote
server, which is exceptionally weird.)

Please let me know if anyone has any thoughts on this. Otherwise I'll just
turn ess-eval-visibly back to true.

Thanks!
Robert

PS.
Here is the relevant portion of my .emacs file:

(require 'cl)
(load "cc-mode")
(load "compile")

(require 'ess-site)
(setq comint-scroll-to-bottom-on-input t)
(setq comint-scroll-to-bottom-on-output t)
(setq ess-eval-visibly nil)
(setq ess-nuke-trailing-whitespace-p t)
(setq-default ess-directory "/tmp/")
(define-key key-translation-map [?\C-h] [?\C-?])

(transient-mark-mode t)
(setq display-time-day-and-date t)
(display-time-mode 1)
(setq visible-bell t)
(setq undo-outer-limit 100000)

(setq line-number-display-limit nil)
(setq line-number-display-limit-width 2000)
(setq column-number-mode t)
(require 'paren)
(if (fboundp 'show-paren-mode) (show-paren-mode 1))

(setenv "PID" nil)
(put 'upcase-region 'disabled nil)
(add-hook 'ess-mode-hook
      (lambda ()
        (ess-set-style 'C++ 'quiet)
        (add-hook 'local-write-file-hooks
              (lambda ()
            (ess-nuke-trailing-whitespace)))))
(setq truncate-partial-width-windows nil)

	[[alternative HTML version deleted]]



More information about the ESS-help mailing list