Function: majutsu-start-process

majutsu-start-process is a natively compiled function defined in majutsu-process.el.

Signature

(majutsu-start-process PROGRAM &optional INPUT &rest ARGS)

Documentation

Start PROGRAM asynchronously, preparing for refresh, and return the process.

PROGRAM is started using start-file-process and then setup to use majutsu--process-sentinel and majutsu--process-filter. After the process terminates, the sentinel refreshes the buffer that was current when this function was called (if still alive), as well as the repository's log buffer (see majutsu-refresh).

Source Code

;; Defined in /nix/store/jagqw3nms546pad0gxi5f3wsckk6pji7-emacs-packages-deps/share/emacs/site-lisp/majutsu-process.el
(defun majutsu-start-process (program &optional input &rest args)
  "Start PROGRAM asynchronously, preparing for refresh, and return the process.

PROGRAM is started using `start-file-process' and then setup to use
`majutsu--process-sentinel' and `majutsu--process-filter'.  After the
process terminates, the sentinel refreshes the buffer that was current
when this function was called (if still alive), as well as the
repository's log buffer (see `majutsu-refresh')."
  (let* ((args (flatten-tree args))
         (pwd default-directory)
         (process-buf (let ((default-directory pwd))
                        (majutsu-process-buffer t)))
         (root (with-current-buffer process-buf default-directory))
         (section (with-current-buffer process-buf
                    (prog1 (majutsu--process-insert-section pwd program args nil nil)
                      (backward-char 1))))
         (process (let ((process-environment (majutsu-process-environment args))
                        (default-process-coding-system '(utf-8-unix . utf-8-unix)))
                    (apply #'start-file-process (file-name-nondirectory program)
                           process-buf program args))))
    (majutsu--process-setup process section root #'majutsu--process-sentinel)
    (when input
      (with-current-buffer input
        (process-send-region process (point-min) (point-max))
        (process-send-eof process)))
    (majutsu--process-display-buffer process)
    process))