mhayashi1120/Emacs-langtool

langtool-server--ensure-running doesn't work for languagetool installed with package manager

ST-Saint opened this issue · 0 comments

langtool-java-classpath is also needed for server & client mode

(defun langtool-server--ensure-running ()
  (langtool-server--check-command)
  (unless (let ((proc (langtool-adapter-get 'process)))
            (and  (processp proc)
                  (eq (process-status proc) 'run)))
    ;; Force terminate previous server process if exists.
    (langtool-adapter-ensure-terminate)
    (let* ((bin langtool-java-bin)
           (args '()))
      ;; jar Default setting is "HTTPSServer" .
      ;; This application no need to use SSL since local app.
      ;; http://wiki.languagetool.org/http-server
      (setq args (append args (list
+                              "-cp" langtool-java-classpath ;; ("/usr/share/languagetool:/usr/share/java/languagetool/*")
-                              (langtool--process-file-name
-                               langtool-language-tool-server-jar)
                               )))
      (setq args (append args (list "org.languagetool.server.HTTPServer")))
      (setq args (append args langtool-server-user-arguments))
      (langtool--debug "HTTPServer" "%s: %s" bin args)
      (let* ((buffer (get-buffer-create " *LangtoolHttpServer* "))
             (proc (apply
                    #'start-process
                    "LangtoolHttpServer" buffer
                    bin
                    args)))
        (langtool-server--rendezvous proc buffer)
        (set-process-sentinel proc 'langtool-server--process-sentinel)
        (langtool-adapter-ensure-internal proc)
        proc))))

Also, is PR still welcome?