Function: ghostel--filter

ghostel--filter is a natively compiled function defined in ghostel.el.

Signature

(ghostel--filter PROCESS OUTPUT)

Documentation

Feed Emacs-owned PTY output to the terminal.

PROCESS is the Emacs process whose PTY produced OUTPUT. OUTPUT is fed to the terminal immediately; rendering is scheduled separately by ghostel--invalidate so the terminal may run ahead of the materialized buffer.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel.el
;;; Process management

(defun ghostel--filter (process output)
  "Feed Emacs-owned PTY output to the terminal.
PROCESS is the Emacs process whose PTY produced OUTPUT.  OUTPUT is
fed to the terminal immediately; rendering is scheduled separately by
`ghostel--invalidate' so the terminal may run ahead of the
materialized buffer."
  (when (buffer-live-p (process-buffer process))
    (with-current-buffer (process-buffer process)
      (when ghostel--term
        ;; Native callbacks dispatched while parsing output (for example OSC 52;e)
        ;; may select another buffer.  Keep the rest of the filter's buffer-local
        ;; reads anchored to this ghostel buffer.
        (save-current-buffer
          (ghostel--write-vt ghostel--term output))
                (ghostel--invalidate)))))