Function: ruby-flymake--helper

ruby-flymake--helper is a byte-compiled function defined in ruby-mode.el.gz.

Signature

(ruby-flymake--helper PROCESS-NAME COMMAND PARSER-FN)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/ruby-mode.el.gz
(defun ruby-flymake--helper (process-name command parser-fn)
  (when (process-live-p ruby--flymake-proc)
    (kill-process ruby--flymake-proc))

  (let ((source (current-buffer)))
    (save-restriction
      (widen)
      (setq
       ruby--flymake-proc
       (make-process
        :name process-name :noquery t :connection-type 'pipe
        :buffer (generate-new-buffer (format " *%s*" process-name))
        :command command
        :sentinel
        (lambda (proc _event)
          (when (and (eq 'exit (process-status proc)) (buffer-live-p source))
            (unwind-protect
                (if (with-current-buffer source (eq proc ruby--flymake-proc))
                    (with-current-buffer (process-buffer proc)
                      (funcall parser-fn proc source))
                  (flymake-log :debug "Canceling obsolete check %s"
                               proc))
              (kill-buffer (process-buffer proc)))))))
      (process-send-region ruby--flymake-proc (point-min) (point-max))
      (process-send-eof ruby--flymake-proc))))