Skip to content
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

Haskell Interactive Shell Stuck in Insert Mode? #445

Closed
ranjitjhala opened this issue Jan 17, 2015 · 20 comments
Closed

Haskell Interactive Shell Stuck in Insert Mode? #445

ranjitjhala opened this issue Jan 17, 2015 · 20 comments
Labels

Comments

@ranjitjhala
Copy link
Contributor

Hi, when I create a haskell interactive shell with spacemacs, it fires up the shell (C-c C-l) but then when I enter stuff nothing happens. (It behaves as if the shell is read-only.) Does anyone know how to fix this?
(I should add: after some apparently random set of keystrokes, it starts working again!)

Screenshot:
http://goto.ucsd.edu/~rjhala/emacs.png

syl20bnr January 14 2015 @ranjitjhala you are in insert state when it happens ?

@syl20bnr
Copy link
Owner

Evil has its own input function, I'm pretty sure it override the input function for the haskell interactive shell.
It is weird that you still can send some inputs to the shell though.

@ranjitjhala
Copy link
Contributor Author

Yes some random pounding of the keys gets it to work properly (for a while,
after which some other keys again disable it) am still trying to reproduce!

On Sat, Jan 17, 2015 at 11:35 AM, Sylvain Benner notifications@github.com
wrote:

Evil has its own input function, I'm pretty sure it override the input
function for the haskell interactive shell.
It is weird that you still can send some inputs to the shell though.

Reply to this email directly or view it on GitHub
#445 (comment).

Ranjit.

@meditans
Copy link

Hi Ranjit, you could try this and tell me if this solves the problem.
Do you see that in your screenshot you're cursor is not quite at the end of the light grey area? I found that when the cursor is inside the grey area, <Enter> doesn't work right. So here's what I do: I clear the prompt with C-c C-k, and then press A to be sure to append to the end of the prompt. Then I insert the expression, and <Enter> does his job.

Hope this helps
Carlo
ps. liquid haskell is great!

@ranjitjhala
Copy link
Contributor Author

Dear Carlo,

THANKS! this seems to be working for me -- actually, just the C-c C-k seems
to work perfectly. As an added bonus, I managed to reproduce the problem
quite deterministically:

When the shell starts up, it is like this -- let me write '#' to indicate
cursor position:

ë> #

Now I can enter things and it works fine:

ë> 2 + 1
3

ë> #

But now if I hit the LEFT cursor (not backspace), so that the cursor
"touches" the '>'

ë>#

Then it goes into the STUCK mode

ë> 23 + 123#

where hitting RETURN has no effect (I can edit the text but cannot actually
send).

However, I find that C-c C-k at this point clears everything and resets
stuff so I can use it again! (I guess it would be nice to not have to reset
the buffer since I wanted to keep a "log" but still, this is nicely getting
the job done.)

So thanks again!

  • Ranjit.

PS: Also, thanks for the kind words re: LiquidHaskell; am in another issue
trying to
cleanly add support for a LiquidHaskell layer to spaceemacs.

On Sun, Jan 25, 2015 at 5:35 AM, Carlo Nucera notifications@github.com
wrote:

Hi Ranjit, you could try this and tell me if this solves the problem.
Do you see that in your screenshot you're cursor is not quite at the end
of the light grey area? I found that when the cursor is inside the grey
area, doesn't work right. So here's what I do: I clear the prompt
with C-c C-k, and then press A to be sure to append to the end of the
prompt. Then I insert the expression, and does his job.

Hope this helps
Carlo
ps. liquid haskell is great!

Reply to this email directly or view it on GitHub
#445 (comment).

Ranjit.

@meditans
Copy link

Hi Ranjit, if you want to retain the log of your computation, you could try this way: instead of hitting C-c C-k to clear the log, when you are in stuck mode, just move with the arrows towards the end of the grey area, then write a new expression; I'll show you an example, the cursor is | and the end of the grey area is #:

λ> "foo"| #

As you noted, here you are in stuck mode because there is a space between your cursor and the end of the grey space. However, cancel that "foo" expression, move as far as you can to the right with the arrow, and then write the new expression and hit enter. That should work, as far as I tried.

Hope this helps
Carlo

ps I'll have a look to the other issue and see if I can do anything, although I'm pretty new at spacemacs, so no guarantees :)

@syl20bnr
Copy link
Owner

