ShuguangSun / ess-view-data

View data support for ESS
GNU General Public License v3.0
42 stars 5 forks source link

question/bug: Emacs hangs when using ess-view-data-print #6

Open nettoyoussef opened 3 years ago

nettoyoussef commented 3 years ago

Hi, thanks for the effort put in this package.

I am not sure why, but Emacs+ESS just hangs when I use ess-view-data-print on a dataset (such as the mtcars in the example). Maybe I am missing some R dependency? Which are the packages that I should have installed to use ess-view-data?

My installation is just a vanilla one with straight:

(use-package ess-view-data 
 :straight t
 :defer t
)
ShuguangSun commented 3 years ago

What is the version of your emacs and ess?

R library:

Optional:

If you switch to other ess-view-data-backend-list, DT or data.table is needed.

By the way, csv-mode for Emacs is recommended for headline, but if you don't have it, it will not make emacs hang.

nettoyoussef commented 3 years ago

Hi, thanks for the fast response.

I am using Emacs 28.0.50 and ESS commit cb75588d972b97e597c42108b3c83c2f67947cac (I use straight to manage packages).

I think that the problem may be caused by a non-closed quote or by missing some block character such as ). After it hangs, if I cancel everything and try to run any command, e.g., install.packages, it returns this error message:

Error: unexpected symbol in:
"mp <- options("width", "tibble.width", "crayon.enabled");options(tibble.width = Inf, width = 5000, crayon.enabled = FALSE);print(`datajndnxz`[(0*200 + 1) : min((0 + 1)*200, nrow(`datajndnxz`))
}install.packages"
ShuguangSun commented 3 years ago

It seems part of the "local({....})\n". However I didn't find “)\n”.

would you please (setq ess-verbose t), and then find out what is say in buffer *ESS*?

nettoyoussef commented 3 years ago

Hi, sorry for the delay.

The ESS buffer reports the following logs:

Initial log

(R): ess-dialect=R, buf=temp.R, start-arg=nil
 current-prefix-arg=nil
(inferior-ess: waiting for process to start (before hook)

NORMAL-FILTER:
    --> busy:t busy-end:nil sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:
R version 4.0.3 (2020-10-10) -- "Bunny-Wunnies Fr .... Computing
Platform: x86_64-pc-linux-gnu (64-bit)

NORMAL-FILTER:
    --> busy:t busy-end:nil sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:R is free software and comes with ABSOLUTELY NO WA .... browser interface to help.
Type 'q()' to quit R.

NORMAL-FILTER:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:> 
(inferior-ess 3): waiting for process after hook
NORMAL-FILTER:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:> 
(ess-command if(identical(getOption('pager'),
                                  file.path(R.home(), 'bin', 'pager')))
                        options(pager='cat')
 ..)
ordinary-filter:
    --> busy:t busy-end:nil sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:+ + 

ordinary-filter:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:> 
 .. ok{ess-command} .. exiting{ess-command}
(ess-command local({
                          source('home/.emacs.d/straight/build/ess/etc/ESSR/R/.load.R', local=TRUE) #define load.ESSR
                          .ess.load.ESSR('/home/.emacs.d/straight/build/ess/etc/ESSR/R')
                      })
 ..)
ordinary-filter:
    --> busy:t busy-end:nil sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:+ + + 

ordinary-filter:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:> 
 .. ok{ess-command} .. exiting{ess-command}
(ess-command options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
 ..)
ordinary-filter:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:> 
 .. ok{ess-command} .. exiting{ess-command}
(R): inferior-ess-language-start=options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)

NORMAL-FILTER:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:> 

NORMAL-FILTER:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:t <--
    --> dbg-active:nil is-recover:nil <--
    --> string:> 

(ess-synchronize-dirs)
(ess-command getwd()
 ..)
ordinary-filter:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:[1] "/home/path"
> 
 .. ok{ess-command} .. exiting{ess-command}
 |-> words= '(/home/path)'

ess-view-data-print command

> 
(ess-command ls(envir = .GlobalEnv)
 ..)
ordinary-filter:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:[1] "dt"
> 
 .. ok{ess-command} .. exiting{ess-command}
 |-> words= '(dt)'
(ess-command {library(dplyr); `dt3aq9Xw` <- as_tibble(`dt`)}
 ..)
ordinary-filter:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:
Attaching package: ‘dplyr’

The following objects .... ase’:

    intersect, setdiff, setequal, union

> 
 .. ok{ess-command} .. exiting{ess-command}
(ess-command as.character(nrow(`dt3aq9Xw`))
 ..)
ordinary-filter:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:[1] "10"
> 
 .. ok{ess-command} .. exiting{ess-command}
 |-> words= '(10)'
(ess-command {`dt3aq9Xw` <- `dt3aq9Xw`; local({op.tmp <- options("width", "tibble.width", "crayon.enabled");options(tibble.width = Inf, width = 5000, crayon.enabled = FALSE);print(`dt3aq9Xw`[(0*200 + 1) : min((0 + 1)*200, nrow(`dt3aq9Xw`)),], n = nrow(`dt3aq9Xw`));options(op.tmp)})
} ..)
ordinary-filter:
    --> busy:t busy-end:nil sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:+ 
 .. exiting{ess-command}

NORMAL-FILTER:
    --> busy:nil busy-end:t sec-prompt:nil interruptable:nil <--
    --> running-async:nil callback:nil suppress-next-output:nil <--
    --> dbg-active:nil is-recover:nil <--
    --> string:

Trying to execute the R commands that appear above works flawlessly in the prompt so I am not sure where is the source of the bug.

ShuguangSun commented 2 years ago

May I ask whether the issue is still open?