 
 (defun emdocs-get-client-process-name (buffer ip)
   "docstring"
-  (concat "*emdocs-client:" (buffer-name buffer) ":" ip "*"))
+  (if (bufferp buffer)
+      (concat "*emdocs-client:" (buffer-name buffer) ":" ip "*")
+    (concat "*emdocs-client:" buffer "*")))
 
 (defun emdocs-server-sentinel (sock msg)
   "docstring"

   :noquery t))

(defun emdocs-broadcast-message (msg)
  (loop for client in *emdocs-clients*
        do (process-send-string client msg)))

(defun emdocs-emit-keypress-json (type point content)
  (emdocs-broadcast-message
   (json-encode
    `(:buffer ,(buffer-name)
      :edit_type ,type
      :point ,point
      :content ,content))))

(defun emdocs-after-change-function (beg end prev-length)
  (unless emdocs-is-network-insert
    (cond ((= prev-length 0)
           (emdocs-emit-keypress-json
            "insert" beg (buffer-substring beg end)))
          ((= beg end)
           (emdocs-emit-keypress-json
            "delete" beg prev-length)))))

(defun emdocs-attach-sockets-to-buffer (buffer ip)
  "docstring"

                (setq *emdocs-server* nil)
                (setq emdocs-mode nil)
                (emdocs-disconnect))
            (setq emdocs-client-list nil)
            (unless (or (string-equal ip "localhost")
                        (string-equal ip ""))