Also I suggest to always stay in insert state and when you need to use the spacebar to enter a shortcut do C-o SPC, C-o executes the next command in normal state.

@syl20bnr
Copy link
Owner

Also see the shell section of the doc: https://github.com/syl20bnr/spacemacs/blob/master/doc/DOCUMENTATION.md#shells

@syl20bnr
Copy link
Owner

syl20bnr commented Mar 3, 2015

I consider this question answered. @ranjitjhala feel free to reopen if needed.

@syl20bnr syl20bnr closed this as completed Mar 3, 2015
@ranjitjhala
Copy link
Contributor Author

Yes, thanks!

On Mon, Mar 2, 2015 at 8:39 PM, Sylvain Benner notifications@github.com
wrote:

Closed #445 #445.

Reply to this email directly or view it on GitHub
#445 (comment).

Ranjit.

@PierreR
Copy link
Contributor

PierreR commented Apr 11, 2015

This actually happens whenever I go to the source buffer and press , c b to reload the buffer.

The "Interactive Haskell" buffer is kind of stuck and the described workaround works nicely.

I really don't understand what's the purpose of the stuck mode ? It is terribly annoying.

Is this a bug ? Any hope for a real fix ?

@syl20bnr syl20bnr reopened this Apr 11, 2015
@bogdanteleaga
Copy link
Contributor

This does not work at all for me on the current version of spacemacs. Using Spc-m-s-S in a haskell buffer does bring up the interactive shell. Pressing doesn't work, nor does haskell-interactive-mode-return. I tried the suggestions above to no avail

@bogdanteleaga
Copy link
Contributor

I just realized that a cabal project is needed for this repl to work. Everything's fine now.

@syl20bnr
Copy link
Owner

syl20bnr commented Oct 5, 2015

Closing this issue since the original issue has been resolved. Fell free to open a new issue about stuck-mode.

@syl20bnr syl20bnr closed this as completed Oct 5, 2015
@PierreR
Copy link
Contributor

PierreR commented Oct 5, 2015

Well the issue has never been resolved. Why not removing the "question label". What is described here is a real bug. What has been given is a workaround.

Anyhow if you really think it's best to open a new issue, let's do it ;-)

PS: The link to the documentation for shell is broken. I have had a look here but I cannot find a mention about a stuck mode.

@d12frosted
Copy link
Collaborator

I tried to reproduce it and it's really easy to do. As @meditans suggested, the problem is when you type in the 'grey' area. To reproduce it you can just open REPL, enter normal mode (cursor will move into grey area) and then hit i to return to edit mode. On the last action cursor stays at the old place instead of moving to the right position.

evil-haskell-repl

So yeah, it could be annoying.

@autosquid
Copy link
Contributor

Totally agree with @PierreR , this issues should not be closed since it is just not solved.

@d12frosted
Copy link
Collaborator

@autosquid please, check the section about stuck REPL in README file. For more info, checkout #3271. What do you think about described workarounds?

@autosquid
Copy link
Contributor

@d12frosted thx for pointing out what is in the readme. This is a workaround, it does not solve the issue completely. And, if it is effective enough I think it should be directly added to the layer code, but not in user-config () area.

The layer should behave right after it is installed in best cases. The must to-add snippet is same for everyone, and I do not think it makes sense to leave it to users.

@d12frosted
Copy link
Collaborator

The must to-add snippet is same for everyone, and I do not think it makes sense to leave it to users.

I can't fully agree with this, because there are two different workarounds for this problem and you can even use them both at the same time. I don't know which 'fix' is preferable by most users and I fear that different users prefer different solutions. In any case, haskell-mode has a convention about how you use REPL - you must not write between λ> and one space character. It's possible to do, but then you might think that REPL is stuck - it might confuse you for the first time, but then you get used to it. I understand that evil users might want to avoid this problem totally (so they even don't need to open troubleshooting section in readme file), that's why I opened #3292.

So I even don't know what to do with this issue. @TheBB, @syl20bnr what do you think about it? With regards to new discussion entries.

@TheBB
Copy link
Collaborator

TheBB commented Oct 20, 2015

As far as I'm concerned this issue arises from poor coding in the Haskell mode package. There are a million REPLs and only one (it seems) with this problem. We can only offer workarounds, and a default workaround is still a workaround. Added to this, as you said, both come with drawbacks that many will find equally as jarring.

It will take some time for me to figure out the proper solution to this issue, though, but I'm fairly sure it will end up upstream and not here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants