szermatt / mistty

Shell/Comint alternative with a fully functional terminal for Emacs 29.1 and later.
GNU General Public License v3.0
102 stars 5 forks source link

Hangs on startup #9

Closed candera closed 1 year ago

candera commented 1 year ago

I installed mistty from elpa with use-package and ran mistty. A new buffer appears, but it has no content, and typing anything in it does nothing except echo the input. In short, it's acting like it's waiting for the shell to start. I can still use emacs normally otherwise.

OS X 14.0 Emacs 29.1

szermatt commented 1 year ago

Thank you for the bug report! I'd need more information to debug. I'm also running macos 14.0 and Emacs 29.1. There must be more than that.

  1. M-x customize-option mistty-backlog-size and set it to 100
  2. M-x mistty
  3. M-x mistty-start-log

For details, see https://mistty.readthedocs.io/en/latest/contrib.html#reporting-issues

szermatt commented 1 year ago

Another thing, if you go to the buffer mistty tty *mistty* (note the space at the beginning; this is a hidden buffer), what do you see?

candera commented 1 year ago

In a shell buffer:

~ candera@brightmoon $ echo $SHELL
/usr/local/bin/bash
~ candera@brightmoon $ /usr/local/bin/bash --version
GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin22.1.0)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

mistty-backlog-size is not customizable, but I set it via setq. Here's what I get:

[*Help*] 0.000 Log enabled

That's it.

The mistty tty *mistty* buffer contains only this:

~ candera@brightmoon $ 

Thanks.

szermatt commented 1 year ago

Ok, so there's nothing really special about your shell or setup.

Please try calling M-x mistty-start-log again from the (empty) *mistty* buffer. You called it from the *Help* buffer; that's why it was empty.

candera commented 1 year ago

Ah, my bad.

[*mistty*] 0.000 refresh (quick)
[*mistty*] 0.025 Long-running command ON (mistty-overlays)
[*mistty*] 2.098 RECV[^Z//Users/candera^M^J]
[*mistty*] 2.142 RECV[^[[?2004h^[[33m~^[[0m ^[[32mcandera@brightmoon^[[0m ^[[97;1m$^[[0m ]
[*mistty*] 8.125 Log enabled

I do have a multiline prompt. I seem to recall reading this may cause issues.

szermatt commented 1 year ago

Thank you! I see what's wrong, now! Please go to M-x customize-option mistty-detect-foreign-overlays and turn the option off.

You seem to have a package enabled that adds overlays to the MisTTY buffer, which MisTTY then interprets as a signal to let that other package do its work.

I'd be very curious in knowing what it is, can you think of one of your packages that would do that? Maybe I can make it work with MisTTY. At the very least, MisTTY could handle this case better.

For background, see https://mistty.readthedocs.io/en/latest/usage.html#long-running-commands

A multi-line prompt should be fine; I always had a multi-line prompt while developing and testing MisTTY.

candera commented 1 year ago

That did indeed fix it, thanks. I'm not sure which package it is, though: I have rather a lot and a search would take a while.

I am seeing issues with my prompt not looking quite right (see image, issue is control characters), but I can open a separate issue if you prefer.

Untitled

szermatt commented 1 year ago

I am seeing issues with my prompt not looking quite right (see image, issue is control characters), but I can open a separate issue if you prefer.

Yes, please open another issue with more details.

As for the prompt not looking right: Different terminals handle different sequences; what works in one will not necessarily work in another. It's not very well standardised.

MisTTY uses Emacs term.el (TERM=eterm-color), which has its own set of supported and unsupported terminal sequences. Please include details on how you wrote that prompt, so we can find the right terminal sequences for term.el for what you want to do.

Generally, ANSI CSI sequences are well supported by all terminals.

candera commented 1 year ago

Great, thanks. I will open another ticket.

johanwiden commented 1 year ago

Great! With this change mistty started working in Android emacs too.