]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: Add 'command-modes' property to all suitable commands
authorAugusto Stoffel <arstoffel@gmail.com>
Sun, 21 Apr 2024 09:21:58 +0000 (11:21 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 6 May 2024 16:33:26 +0000 (18:33 +0200)
Those are the commands that call 'eglot--current-server-or-lose'.
* lisp/progmodes/eglot.el (eglot--managed-mode),
(eglot-list-connections-mode): Make non-interactive.  (Bug#70554)

(cherry picked from commit b98a6af8ca086ddbf891e54e50d0cb3f578f42b5)

lisp/progmodes/eglot.el

index 5e0b2ced6a7e54b760fdd125b73be385cb6f0f43..592dc4a768e62eac177eab03a8f0742022b970cc 100644 (file)
@@ -1977,7 +1977,7 @@ Use `eglot-managed-p' to determine if current buffer is managed.")
 
 (define-minor-mode eglot--managed-mode
   "Mode for source buffers managed by some Eglot project."
-  :init-value nil :lighter nil :keymap eglot-mode-map
+  :init-value nil :lighter nil :keymap eglot-mode-map :interactive nil
   (cond
    (eglot--managed-mode
     (pcase (plist-get (eglot--capabilities (eglot-current-server))
@@ -3989,6 +3989,7 @@ If NOERROR, return predicate, else erroring function."
 (define-derived-mode eglot-list-connections-mode  tabulated-list-mode
   "" "Eglot mode for listing server connections
 \\{eglot-list-connections-mode-map}"
+  :interactive nil
   (setq-local tabulated-list-format
               `[("Language server" 16) ("Project name" 16) ("Modes handled" 16)])
   (tabulated-list-init-header))
@@ -4178,6 +4179,27 @@ If NOERROR, return predicate, else erroring function."
               "https://debbugs.gnu.org/%s")
             (match-string 3))))
 
+;; Add command-mode property manually for compatibility with Emacs < 28.
+(dolist (sym '(eglot-clear-status
+               eglot-code-action-inline
+               eglot-code-action-organize-imports
+               eglot-code-action-quickfix
+               eglot-code-action-rewrite
+               eglot-code-action-rewrite
+               eglot-code-actions
+               eglot-find-declaration
+               eglot-find-implementation
+               eglot-find-typeDefinition
+               eglot-forget-pending-continuations
+               eglot-format
+               eglot-format-buffer
+               eglot-inlay-hints-mode
+               eglot-reconnect
+               eglot-rename
+               eglot-signal-didChangeConfiguration
+               eglot-stderr-buffer))
+  (function-put sym 'command-modes '(eglot--managed-mode)))
+
 (provide 'eglot)