Function: start-file-process@with-editor-process-filter

start-file-process@with-editor-process-filter is a byte-compiled function defined in with-editor.el.

Signature

(start-file-process@with-editor-process-filter FN NAME BUFFER PROGRAM &rest PROGRAM-ARGS)

Documentation

When called inside a with-editor form and the Emacsclient cannot be used, then give the process the filter function with-editor-process-filter. To avoid overriding the filter being added here you should use with-editor-set-process-filter instead of set-process-filter inside with-editor forms.

When the default-directory is located on a remote machine, then also manipulate PROGRAM and PROGRAM-ARGS in order to set the appropriate editor environment variable.

Source Code

;; Defined in ~/.emacs.d/elpa/with-editor-20260301.1317/with-editor.el
(define-advice start-file-process
    (:around (fn name buffer program &rest program-args)
             with-editor-process-filter)
  "When called inside a `with-editor' form and the Emacsclient
cannot be used, then give the process the filter function
`with-editor-process-filter'.  To avoid overriding the filter
being added here you should use `with-editor-set-process-filter'
instead of `set-process-filter' inside `with-editor' forms.

When the `default-directory' is located on a remote machine,
then also manipulate PROGRAM and PROGRAM-ARGS in order to set
the appropriate editor environment variable."
  (if (not with-editor--envvar)
      (apply fn name buffer program program-args)
    (when (file-remote-p default-directory)
      (unless (equal program "env")
        (push program program-args)
        (setq program "env"))
      (push (concat with-editor--envvar "=" with-editor-sleeping-editor)
            program-args))
    (let ((process (apply fn name buffer program program-args)))
      (set-process-filter process #'with-editor-process-filter)
      (process-put process 'default-dir default-directory)
      process)))