Commits

Stephen Weeks committed 3a72f6d

automatically start the server if we need to send a message to it

  • Participants
  • Parent commits 41a5ec1

Comments (0)

Files changed (1)

 ;; (Omake.Server.start)
 ;; (Omake.Timer.stop)
 
+(defun Omake.Server.ensure-running ()
+  (unless (Omake.Server.running-p) (Omake.Server.start)))
+
 (defun Omake.Server.stop ()
   (Omake.Server.logf "Stopping server")
   (call-process "killall" nil nil nil (Shell.basename Omake.Server.program))
 (defun Omake.Server.send (msg)
   (assert (stringp msg))
   (Omake.Server.logf "Sending : %s" msg)
+  (Omake.Server.ensure-running)
   (let ((buf (get-buffer-create "[omake-server-output]")))
     (Buffer.clear buf)
     (let ((exit (call-process Omake.Server.program nil buf nil "send" msg)))
 (defun Omake.compile (&optional read-command)
   "Compile the current directory."
   (interactive "P")
-  (unless (Omake.Server.running-p) (Omake.Server.start))
+  (Omake.Server.ensure-running)
   (let* ((path (Filename.default-directory))
          (id (Omake.Id.of-path path)))
     (catch 'exit