Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Future proofing eglot-connect-timeout for newest emacs #1342

@BrunodaSilvaBelo

Description

@BrunodaSilvaBelo

Hi, I use emacs' git version and with eglot 1.16 in this build GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.39, cairo version 1.18.0) of 2023-12-27 had a breaking change. I always set eglot-connect-timeout to nil, but now i'm receiving this error:

Debugger entered--Lisp error: (wrong-type-argument timerp nil)
  cancel-timer(nil)
  jsonrpc--remove(#<eglot-lsp-server eglot-lsp-server-156e2b0b5864> 1)
  jsonrpc-connection-receive(#<eglot-lsp-server eglot-lsp-server-156e2b0b5864> (:jsonrpc "2.0" :id 1 :result (:capabilities (:completionProvider (:triggerCharacters ["2" ":" "#" "\\"]) :documentFormattingProvider t :textDocumentSync (:change 2 :openClose t :save (:includeText :json-false) :willSave t :willSaveWaitUntil t)) :serverInfo (:name "beancount-language-server" :version "1.3.1")) :jsonrpc-json "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"completionProvider\":{\"triggerCharacters\":[\"2\",\":\",\"#\",\"\\\\\"]},\"documentFormattingProvider\":true,\"textDocumentSync\":{\"change\":2,\"openClose\":true,\"save\":{\"includeText\":false},\"willSave\":true,\"willSaveWaitUntil\":true}},\"serverInfo\":{\"name\":\"beancount-language-server\",\"version\":\"1.3.1\"}}}"))
  #f(compiled-function (m) #<bytecode -0xa23201442836311>)((:jsonrpc "2.0" :id 1 :result (:capabilities (:completionProvider (:triggerCharacters ["2" ":" "#" "\\"]) :documentFormattingProvider t :textDocumentSync (:change 2 :openClose t :save (:includeText :json-false) :willSave t :willSaveWaitUntil t)) :serverInfo (:name "beancount-language-server" :version "1.3.1")) :jsonrpc-json "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"completionProvider\":{\"triggerCharacters\":[\"2\",\":\",\"#\",\"\\\\\"]},\"documentFormattingProvider\":true,\"textDocumentSync\":{\"change\":2,\"openClose\":true,\"save\":{\"includeText\":false},\"willSave\":true,\"willSaveWaitUntil\":true}},\"serverInfo\":{\"name\":\"beancount-language-server\",\"version\":\"1.3.1\"}}}"))
  apply(#f(compiled-function (m) #<bytecode -0xa23201442836311>) (:jsonrpc "2.0" :id 1 :result (:capabilities (:completionProvider (:triggerCharacters ["2" ":" "#" "\\"]) :documentFormattingProvider t :textDocumentSync (:change 2 :openClose t :save (:includeText :json-false) :willSave t :willSaveWaitUntil t)) :serverInfo (:name "beancount-language-server" :version "1.3.1")) :jsonrpc-json "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"completionProvider\":{\"triggerCharacters\":[\"2\",\":\",\"#\",\"\\\\\"]},\"documentFormattingProvider\":true,\"textDocumentSync\":{\"change\":2,\"openClose\":true,\"save\":{\"includeText\":false},\"willSave\":true,\"willSaveWaitUntil\":true}},\"serverInfo\":{\"name\":\"beancount-language-server\",\"version\":\"1.3.1\"}}}"))
  timer-event-handler([t 25996 58782 45355 nil #f(compiled-function (m) #<bytecode -0xa23201442836311>) ((:jsonrpc "2.0" :id 1 :result (:capabilities (:completionProvider (:triggerCharacters ["2" ":" "#" "\\"]) :documentFormattingProvider t :textDocumentSync (:change 2 :openClose t :save (:includeText :json-false) :willSave t :willSaveWaitUntil t)) :serverInfo (:name "beancount-language-server" :version "1.3.1")) :jsonrpc-json "{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":{\"capabilities\":{\"completionProvider\":{\"triggerCharacters\":[\"2\",\":\",\"#\",\"\\\\\"]},\"documentFormattingProvider\":true,\"textDocumentSync\":{\"change\":2,\"openClose\":true,\"save\":{\"includeText\":false},\"willSave\":true,\"willSaveWaitUntil\":true}},\"serverInfo\":{\"name\":\"beancount-language-server\",\"version\":\"1.3.1\"}}}")) nil 361000 nil])
  accept-process-output(nil 3)
  eglot--connect((beancount-mode) (transient . "/home/edge/.emacs.d/beancount/") eglot-lsp-server ("beancount-language-server" "--stdio") ("beancount"))
  eglot((beancount-mode) (transient . "/home/edge/.emacs.d/beancount/") eglot-lsp-server ("beancount-language-server" "--stdio") ("beancount") t)
  funcall-interactively(eglot (beancount-mode) (transient . "/home/edge/.emacs.d/beancount/") eglot-lsp-server ("beancount-language-server" "--stdio") ("beancount") t)
  hydra--call-interactively-remap-maybe(eglot)
  (progn (setq this-command 'eglot) (hydra--call-interactively-remap-maybe #'eglot))
  eglot/eglot-and-exit()
  funcall-interactively(eglot/eglot-and-exit)
  command-execute(eglot/eglot-and-exit)

Setting eglot-connect-timeout to integer solves this problem, maybe in the future, a new way to make eglot never timeout is needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions