emacs-ess / ess-stata-mode

4 stars 5 forks source link

iESS hangs after sending Stata code with C-<return> #9

Closed djh1202 closed 3 years ago

djh1202 commented 3 years ago

Since updating to the latest ess version from MELPA (20210331.804), sending a line of code from a .do file to the iESS buffer causes it to hang. If I copy and paste a line, or manually type in a command, it seems to run fine.

lionel- commented 3 years ago

When was the last time you updated before that? What does your prompt look like?

djh1202 commented 3 years ago

I think I had updated ess a few days ago. When trying to load a line in Stata, I get this in Messages:

Starting evaluation... Loading line: local sublist all Error running timer ‘ess--idle-timer-function’: (error "Timeout during background ESS command ‘pwd’")

BrendanHalpin commented 3 years ago

The idle-timer-function error is probably due to ess-synchronize-dirsinvoking ess-getwd-command which fails (it returns the "pwd" command in the output buffer, as well as the output). But it happens to me without causing problems with ess-eval-region, so I suspect the problem is elsewhere.

BrendanHalpin commented 3 years ago

I take that back. The error I get is different: "Error running timer ‘ess--idle-timer-function’: (wrong-type-argument stringp nil)".

I can confirm that I get a variety of hangs using MELPA ess-20210331.804, but not with the github ESS.

BrendanHalpin commented 3 years ago

The "variety of hangs" seems to boil down to different ways of invoking ess-command, which causes a low-level hang in accept-process-output.

Debugger entered--Lisp error: (quit)
  accept-process-output(#<process stata> 0.3)
  ess-wait-for-process(#<process stata> nil nil nil 30)
  ess-command("pwd\n" #<buffer  *ess-get-words*> sleep nil nil nil nil nil)
  ess-get-words-from-vector("pwd\n")
  ess-synchronize-dirs()
  run-hooks(ess-idle-timer-functions)
  ess--idle-timer-function()
  apply(ess--idle-timer-function nil)
  timer-event-handler([t 0 1 0 repeat ess--idle-timer-function nil idle 0])
BrendanHalpin commented 3 years ago

This is a problem with the MELPA version, which differs quite a bit from the current Github version of ESS, it's legitimate to suggest using the Github ESS as a solution.

However, it would be good if ess-stata-mode worked for recent MELPA ESS too.

BrendanHalpin commented 3 years ago

@lionel- do you know how far back MELPA ESS is?

djh1202 commented 3 years ago

hmm I still have the issue when I download straight from GitHub.

The MELPA ESS I was using is 20210331.804

lionel- commented 3 years ago

I think that's because ess-command now hard-codes the prompt suffix to >. We should use inferior-ess-primary-prompt instead. I've pushed https://github.com/emacs-ess/ESS/commit/b9ab2969 to fix this. Can you try once MELPA is updated please?

djh1202 commented 3 years ago

seems to be in good shape--thanks!