-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
after turning off tracebug, in debugging, ESS continues to send <newline> to R. #973
Comments
can anybody reproduce, please? NB I have the following in my
the behaviour super frustrating to such an extent that I sometimes need to start an R session outside of ESS (which I then do in a |
Yes, I can reproduce. Haven't had time to investigate yet. If you run into this you could always temporarily enable tracebug ( |
I cannot reproduce unfortunately. With or without tracebug. When I press RET repeatedly stepping happens one by one as expected. |
For me the newline is sent as soon as a type a character, not press RET
…On Sun 23 Feb 2020 at 12:14, Vitalie Spinu ***@***.***> wrote:
I cannot reproduce unfortunately. With or without tracebug. When I press RET repeatedly stepping happens one by one as expected.
|
exactly! For me, it only happens once in a while (it seems), not every time... but it's a "killer": |
I am pretty sure that this is not caused by tracebug in your case. Once you disable it with You can check it at any time with |
There is even more going badly wrong in R's debug() / debugonce() mode, when Here's the 2nd severe problem with turned off ess-tracebug:
## ess-tracebug activated :
> debugonce(paste); paste("a", character(), "b")
debugging in: paste("a", character(), "b")
debug: .Internal(paste(list(...), sep, collapse, zero.length))
Browse[2]> dput(list(...))
list("a", character(0), "b")
Browse[2]> c
exiting from: paste("a", character(), "b")
[1] "a b"
>
## ess-tracebug disabled :
> debugonce(paste); paste("a", character(), "b")
debugging in: paste("a", character(), "b")
debug: .Internal(paste(list(...), sep, collapse, zero.length))
Browse[2]> dput(list(...))
Error in dput(list(...)) : '...' used in an incorrect context
> |
(BTW: This bug seems to happen only for functions where body() does not start with " |
I cannot reproduce the second problem without tracebug. It really doesn't seem related to ESS at all. |
This is still bugging me very regularly. And it has been reproducible by @jabranham ... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@mmaechler I cannot reproduce with tracebug and visibility switched off. Can you reproduce it with a vanilla Emacs? If not, could you try to pinpoint which part of your config makes it reproducible please? |
These newlines are possibly due to background tasks calling |
@mmaechler Can you still reproduce this? If not we can probably close this. |
It became so extremely painful that I reverted to keep tracebug active by default and live with the drawback.. |
I can reproduce! I must have forgotten to turn off tracebug the last time. The problem is that Now this newline check is normally not a problem because we have our prompts set to This check was introduced in 1ff5b8c6. Some thoughts:
I suggest trying this patch: @@ -366,8 +366,7 @@ defined. If no project directory has been found, use
(when-let ((proc (or proc (and ess-local-process-name
(get-process ess-local-process-name)))))
(unless (process-get proc 'busy)
- (or (ess-debug-active-p proc) ; don't send empty lines in debugger
- (when-let ((last-check (process-get proc 'last-availability-check)))
+ (or (when-let ((last-check (process-get proc 'last-availability-check)))
(time-less-p (process-get proc 'last-eval) last-check))
(progn
;; Send an empty string and waiting a bit to make sure we are not busy.
@@ -395,7 +394,7 @@ Return non-nil if the process is in a ready (not busy) state."
;; When "\n" inserted from inferior-ess-available-p, delete the prompt.
- (when (and ready
- (process-get proc 'availability-check)
- (string-match-p (concat "^" inferior-ess-primary-prompt "\\'") string))
+ (when (and ready (process-get proc 'availability-check))
(process-put proc 'suppress-next-output? t))
(process-put proc 'availability-check nil)
(when ready What do you think @vspinu @mmaechler? |
Well, I'm happy you can finally reproduce! Your patch suggestion looks very good to me (without trying it) for principal reasons (you give yourself): Less special casing i.e. more coherent behavior.... and the prompt detection business needs to become even more fail proof .. I also agree on that (says the one who's not really contributing currently apart from bug reporting... ) |
Here is a reprex that we should add as unit test: # (1) Disable the newline check
# (2) Trigger eldoc or company after evaluating this to cause a hang
{
cat(paste0(
"Next line looks like a prompt\n",
getOption("prompt")
))
Sys.sleep(10)
} IIUC this is the reason that we have this newline check. It is a protection measure against what we could call "fake prompt hangs". |
I'm still seeing a lot of newlines inserted into the inferior buffer at random times when I'm not evaluating anything. Not sure whether this issue was considered resolved. |
Because of the
source(*, echo=TRUE)
breaking bug, I've turned off tracebug completely in ESS for the time being. Now, e.g.,(which reveals a bug in current R-devel from one my own recent commits !),
then in the debugger, typing 'n', occasionally inspecting variables, or typing
ls.str()
,I several times have ESS sending
<newline>
or<enter>
to R "behind my back"; here's part of a transcript (using R 3.6.2 where ts() does not show any bug, of course):note in the last 6-7 lines above, that two of them have
debug: <.. R code ..>
and these were caused by ESS entirely, without me any typing at all; so there were line advances that I did not cause by typingEnter
(aka "return" aka "newline") orn
at all.The text was updated successfully, but these errors were encountered: