11 comments

  • dakra6 hours ago
    Hi! Maintainer of Ghostel here.<p>baokaola and I actually wanted to do a &quot;Show HN&quot; next week, but looks like someone was faster submitting the link.<p>Have a look at the GitHub repo which is a bit nicer for a quick overview: <a href="https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel</a><p>To add some context, Ghostel is a terminal emulator for Emacs powered by libghostty-vt.<p>There&#x27;s a feature comparison vs vterm and eat: <a href="https:&#x2F;&#x2F;dakra.github.io&#x2F;ghostel&#x2F;#ghostel-vs-vterm" rel="nofollow">https:&#x2F;&#x2F;dakra.github.io&#x2F;ghostel&#x2F;#ghostel-vs-vterm</a><p>And here is a gist with images to compare performance and correctness: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;dakra&#x2F;4a0b76ebcf5d52338e13486437846574" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;dakra&#x2F;4a0b76ebcf5d52338e134864378465...</a><p>But for me personally, it has not only replaced vterm&#x2F;eat but also any other external terminal like kitty&#x2F;Ghostty.<p>Having your terminal text just like a normal Emacs buffer opens up so many possibilities and extension points that are just not available on any other terminal.<p>Even simple stuff like searching in the scrollback, then navigating and selecting+copying a paragraph only with the keyboard. For every Emacs user that&#x27;s so natural and fast in Ghostel while often cumbersome in other Terminals where I just reach to the mouse because it&#x27;s easier.<p>Happy to answer any questions and also like to hear feedback positive or negative.<p>If you&#x27;re an Emacs user and tried Ghostel and are still using Ghostty (or another external Terminal), is there something Ghostel is missing or is it just because you want some processes to run outside of Emacs?<p>baokaola and I are also very active on GitHub, so feel free to open an issue if you have any.
    • aardvark1792 hours ago
      I think the thing that stops me from running more processes inside emacs is that a large diff parse from magit or similar can block everything, and so I end up keeping a separate terminal around anyway.
      • mort961 hour ago
        Huh is that true? Does running a command in a terminal buffer block all of EMacs? That&#x27;s extremely surprising, the main use of these kinds of integrated terminals for me is to compile and run which means long running commands. Is this use case fundamentally not supported due to EMacs&#x27;s architecture?
        • aardvark1791 hour ago
          No, running a command in a terminal buffer doesn’t block the emacs UI, but a long running bit of elisp running in emacs can block the UI.
    • b3n5 hours ago
      Hi dakra!<p>&gt; is there something Ghostel is missing<p>eshell allows me to manipulate text as I would in any other Emacs buffer. If I have a function which wraps a word in quotes, and bind it to a key, I can be confident it will work in eshell like it does anywhere else. It&#x27;s a real killer feature. If I use evil-mode, or xah-fly-keys, or simply want to use ispell to correct the spelling of a word, it all works.<p>Unfortunately with Ghostel none of this works. It&#x27;s not integrated in the same way. There are extensions like evil-ghostel-mode, but they are limited.<p>Are there any plans to improve this, or is it a limitation Ghostel has to live with?<p>A Ghostel equivalent of eat-eshell-mode would be amazing.
      • dakra4 hours ago
        Did you see ghostel line-mode? This basically gives you a `M-x shell` experience where everything is a buffer and nothing is send to the terminal until you press enter.<p>There you could type on the prompt line and then call jinx or your quote wrapping function etc as it&#x27;s just a normal Emacs buffer. You can&#x27;t edit the scrollback buffer though, but I don&#x27;t think that&#x27;s possible in eshell either.<p>But line-mode has it&#x27;s own set of problems. Since we don&#x27;t send anything to the shell, you could have some problems with autocomplete or similar things that change the text depending on each typed char. Similarly we automatically disable line-mode when you enter a TUI (alt-screen) app, as line-mode doesn&#x27;t make too much sense in e.g. vim. But that&#x27;s configurable and you can still force line-mode, it really depends on the TUI apps.<p>We try to support as much as possible and work around things like fish autocomplete etc. But please try and report any issues you find.
        • accelbred3 hours ago
          Editing scrollback is possible in eshell, and something I use often.
          • dakra3 hours ago
            Ah. I tested it before but now I see that I have `(setq eshell-scroll-to-bottom-on-input &#x27;all)` in my config which always snapped point back to the prompt when I tried to edit the scrollback.<p>Anyway, unfortunately that is not possible in a Ghostel buffer and most likely also will never be. I&#x27;m open to ideas though how we could improve or replicate your eshell workflow.<p>But also, eshell is awesome and Ghostel is not a replacement for it. It&#x27;s more a replacement for term.el, maybe shell.el (with line-mode) and other terminal packages like eat and vterm.
            • MarsIronPI2 hours ago
              I think issue #426[0] would be sufficient, since it would allow for editing after the command is finished. I understand that it probably won&#x27;t happen any time soon, but embedding a full terminal emulator in Eshell is the thing that&#x27;s got me staying on EAT right now.<p>Ghostel looks really nice though!<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel&#x2F;issues&#x2F;426" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel&#x2F;issues&#x2F;426</a>
    • arikrahman3 hours ago
      Howdy,<p>Awesome project. Been using with doom for a while. How do you manage to get scrolling programs to work (eg Lazygit or Reasonix) where other emulators fail? Is it something special in your implentation or library that makes this work?
      • baokaola1 hour ago
        Are you thinking about using the scroll wheel of the mouse to scroll within the program? If the appropriate terminal modes are enabled by the application running in the terminal, we capture the scroll events in Emacs and forward them to the terminal instead of letting Emacs handle them.
    • sigbottle4 hours ago
      How was integration for you guys? Was the integration easier for you guys since you have an established emacs system consuming terminal output with reasoned semantics over what goes where for existing subsystems (rendering, osc codes, etc)?<p>For libghostty-vt, since you&#x27;re targeting a terminal TUI instead of an external subsystem (for example; for ghostty, you hit libghostty-vt -&gt; GPU rendering, which is external), you still have to buy into terminal semantics. <i>in my experience</i>, since I was trying to replicate mosh with libghostty-vt as the parser, what happened was that my optimized re-rendering kept getting increasingly coupled to terminal semantics (and the UDP state update model too), otherwise I&#x27;d have to send the entire terminal grid over the network like, every time.<p>What are the tricks for making this both performant and not like, utter cancer? You have a harder issue here too (similar to tmux) in that certain optimizations are just not available to you, or you have to translate (literally geometrically) certain instructions
      • baokaola4 hours ago
        I&#x27;m not entirely sure what you&#x27;re asking. But I&#x27;ll answer to the best of my abilities:<p>For Ghostel, libghostty-vt is the source of truth and the architecture is essentially that we serve input to the PTY and the PTY serves output to libghostty-vt which builds out the state in the form of a terminal screen structure. The goal is then to keep the contents of an Emacs buffer up to date to this terminal screen without replace the entire thing every time we redraw. We make use of mainly two things in order to do as little work as possible: - Scrollback is immutable and thus never has to be modified unless it&#x27;s evicted, alt screen is activated, dimensions change etc. - libghostty-vt maintains row level dirty flags that we scan to make sure we&#x27;re only replacing lines that have actually changed.<p>So for the rendering part, we&#x27;re only diffing the grid state against the buffer, not doing anything based on terminal semantics per se, parser events that draw to the screen are passed straight to the terminal handler. But of course, certain things we need to hook into such as directory and title changes, of clipboard events etc.<p>Might also add that we&#x27;re using the direct Zig API, not the C API, which means we have access to things that aren&#x27;t exposed in the C API.
  • LtdJorge5 hours ago
    I think the title should mention Emacs somewhere. A terminal emulator is different than a terminal emulator for Emacs.
    • dakra4 hours ago
      I agree.<p>And I would also prefer if the link went to <a href="https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel</a> instead of the documentation which is not that helpful if you don&#x27;t know what the project is.
    • canthonytucci4 hours ago
      .el = emacslisp file extension
      • lucasoshiro2 hours ago
        I know this only because I&#x27;m an emacs user. Outside that niche .el is an obscure file extension, so, no, it&#x27;s not that obvious
  • jdormit7 hours ago
    I recently switched from vterm to ghostel, and it is generally much, much better - noticeably faster (e.g. fancy TUI apps that try to refresh the whole terminal every frame actually work), more reliable input handling, and a nicer ELisp API.<p>That being said, there are still some rough edges. Sometimes it fails to properly clear the terminal, leaving junk at the top of the buffer before the currrent prompt line. And on a couple of occasions it has totally frozen, with no fix other than killing the buffer and starting over.<p>Overall, it’s very promising and totally usable as a daily driver, but it needs a bit of polish and bug fixes before I would consider it mature.
    • baokaola7 hours ago
      Ghostel co-maintainer here: Understand if you don&#x27;t have a repro, but if you ever have something actionable we&#x27;d love it if you filed an issue, or have the information get to us some other way.<p>The junk at the top of the screen sounds like it could be <a href="https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel&#x2F;issues&#x2F;495" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel&#x2F;issues&#x2F;495</a> and it should be fixed on later versions. But maybe you&#x27;re seeing another bug. The tricky part is replicating the libghostty-vt internal data into an Emacs buffer while only replacing the parts that need to be replaced. We have property based tests to exercise this a lot, but sometimes things slip through.<p>The latest released version as I&#x27;m writing this should have improved lifecycle handling, so maybe it also fixes some of your issues.<p>As you say, the project is still in the early phase so hopefully, we can iron things out over time.
      • jdormit3 hours ago
        &gt; The junk at the top of the screen sounds like it could be <a href="https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel&#x2F;issues&#x2F;495" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dakra&#x2F;ghostel&#x2F;issues&#x2F;495</a> and it should be fixed on later versions<p>Yes, that sounds like the same issue. I’ll update to the latest version and see if it’s resolved. And thanks for your work on this package, it’s been a real game-changer for me!
      • pingisland5 hours ago
        I also switched from vterm and ghostel is much more responsive for me. Thanks for maintaining it! I use it everyday.<p>I do see a similar issue, where when I switch to the ghostel buffer and it wasn’t visible before, the text is scrambled. I’ll check if I can find a way to reliably reproduce it.
        • baokaola5 hours ago
          This is a known issue that I&#x27;ve been chasing myself. It most likely has to do with the fact that we cannot render hidden buffers (for reasons) so when the buffer reappears again, we have hooks to refresh it. But sometimes it fails to refresh fully.<p>When are you mostly seeing this? With agent TUIs?
  • varjag4 hours ago
    Been using it for bit over a month now. It&#x27;s really nice that you can click on code references in Codex summaries and open them right there in Emacs buffers.
    • dakra40 minutes ago
      And not only mouse click of course, but you can use `ghostel-previous-hyperlink` (or ghostel-next-hyperlink) to quickly jump to the last hyperlink displayed.<p>It also installs a repeat-mode map, so if you see 3 url or file links as output you can just `C-c C-p p p RET` and it will open the first link.<p>I use that feature all the time.
  • parentheses4 hours ago
    Ghostty has crashed nightly for me with ~10 terminals open across a few windows. So, I haven&#x27;t been able to run it nor would I want to embed it inside anything I daily drive.
    • adrian_b3 hours ago
      I am running Ghostty 1.1.3, on Gentoo Linux.<p>I have opened right now about a dozen Ghostty windows and about 20 tabs in each window, i.e. more than 100 shell instances.<p>I have started in as many of them as I could, before becoming too bored, a &quot;ls -lR&quot; on a file system with many millions of files.<p>I could not see any problem, much less any crash. I have been using Ghostty for a few months, very intensively, all day long, and I have not seen any crash or other suspicious behavior.<p>If you have seen a crash, perhaps there was either some specific version of Ghosstty that had a bug, or, more likely, some weird interaction with some other software that you have, and which might be buggy, e.g. the GPU driver. (I am using an NVIDIA GPU.)
      • coffeeindex3 hours ago
        Just commenting to say I&#x27;ve had the same experience. Been using Ghostty since (I was aware of) its release and it has been buttery smooth ever since. I occasionally see people talking about crashing or other issues they&#x27;ve had with Ghostty but I&#x27;ve not seen anything of the sort.
    • vinniepukh3 hours ago
      cool story bro. feel free to make a github issue. I&#x27;ve been daily-driving Ghostty for years and i don&#x27;t remember the last time it crashed on me.
  • aftergibson7 hours ago
    This is working great, it plus the Claude code integration has really adjusted how much I use Emacs. It&#x27;s become a bit of a hub for me now.
    • 4b11b42 hours ago
      What do you mean by integration. Do you have a model driving emacs via server?
      • baokaola1 hour ago
        Maybe he&#x27;s talking about claude-code-ide.el which piggybacks on Claude Code&#x27;s IDE integration. It recently added support for Ghostel too.
  • vijucat5 hours ago
    Question: if I don&#x27;t use TUIs or millions of lines of scrolling text, what am I missing by not using these newer terminal implementations? I use mintty on Windows and am pretty happy with it.
    • ireadmevs2 hours ago
      For me is the ability to maintain the same keyboard workflow, no matter if I’m dealing with files or terminal (switching buffers, navigating&#x2F;searching&#x2F;selecting&#x2F;copying&#x2F;pasting text, etc.), I get to keep the same set of shortcuts and mental model. And i get to do some small automation on top of it with elisp, which I already do for the rest of my editor anyway.
    • adrian_b4 hours ago
      Exactly as you say, the greatest difference with the recent generation of video terminal emulators that use the GPU through OpenGL or the like, is the much greater rendering speed, which becomes very noticeable with millions of lines of scrolling text, especially if you use high-resolution monitors.<p>Unfortunately, millions of lines of scrolling text are no longer unusual, especially when you frequently compile big software projects. The use of high-resolution monitors has also been normal for many years.<p>Instant window rendering is addictive, so now I would never return from a fast terminal emulator like ghostty to an older video terminal emulator. The last terminal emulator that I had been using before ghostty was kitty, which was also pretty fast in comparison with traditional terminal emulators, but I like ghostty more.
      • vijucat2 hours ago
        Thank you, very interesting!
    • JoeBOFH5 hours ago
      Honestly not sure. I used ghosty and others for awhile but had continuous issues of it not passing a compatible term variable so a lot of tuis would break.
      • adrian_b4 hours ago
        This is normally a problem only when connecting to a remote computer through ssh, if you have not installed there the terminfo entry for ghossty or kitty or whatever recent video terminal emulator you are using.<p>If you do not want to or you cannot install the terminfo data, there is the easy workaround to put in your shell initialization script on the remote computer something like &quot;export TERM=xterm-256color&quot;.<p>Ghostty aims to be completely compatible with xterm, so everything should work fine after setting thus TERM, only the newer features of ghostty will not be available.
      • homebrewer1 hour ago
        <a href="https:&#x2F;&#x2F;ghostty.org&#x2F;docs&#x2F;features&#x2F;ssh" rel="nofollow">https:&#x2F;&#x2F;ghostty.org&#x2F;docs&#x2F;features&#x2F;ssh</a>
  • ivanjermakov6 hours ago
    &gt; The native module is a prebuilt binary that auto-downloads on first use<p>Why? Keep it a part of distribution.
    • dakra5 hours ago
      That&#x27;s because MELPA (and ELPA) doesn&#x27;t have a way to attach platform specific files. It&#x27;s all just git checkouts.<p>That means we would have to check in the module binary for all platforms (&gt;10MB together) if we want that it comes with the distribution.<p>Also looking at e.g. jinx, another popular package that uses Emacs native modules, it does it like vterm and offers to compile on first usage.<p>So as a Emacs package author, for a user friendly installation you can realistically only offer to download or compile on first use.
  • freedomben9 hours ago
    [dead]
  • zyralab3 hours ago
    [flagged]