Skip to content

Instantly share code, notes, and snippets.

@martinbaillie
Created June 17, 2022 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinbaillie/0f5e627c42df32aa8a2d7985663ceeaa to your computer and use it in GitHub Desktop.
Save martinbaillie/0f5e627c42df32aa8a2d7985663ceeaa to your computer and use it in GitHub Desktop.
Emacs vterm background thread patch

Goal

Apply @tyler-dodge’s background thread patch to Emacs: https://github.com/tyler-dodge/emacs/commit/b386047f311af495963ad6a25ddda128acc1d461

Hack into my Nix derivation

emacsTylerDodge = pkgs.emacsGit.overrideAttrs
(
    _: {
        src = pkgs.fetchgit {
            url = "https://github.com/tyler-dodge/emacs.git";
            rev = "b386047f311af495963ad6a25ddda128acc1d461";
            sha256 = "t7r+6C05Amx5XV75H9Y7xt1iCX6g4YVwhc1q+33Glsw=";
        };
    }
);

Test function

(defun vterm-output-filter-debug-advice (process input)
   (message "Output Filter Buffer Size: %d"
            (length input)))
(advice-add 'vterm--filter
            :before #'vterm-output-filter-debug-advice)

Before patch

Generate some large, fast scrolling output

ps aux

Messages buffer:

...
Output Filter Buffer Size: 3
Output Filter Buffer Size: 1024 [24 times] <-- choke
Output Filter Buffer Size: 548
Output Filter Buffer Size: 59
Output Filter Buffer Size: 224
...

After patch

Generate some large, fast scrolling output

ps aux

Messages buffer:

...
Output Filter Buffer Size: 3
Output Filter Buffer Size: 1062
Output Filter Buffer Size: 49794 <-- no such choke
Output Filter Buffer Size: 4599
Output Filter Buffer Size: 169
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment