Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in post-command-hook (file-error "Doing vfork" "Not a directory") #9

Open
yudi-matsuzake opened this issue Feb 5, 2024 · 5 comments

Comments

@yudi-matsuzake
Copy link

I've been trying and I could not configure and use eglot-ltex. I open any file that is assigned to text-mode and nothing happens. Similar error messages keep being logged in *Messages* for different files. Please, let me know if I am missing something.

My Emacs version is 29.2 and Output of ltex-ls --version:

{
  "ltex-ls": "16.0.0",
  "java": "21.0.2"
}

The error logged to *Messages* is

Error in post-command-hook (#[0 "\303\301!\205�\0r\301q\210\304\305\300\242\306#\210
?\205�\0\307\310\311 \")\207" [(#0) #<buffer written-interview.org> eglot--managed-mode buffer-live-p remove-hook post-command-hook t apply eglot--connect eglot--guess-contact] 4]): (file-error "Doing vfork" "Not a directory")

Minimal init.el file

;; straight package bootstrap
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name
        "straight/repos/straight.el/bootstrap.el"
        user-emacs-directory))
      (bootstrap-version 6))

  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(use-package eglot)

(use-package eglot-ltex
  :straight (eglot-ltex
    :type git
    :host github
    :repo "emacs-languagetool/eglot-ltex")
  :hook (text-mode . (lambda ()
     (require 'eglot-ltex)
     (eglot-ensure)))
  :init
    (setq eglot-languagetool-server-path "/usr/bin/ltex-ls"))

Command that I used to run the minimal configuration:

emacs -Q --init-directory=/tmp/emacs --eval '(load-file "init.el")'

I hope this is sufficient to reproduce this error. Otherwise, let me know.

@jcs090218
Copy link
Member

Your settings looks correct. Maybe try https://github.com/emacs-languagetool/lsp-ltex?tab=readme-ov-file#-quickstart section. 🤔

@yudi-matsuzake
Copy link
Author

Using lsp-mode and lsp-ltex works with my installation of ltex! But I am still struggling to make the eglot-ltex to work :(

@yudi-matsuzake
Copy link
Author

I am with a working setup now. Firstly, in my init.el the variable that is assigned is eglot-languagetool-server-path which is the wrong variable name. After changing this, a similar error persists. Then I downgrade the ltex to the version 15.0.2. Now everything works as expected.

Is this package expected to work with ltexversion 16.0.1?

Thank you for your attention!

@jcs090218
Copy link
Member

Is this package expected to work with ltexversion 16.0.1?

It should... I will need to investigate this. May be some setup has changed overtime.

Just for the clarification, does 16.0.1 works on lsp-ltex? Or both eglot and lsp-mode clients aren't working? 🤔

@yudi-matsuzake
Copy link
Author

Oh! I think I misspelled the version, the version that I tried is 16.0.0.

For clarity, in my setup the 16.0.0 version works with lsp-mode/lsp-ltex and not with eglot/eglot-ltex.

This is the minimal init.el that I tried lsp-mode/lsp-ltex and works as expected:

;; straight package bootstrap
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name
        "straight/repos/straight.el/bootstrap.el"
        user-emacs-directory))
      (bootstrap-version 6))

  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(use-package lsp-mode
  :straight t)

(use-package lsp-ltex
  :straight t
  :hook
    (text-mode . (lambda ()
      (require 'lsp-ltex)
      (lsp)))
  :init
    (setq lsp-ltex-version "16.0.0"))

This is the minimal init.el that I tried eglot/eglot-ltex using the same .dir-locals.el of the README.md:

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name
        "straight/repos/straight.el/bootstrap.el"
        user-emacs-directory))
      (bootstrap-version 6))

  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(use-package eglot)

