emacs-ess / ESS

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

Windows 7: ESS hangs when starting julia on "Cannot read history file c:/.../.juliahistory" #162

Closed bwbell closed 6 years ago

bwbell commented 9 years ago

Emacs version: 24.4.1 ESS version: 15.03 Julia version: 0.3.7

As described in issue #27, upon typing "M-x julia RET", emacs prints the message "Cannot read history file c:/.../.juliahistory" and hangs.

Typing "C-g" unhangs emacs, and then one can type "C-x b julia RET" to switch to the now running Julia buffer. However, that buffer does not display the julia prompt. (there is no cursor, no ">" sign, nothing to indicate when julia has finished running a command, or indeed that julia is actually running. screenshot 2015-04-20 10 59 57-c

revereche commented 9 years ago

Also experiencing this issue. The REPL ostensibly works, despite the lack of a prompt -- basic code evaluates appropriately -- but I can't use C-c C-l because I'm told there is "no history." Importing Gadfly also fails.

ajsteven130 commented 9 years ago

I can confirm this as well on Windows 7 with Emacs 24.5.1 and ESS 14.1.1

vspinu commented 9 years ago

ESS cannot work without prompt. If this is configurable you should configure julia to send prompt, otherwise it sounds like a julia bug on windows. Does the prompt appear when you invoke julia from emacs shell?

ajsteven130 commented 9 years ago

There is no prompt (however the repl works) when Julia 0.3.8 is invoked in eshell on Emacs 24.5.1 on Windows 7. When powershell is used in emacs, it gives ERROR: prompt not defined.

In both cmd and powershell using the native windows applications, the prompt works just fine.

For ESS, the prompt issue is, to me, a minor problem compared to the fact the Emacs hangs when julia is invoked from ESS.

Please let me know if there is any other information you could use. Alternatively, if you could provide some information about how the prompt should work, I can see about opening up an issue in the Julia Repo

vspinu commented 9 years ago

For ESS, the prompt issue is, to me, a minor problem compared to the fact the Emacs hangs when julia is invoked from ESS.

Missing prompt is the cause of the hang. Fixing the prompt will fix the cause. It's julia bug. If you can reproduce it in emacs shell, please go ahead and report to julia folks.

Alternatively, if you could provide some information about how the prompt should work,

The prompt just should be there as it is on non-Windows platforms and in Windows' cmd.

adouzzy commented 9 years ago

I think it looked for the wrong file. Mine history file is called .julia_history not .juliahistory

mmaechler commented 6 years ago

I propose to close this soon:

nikoltoll commented 6 years ago

I still experience a variant of the bug with julia 1.0.0 on windows 7.

Running julia from an eshell results in an empty buffer (no prompt). It does however allow input of commands and sending commands from a .jl file resultin in output (still without prompt).

input x = [1,2,3,4]; output x = [1,2,3,4]; 4-element Array{Int32,1}: 1 2 3 4

Starting julia with M-x julia will hang, but C-g will interupt resulting in a working julia described as above.

habamax commented 6 years ago

The same is on win10 and julia 1.0.0

jabranham commented 6 years ago

Can someone who experiences this check if #651 fixes the issue for you?

jabranham commented 6 years ago

Since that was merged, if you get ESS from MELPA it should (hopefully) be fixed in the next MELPA update, which usually takes between 1 and 6 hours.

habamax commented 6 years ago

So the history file issue was solved (for me) but I still have to press C-g:

image

habamax commented 6 years ago

I have try to bisect the issue with debug messages and found out that it is ess-wait-for-process function hangs in the loop:

  (while (or (accept-process-output proc wait)
             (unless (and sec-prompt (process-get proc 'sec-prompt))
               (process-get proc 'busy)))
    (when force-redisplay
      (redisplay 'force))
    (when (> (- (float-time) start-time) .5)
      (setq wait .5)))

For me this part:

                 (unless (and sec-prompt (process-get proc 'sec-prompt))
                   (process-get proc 'busy))

is alway True.

habamax commented 6 years ago

Looks like process-get proc 'busy never returns nil.

The only place I found it could be set up as nil is inferior-ess-output-filter. Which is never called when I start M-x julia.

I presume it should be called by a "callback" from within (set-process-filter proc 'inferior-ess-output-filter) but my knowledge is quite limited.

vspinu commented 6 years ago

If you press C-g, do you see the end promt from julia?

The busy state is reset once first prompt is detected. Looks like there is none in your case.

I think there should be timeout there and the buffer should be shown immediately to the user. I will fix this before the release.

habamax commented 6 years ago

If I press C-g, emacs just unhangs. Nothing happens in terms of prompts etc. Just the same window as before calling M-x julia.

But the julia process is running -- I can see it with list-processes. image

vspinu commented 6 years ago

There is a *julia* buffer somewhere in the background. You can switch to it and check for issues.

chrchr commented 5 years ago

I am still experiencing this issue with ess 20190209.1549, Windows 10, Emacs 27.0.50. Can anyone confirm that it's working for them?

jabranham commented 5 years ago

There's a bug in julia on Windows that prevents ESS from working. Long story short, julia on windows doesn't seem to print the prompt. #715 for more details.