seagle0128 / doom-modeline

A fancy and fast mode-line inspired by minimalism design.
https://seagle0128.github.io/doom-modeline/
GNU General Public License v3.0
1.27k stars 157 forks source link

[Bug] The newest `doom-modeline` stops eglot from being shutdown. #739

Closed 50ways2sayhard closed 2 weeks ago

50ways2sayhard commented 2 weeks ago

Thank you for the bug report

Bug description

Emacs throws an error in the process sentinel: No applicable method: jsonrpc-name, nil after running M-x eglot-shutdown when using the newest doom-modeline. When I switch to version 36e32f0, everything works fine and no error is thrown.

My Emacs version is: GNU Emacs 30.0.90 (build 1, aarch64-apple-darwin23.5.0, NS appkit-2487.60 Version 14.5 (Build 23F79)) of 2024-09-02

Steps to reproduce

  1. M-x doom-modeline-mode
  2. open a project
  3. M-x eglot
  4. M-x eglot-shutdown

Expected behavior

Executing eglot-shutdown with no error thrown.

OS

MacOS

Emacs Version

30 (gccemacs)

Emacs Configurations

No response

Error callstack

No response

Anything else

No response

Icy-Thought commented 2 weeks ago

This might be a relevant issue, but when you try to kill an eglot buffer while having doom-modeline installed you wind up with cl-no-applicable-method: No applicable method: jsonrpc-name, nil. Disabling the modeline does not resolve the issue, but removing it and restarting Emacs seems to get rid of the issue.

Toggling debug-on-error yields:

Debugger entered--Lisp error: (cl-no-applicable-method jsonrpc-name nil)
  signal(cl-no-applicable-method (jsonrpc-name nil))
  cl-no-applicable-method(#s(cl--generic :name jsonrpc-name :dispatches ((0 #s(cl--generic-generalizer :name eieio--generic-generalizer :priority 50 :tagcode-function cl--generic-struct-tag :specializers-function #f(compiled-function (tag &rest _) #<bytecode -0x1dc2c94fcb654fb5>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode 0x111a2082463a1535>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode -0x1a05678245d32db5>)))) :method-table (#s(cl--generic-method :specializers (jsonrpc-connection) :qualifiers nil :call-con nil :function #f(compiled-function (this) "Retrieve the slot `name' from an object of class `jsonrpc-connection'." #<bytecode 0x1bf1fe593d747058>))) :options nil) nil)
  apply(cl-no-applicable-method #s(cl--generic :name jsonrpc-name :dispatches ((0 #s(cl--generic-generalizer :name eieio--generic-generalizer :priority 50 :tagcode-function cl--generic-struct-tag :specializers-function #f(compiled-function (tag &rest _) #<bytecode -0x1dc2c94fcb654fb5>)) #s(cl--generic-generalizer :name cl--generic-t-generalizer :priority 0 :tagcode-function #f(compiled-function (name &rest _) #<bytecode 0x111a2082463a1535>) :specializers-function #f(compiled-function (tag &rest _) #<bytecode -0x1a05678245d32db5>)))) :method-table (#s(cl--generic-method :specializers (jsonrpc-connection) :qualifiers nil :call-con nil :function #f(compiled-function (this) "Retrieve the slot `name' from an object of class `jsonrpc-connection'." #<bytecode 0x1bf1fe593d747058>))) :options nil) nil)
  #f(compiled-function (&rest args) #<bytecode 0x3e64832ef2e7082>)(nil)
  apply(#f(compiled-function (&rest args) #<bytecode 0x3e64832ef2e7082>) nil nil)
  jsonrpc-name(nil)
  doom-modeline-update-eglot()
  run-hooks(eglot-managed-mode-hook)
  eglot--managed-mode(-1)
  eglot--managed-mode-off()
  kill-buffer("linked-lists.py")
  funcall-interactively(kill-buffer "linked-lists.py")
  command-execute(kill-buffer)
matperc commented 2 weeks ago

I had the same issue, I applied the following patch and it seems to work.

diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el
index 3a65892..00ff92b 100644
--- a/doom-modeline-segments.el
+++ b/doom-modeline-segments.el
@@ -2058,8 +2058,8 @@ mouse-1: Reload to start server")
                            (nick 'doom-modeline-lsp-success)
                            (t 'doom-modeline-lsp-warning)))
                (server-info (and server (eglot--server-info server)))
-               (server-name (or (plist-get server-info :name)
-                                (jsonrpc-name server) ""))
+               (server-name (and server (or (plist-get server-info :name)
+                                            (jsonrpc-name server) "")))
                (major-modes (or (and server-info (eglot--major-modes server)) ""))
                (icon (doom-modeline-lsp-icon eglot-menu-string face)))
           (propertize icon
Icy-Thought commented 1 week ago

Can confirm that it also resolved the issue for me. Thanks a lot for resolving the issue and sharing the solution with us! :)