(use-package eglot-ltex
  :straight (eglot-ltex
    :type git
    :host github
    :repo "emacs-languagetool/eglot-ltex")
  :hook (text-mode . (lambda ()
     (require 'eglot-ltex)
     (eglot-ensure)))
  :init
    (setq eglot-ltex-server-path "/usr/share/ltex-ls/"))

When I open a text-mode file in the eglot-ltex setup this is logged to the *Messages* buffer:

Loading init.el (source)...done
Making completion list... [3 times]
[jsonrpc] Server exited with status 9
Error running timer: (error "[eglot] Timed out after 30 seconds"

Finally, in the *EGLOT (....)* buffer:

[internal] Wed Feb  7 15:18:25 2024:
(:message "Running language server: /usr/share/ltex-ls/bin/ltex-ls")
[client-request] (id:1) Wed Feb  7 15:18:25 2024:
(:jsonrpc "2.0" :id 1 :method "initialize" :params
	  (:processId 733182 :rootPath "/tmp/test/" :rootUri "file:///tmp/test" :initializationOptions #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
														     ())
		      :capabilities
		      (:workspace
		       (:applyEdit t :executeCommand
				   (:dynamicRegistration :json-false)
				   :workspaceEdit
				   (:documentChanges t)
				   :didChangeWatchedFiles
				   (:dynamicRegistration t)
				   :symbol
				   (:dynamicRegistration :json-false)
				   :configuration t :workspaceFolders t)
		       :textDocument
		       (:synchronization
			(:dynamicRegistration :json-false :willSave t :willSaveWaitUntil t :didSave t)
			:completion
			(:dynamicRegistration :json-false :completionItem
					      (:snippetSupport :json-false :deprecatedSupport t :resolveSupport
							       (:properties
								["documentation" "details" "additionalTextEdits"])
							       :tagSupport
							       (:valueSet
								[1]))
					      :contextSupport t)
			:hover
			(:dynamicRegistration :json-false :contentFormat
					      ["plaintext"])
			:signatureHelp
			(:dynamicRegistration :json-false :signatureInformation
					      (:parameterInformation
					       (:labelOffsetSupport t)
					       :activeParameterSupport t))
			:references
			(:dynamicRegistration :json-false)
			:definition
			(:dynamicRegistration :json-false :linkSupport t)
			:declaration
			(:dynamicRegistration :json-false :linkSupport t)
			:implementation
			(:dynamicRegistration :json-false :linkSupport t)
			:typeDefinition
			(:dynamicRegistration :json-false :linkSupport t)
			:documentSymbol
			(:dynamicRegistration :json-false :hierarchicalDocumentSymbolSupport t :symbolKind
					      (:valueSet
					       [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26]))
			:documentHighlight
			(:dynamicRegistration :json-false)
			:codeAction
			(:dynamicRegistration :json-false :codeActionLiteralSupport
					      (:codeActionKind
					       (:valueSet
						["quickfix" "refactor" "refactor.extract" "refactor.inline" "refactor.rewrite" "source" "source.organizeImports"]))
					      :isPreferredSupport t)
			:formatting
			(:dynamicRegistration :json-false)
			:rangeFormatting
			(:dynamicRegistration :json-false)
			:rename
			(:dynamicRegistration :json-false)
			:inlayHint
			(:dynamicRegistration :json-false)
			:publishDiagnostics
			(:relatedInformation :json-false :codeDescriptionSupport :json-false :tagSupport
					     (:valueSet
					      [1 2])))
		       :window
		       (:workDoneProgress t)
		       :general
		       (:positionEncodings
			["utf-32" "utf-8" "utf-16"])
		       :experimental #s(hash-table size 1 test eql rehash-size 1.5 rehash-threshold 0.8125 data
						   ()))
		      :workspaceFolders
		      [(:uri "file:///tmp/test" :name "/tmp/test/")]))
[stderr] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[stderr] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[stderr] SLF4J: Defaulting to no-operation (NOP) logger implementation
[stderr] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[stderr] Feb 07, 2024 3:18:30 PM org.bsplines.ltexls.server.LtexLanguageServer initialize
[stderr] INFO: ltex-ls 16.0.0 - initializing...
[internal] Wed Feb  7 15:18:55 2024:
(:message "Connection state changed" :change "killed\n")

----------b---y---e---b---y---e----------
[stderr] 
[stderr] 
[stderr] nil
[stderr] nil
[stderr] Process EGLOT (test/(text-mode org-mode git-commit-elisp-text-mode bibtex-mode context-mode latex-mode markdown-mode rst-mode)) stderr finished

Note that lsp-ltex and eglot-ltex are using the system-installed 16.0.0 version of ltex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants