   `(:op (:source ,source :transform (:type (:edit ,transform)))))
 
 (defun emdocs--write-stdin (x)
-  (when (process-live-p (get-process emdocs--process-name))
+  ;; TODO: consider batching these changes and then writing them when emacs is idle? Only necessary
+  ;; if latency is currently insufficient.
+  ;; TODO: also consider ways to avoid overhead of copying strings from a buffer with
+  ;; (buffer-substring), should the overhead turn out to be significant.
+  (when (emdocs--process-live-p)
     (let ((line (format "%s\n" (json-encode x))))
       (process-send-string emdocs--process-name line))))
 
 (defun emdocs--make-process ()
+  (message "%s" "initiating emdocs process...")
   (make-process
    :name emdocs--process-name
    :buffer emdocs--process-buffer-name

  (add-hook 'after-change-functions #'emdocs--after-change-function nil t)
  (add-hook 'before-change-functions #'emdocs--before-change-function nil t))


;; Interactive

;;;###autoload
(define-minor-mode emdocs-mode

  (if emdocs-mode
      (progn
        (emdocs--setup-buffer-idempotent)
        (emdocs--initiate-process-idempotent)
        t)
    nil))

