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

Andreas Leha @ndre@@@|eh@ @end|ng |rom med@un|-goett|ngen@de
Thu Oct 8 04:01:58 CEST 2015


Hi Vitalie,

Vitalie Spinu <spinuvit using gmail.com> writes:
> Sam Steingold posted a complete working solution for how to make direct
> connection with xterm + ssh + screen + R from emacs a while ago. The thread
> should be easy to find.

I guess you are referring to this [1]?  But then, I am confused.  That
uses ess-remote as well.  So, why is this expected to not show the problem
of truncating lines during the evaluation of long code?

Thanks,
Andreas

[1] http://permalink.gmane.org/gmane.emacs.ess.general/8755




>
>  Vitalie
>
>>> On Wed, Oct 07 2015 21:25, Andreas Leha wrote:
>
>> Hi Vitalie,
>
>> Vitalie Spinu <spinuvit using gmail.com> writes:
>>> This is a known problem with ess-remote. I have no idea why the characters are
>>> lost. It's some emacs shell bug which I couldn't figure out last time I looked
>>> into it. This problem is almost impossible to reproduce consistently and debug
>>> properly.
>>>
>>> I suggest you stick with tramp. This problem never occurs with tramp and you
>>> have full set of ESS features on remotes, while ess-remote provides only a very
>>> limited functionality.
>>>
>
>> I have reported this problem a while back, too [1].
>
>> I'd also recommend using tramp where possible.  I just want to mention
>> again, that to my knowledge that won't work with screen/tmux sessions on
>> the remote side.  So, that advice won't help for most of my remote work.
>
>> (Most of my remote sessions live inside a screen session, because my
>> remote sessions are typically long and computationally intensive and
>> often even initiate submissions to a cluster.  If they were not, I would
>> run that on the local machine.)
>
>> Thanks,
>> Andreas
>
>> [1] http://permalink.gmane.org/gmane.emacs.ess.general/8690
>
>>>>> On Wed, Oct 07 2015 13:47, Robert McGehee wrote:
>>>
>>>> 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]]
>>>
>>>> ______________________________________________
>>>> ESS-help using r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/ess-help>
>>> ______________________________________________
>>> ESS-help using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/ess-help
>
>> ______________________________________________
>> ESS-help using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/ess-help
>
> ______________________________________________
> ESS-help using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help




More information about the ESS-help mailing list