1. 48

  2. 5

    Very interesting! Process output latency has bothered me numerous times in Emacs.

    Does your change also make M-x compile output faster?

    Are you going to upstream your change?

    1. 13

      Yes it does. Pretty much anything in emacs that uses a PTY for the subprocess is improved by this (process-connection-type does default to true, which makes it the default type for a process unless the developers explicitly opt in to it being a regular pipe.) It might have some benefits when the process-connection-type is nil, but I haven’t tested that extensively.

      I’m planning on trying to upstream it once I extend it to work with the rest of the subprocess types for emacs. Currently, I’m not handling network and pipe subprocesses with the background thread.

    2. 3

      I assume yes but I didn’t see this mentioned: is there still backpressure? I assume you don’t want the background thread to buffer data forever and make emacs OOM if the command runs too much faster than eshell can consume its output for too long.

      1. 4

        Yes, this is still back pressure at the background output thread level. The nice thing about this though is it’s back pressure at a larger size instead of 1024 byte back pressure.

      2. 2

        Eshell was always frustrating so I tend to always use ansi-term when inside Emacs, but even that one has issues because of how wonky the terminal is with evil-mode for me (difficulties escaping insert mode, or difficulties coming back into focus with insert mode).

        Very cool patch and I hope others get use out of it.

        1. 10

          Try https://github.com/akermu/emacs-libvterm, it’s much better than ansi-term.

          1. 4

            Makes sense, the interop with evil mode is one of the reasons I use eshell over a different terminal emulator.

            This change also speeds up ansi-term because that also uses a PTY to communicate with emacs.

            I probably should’ve emphasized that more in the blog post originally, since it’s really improving subprocess output handling across all of emacs.

          2. 2

            Tried giving it a build, basically git clone ... && cd ... && guix shell --development emacs -- {./autogen.sh, ./configure, make}, but get this error here: https://pastebin.com/raw/7x1Q0AdF Probably the first build that isn’t on a Mac ¯_(ツ)_/¯

            And with that said, this is awesome! I haven’t the faintest idea how this part of the stack works and wouldn’t have known where to start, or even been able to recognize the fundamentals of what the issue was and how to approach it– there’s a kot of background and work in that commit! Are the benefits limited to MacOS, or generalizable to other Unix’s?

            1. 2

              hmm, i just tried it on a ubuntu (18.04/bionic) machine, and seems to compile and work just fine.

              1. 2

                Promising! Knowing that works on 18.04 helos a bunch. I’ll take a another look when I have a second, and should probably roll back to upstream and make sure I can build that anyways :p

                1. 1

                  Definitly is that commit, but it looks like they’re on the case c:

                  1. 1

                    oh, i am really sorry there were minor modifications that i had to make, for that to work, specifically:

                    make `PROCESS_OUTPUT_MAX` a macro and
                    make `FD_COPY(...)` also a macro

                    lemme know if you care about the diffs etc.

                    1. 1

                      Oh, no problem! C just ain’t something I’m familiar with yet, and those diff’s will be upstream soon enough c:

            2. 2

              I was wondering if this patch would make vterm output faster as well?