5

Occasionally, for reasons I can not determine, ess-indent-or-complete sends an input to the R console. In other words, I will be typing something, hit tab to autocomplete (or company autocompletes for me), and the R process will update with a newline (.R file on the left "buffer", R process on the right):

x <- mea█                        | >
                                 |
                                 |

... and then I hit tab to complete "mean":

x <- mean█                       | >
                                 | > ## note the new line here
                                 |

This can be really annoying for at least two reasons:

  1. It fills up the process buffer with blank lines.
  2. If I am using a browser(), it advances lines which is often undesirable.

I have tried to diagnose this myself to no avail. Restarting emacs fixes it every time, however it seems to start happening at random throughout the day. Once it starts it does not stop until emacs restarts.

I am running emacs 27.1, ess-20210818.843 (though this has been a thing for a long time, so I don't believe it is version-specific), and am in ESS[R] mode.

Calling M-: (ess-command "") from my .R file buffer replicates the undesired behavior once it starts happening in a particular session. I have no insight beyond this.

C-x C-c
  • 1,261
  • 8
  • 20
  • can't reproduce this, what OS is this? Windows? What is the value of `comint-process-echoes` (`M-:` `comint-process-echoes`) in your R source buffer? You could try setting that to `t` if it's nil – Rorschach Sep 18 '21 at 15:48
  • OS is Debian 11. It looks like `ess` is changing `comint-process-echoes` from `nil` to `t`. Next time I observe this behavior, I will check to see if something is modifying this this back to `nil`. I will update this thread when I figure that out. – C-x C-c Sep 20 '21 at 14:02
  • For the record, this is still problematic. I believe it may have something to do with sessions where the function `.ess_get_completions` takes too long to run; perhaps as a result of a large search environment. This causes, I believe, the function which cleans the buffer to miss the trailing ">" upon completion of the `R` command. – C-x C-c Feb 28 '22 at 16:02
  • I have rarely also observed this behavior... indeed also with emacs 27.x and was very unhappy about it ... notably as I'm an ESS core member. "Unbelievably" (or not) it was sufficient often just to restart R {quite fast with ESS} something I do often anyway... – Martin Mächler May 09 '22 at 08:24

1 Answers1

1

I think you solved it yourself, with your GH issue suggestion: https://github.com/emacs-ess/ESS/issues/1198

I've changed things in my own version of ESS, and will commit after a few days of testing it.

Thank you VERY VERY much for persevering and (I think) finding the fault .. a simple typo inside the internal (ess--command-make-restore-function)

Martin Mächler
  • 4,619
  • 27
  • 27
  • 1
    Yep - I can confirm that this fixed it. For anyone wondering, see [emacs-ess/ESS #1198](https://github.com/emacs-ess/ESS/issues/1198). Resolved in [e83ac6](https://github.com/emacs-ess/ESS/commit/e83ac622fe7e3cbfc848481a9257e5ed5c7b5afb). – C-x C-c May 21 '22 at 20:25