 (defvar *emdocs-incoming-clients* nil
   "docstring")
 
+;;; locals
+
+(defvar-local emdocs-initial-client nil
+  "docstring")
+
+(defvar-local emdocs-ip-addr nil
+  "docstring")
+
+(defvar-local emdocs-is-network-insert nil
+  "docstring")
+
+(defvar-local emdocs-after-change-lambda nil
+  "docstring")
+
 ;;; classes
 
 (defclass emdocs-client ()
   ((process
     :initarg :process
-    :accessor emdocs-get-process)
+    :accessor emdocs-get-process
+    :documentation "docstring")
    (attached-buffer
     :initarg :attached-buffer
-    :accessor emdocs-get-attached-buffer)
+    :accessor emdocs-get-attached-buffer
+    :documentation "docstring")
    (ip
     :initarg :ip
-    :accessor emdocs-get-ip)))
+    :accessor emdocs-get-ip
+    :documentation "docstring"))
+  "docstring")
 
 ;;; functions
 
-;;; utility
 (defun emdocs-get-internal-ip-address (&optional device-name)
-  "Returns ip address of active interface, ignoring loopback. Returns nil if
-none active. Returns an arbitrary interface if more than one is connected."
+  "Returns ip address of active network interface, ignoring loopback. Returns
+nil if none active. Returns an arbitrary interface if more than one is
+connected."
   (if device-name
       (format-network-address (car (network-interface-info device-name)) t)
     (let ((network-interfaces (network-interface-list)))

;; -*- lexical-binding: t; -*-

(eval-when-compile
  (require 'cl)

      (if ip ; if being told to connect
          (unless (find ip *emdocs-outgoing-clients*
                        :test #'emdocs-is-ip-from-client)
            (emdocs-connect-client buffer ip))
        (with-current-buffer buffer
          (save-excursion
            (setq emdocs-is-network-insert t)
