                 (progn (message "Client could not connect: exiting.")
                        (setq emdocs-mode nil)
                        (emdocs-disconnect))
-              (insert "DO AFTER-CHANGE FUNCTIONS"))))
+              (with-current-buffer buffer
+                (make-local-variable 'emdocs-is-network-insert)
+                (setq emdocs-is-network-insert nil)
+                (add-hook 'after-change-functions
+                          #'emdocs-after-change-function)))))
       (message "Not connected to internet: exiting.")
       (setq emdocs-mode nil)
       (emdocs-disconnect))))

           (not (eq (process-status *emdocs-server*) 'closed)))
      (delete-process *emdocs-server*))
  (setq *emdocs-server* nil))

;;; define mode



(defun emdocs-get-server-process-name ()
  "docstring"
  "*emdocs-server*")

(defun emdocs-get-client-process-name (buffer ip)
  "docstring"
