Commits

seanmcl committed 3bfb647

fixed emacs/server connection bug

  • Participants
  • Parent commits 0a18f83

Comments (0)

Files changed (4)

elisp/omake/omake-connection.el

 
 (defconst Omake.Emacs.pid (number-to-string (emacs-pid)))
 
-(defvar Omake.Connection.process nil
-  "A handle on the connection to the omake server")
-;; (setq Omake.Connection.process nil)
+(defconst Omake.Connection.name "omake-server")
 
 (defun Omake.Connection.open-p ()
-  (let ((p Omake.Connection.process))
-    (when p (equal (process-status p) 'open))))
-;; (Omake.Connection.open-p)
-;; (process-status Omake.Connection.process)
+  (process-status Omake.Connection.name))
 
 (defun Omake.Connection.open ()
   "A TCP connection is made to the server via the user's socket."
   (message "Establishing a connection to the server.")
   (let* ((p (make-network-process
-             :name "omake-server"
+             :name Omake.Connection.name
+             :buffer "TMP"
              :filter 'Omake.Filter.fun
              :family 'local
              :service (concat "/tmp/omake-server/" Omake.user "/socket")
              :family 'local)))
     (set-process-query-on-exit-flag p nil)
-    (setq Omake.Connection.process p)
-    (process-send-string p (format "(Register_emacs %s)" Omake.Emacs.pid))
+    (process-send-string p (format "(Register_emacs %s) " Omake.Emacs.pid))
     ;; Initialize the project list
     (Omake.Server.update-projects)
     (Omake.Timer.start)
     (Emacs.protect-from-quit (sleep-for 2))))
 ;; (Omake.Connection.open)
+;; (Omake.Connection.open-p)
 
 (defun Omake.Connection.ensure-open ()
   (Omake.Server.ensure-running)
     (call-process
      Omake.Server.program
      nil nil nil "client" "unregister-emacs" Omake.Emacs.pid)
-    (when Omake.Connection.process (delete-process Omake.Connection.process))
-    (setq Omake.Connection.process nil))
+    (delete-process Omake.Connection.name))
   (Omake.Timer.stop))
 ;; (Omake.Connection.close)
 

elisp/omake/omake-file.el

 
 (defun Omake.File.server-log ()
   (expand-file-name
-   (format-time-string "%Y-%M-%d" (current-time))
+   (format-time-string "%Y-%m-%d" (current-time))
    Omake.File.server-log-dir))
 
 (defconst Omake.File.server-state

ocaml/omake/query.ml

     | Register_emacs pid ->
       Emacs.register pid writer;
       watch_for_dead_emacs pid;
-      Deferred.unit
+      Writer.close_finished writer
     | Send_to_emacs (pid, msg) ->
       begin
         match pid with

test/TESTS_TO_ADD

+* After Omake.Connection.open, Omake.Connection.open-p is true.
+* After Omake.Server.ensure-running, Omake.Server.running-p is true.