Function: majutsu--process-file-created-main-process
majutsu--process-file-created-main-process is a natively compiled
function defined in majutsu-process.el.
Signature
(majutsu--process-file-created-main-process BEFORE STDERR-BUFFER STDERR-PROCESS STDOUT-BUFFER STDOUT-FILTER COMMAND NAME)
Documentation
Return a reliably identified main process created after BEFORE.
STDERR-PROCESS must be the new process attached to Majutsu's private
STDERR-BUFFER. The returned process must also be new, have the corresponding
Emacs-generated NAME, and retain the exact STDOUT-BUFFER, STDOUT-FILTER, and
COMMAND passed to make-process. Main and stderr process suffixes are checked
independently because Emacs uniquifies those names independently. Return nil
instead of guessing when these constraints do not identify exactly one process.
Source Code
;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-process.el
(defun majutsu--process-file-created-main-process
(before stderr-buffer stderr-process stdout-buffer stdout-filter command name)
"Return a reliably identified main process created after BEFORE.
STDERR-PROCESS must be the new process attached to Majutsu's private
STDERR-BUFFER. The returned process must also be new, have the corresponding
Emacs-generated NAME, and retain the exact STDOUT-BUFFER, STDOUT-FILTER, and
COMMAND passed to `make-process'. Main and stderr process suffixes are checked
independently because Emacs uniquifies those names independently. Return nil
instead of guessing when these constraints do not identify exactly one process."
(let ((main-name-re (format "\\`%s\\(?:<[0-9]+>\\)?\\'"
(regexp-quote name)))
(stderr-name-re (format "\\`%s stderr\\(?:<[0-9]+>\\)?\\'"
(regexp-quote name))))
(when (and (processp stderr-process)
(not (memq stderr-process before))
(eq (process-buffer stderr-process) stderr-buffer)
(string-match-p stderr-name-re (process-name stderr-process)))
(let ((candidates
(seq-filter
(lambda (candidate)
(and (not (memq candidate before))
(not (eq candidate stderr-process))
(string-match-p main-name-re (process-name candidate))
(eq (process-buffer candidate) stdout-buffer)
(equal (process-command candidate) command)
(or (null stdout-filter)
(eq (process-filter candidate) stdout-filter))))
(process-list))))
(and (null (cdr candidates))
(car candidates))))))