emacs-ess / ESS

Emacs Speaks Statistics: ESS
https://ess.r-project.org/
GNU General Public License v3.0
613 stars 160 forks source link

Potential Syntax Issue in ess-inf.el #1198

Closed ctrlxctrlc closed 2 years ago

ctrlxctrlc commented 2 years ago

See here for my original stack overflow question.

I have since determined that the cause of this issue is related to the function ess--command-make-restore-function. In particular, when the process property pending-output gets set in inferior-ess-ordinary-filter, it triggers the latter half of the function which resets the process property and sends the output to the old process filter. The problem is that the process property which gets overwritten is pending rather than pending-output. This means that the pending output never goes away and keeps getting sent to the command buffer. I believe that line should be changed:

(defun ess--command-make-restore-function (proc)
  (let ((old-pf (process-filter proc)))
    (lambda ()
      (set-process-filter proc old-pf)
      (process-put proc 'cmd-output-delimiter nil)
      (process-put proc 'cmd-buffer nil)
      (when-let ((pending (process-get proc 'pending-output)))
        (process-put proc 'pending nil) ;; This should be (process-put proc 'pending-output nil)
        (funcall old-pf proc pending)))))

Someone please correct me if I am wrong about the process property pending being incorrect.

mmaechler commented 2 years ago

As I answered there as well, I think you've hit the nail perfectly. Indeed I've also suffered from such extraneous prompts in the console, and now hope they have gone... and maybe even more bugous behavior I had observed the last couple of months -- that would be phantastic! I've committed the change already in my version of ESS, and will push it in a day or so if nothing surfaces.

mmaechler commented 2 years ago

Can you update and confirm the problem is solved? ... and then close the issue?

ctrlxctrlc commented 2 years ago

I have updated locally and can confirm that the problem has not resurfaced.

Thanks for and closing this and merging!