unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#70554: [PATCH] Eglot: Add 'command-modes' property to all suitable commands
@ 2024-04-24 18:45 Augusto Stoffel
  2024-04-27  9:34 ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Augusto Stoffel @ 2024-04-24 18:45 UTC (permalink / raw)
  To: 70554; +Cc: João Távora

[-- Attachment #1: Type: text/plain, Size: 31 bytes --]

Tags: patch

See attachement.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Eglot-Add-command-modes-property-to-all-suitable-com.patch --]
[-- Type: text/patch, Size: 2436 bytes --]

From 39b7e357706b6c7efb37f644d7ff990163c1db25 Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <arstoffel@gmail.com>
Date: Sun, 21 Apr 2024 11:21:58 +0200
Subject: [PATCH] Eglot: Add 'command-modes' property to all suitable commands

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.
---
 lisp/progmodes/eglot.el | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index efdbfba1075..cddd8994212 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1978,7 +1978,7 @@ eglot--track-changes
 
 (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))
@@ -3951,6 +3951,7 @@ eglot--glob-emit-range
 (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))
@@ -4140,6 +4141,27 @@ eglot-inlay-hints-mode
               "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)
 
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* bug#70554: [PATCH] Eglot: Add 'command-modes' property to all suitable commands
  2024-04-24 18:45 bug#70554: [PATCH] Eglot: Add 'command-modes' property to all suitable commands Augusto Stoffel
@ 2024-04-27  9:34 ` Eli Zaretskii
  2024-04-27  9:46   ` João Távora
  0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-04-27  9:34 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 70554, joaotavora

> Cc: João Távora <joaotavora@gmail.com>
> From: Augusto Stoffel <arstoffel@gmail.com>
> Date: Wed, 24 Apr 2024 20:45:54 +0200
> 
> See attachement.

Thanks.

João, any comments, or should I install this?





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#70554: [PATCH] Eglot: Add 'command-modes' property to all suitable commands
  2024-04-27  9:34 ` Eli Zaretskii
@ 2024-04-27  9:46   ` João Távora
  2024-04-29 18:12     ` Augusto Stoffel
  0 siblings, 1 reply; 5+ messages in thread
From: João Távora @ 2024-04-27  9:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 70554, Augusto Stoffel

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

On Sat, Apr 27, 2024 at 10:34 AM Eli Zaretskii <eliz@gnu.org> wrote:

> > Cc: João Távora <joaotavora@gmail.com>
> > From: Augusto Stoffel <arstoffel@gmail.com>
> > Date: Wed, 24 Apr 2024 20:45:54 +0200
> >
> > See attachement.
>
> Thanks.
>
> João, any comments, or should I install this?
>

Isn't there a way to say this near where the commands are defined,
perhaps near the `interactive` which marks a given function as a
command?  If there isn't, just install this, perhaps with a tweak
to the commit message mentioning the top level form, and thanks.

João

[-- Attachment #2: Type: text/html, Size: 1202 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#70554: [PATCH] Eglot: Add 'command-modes' property to all suitable commands
  2024-04-27  9:46   ` João Távora
@ 2024-04-29 18:12     ` Augusto Stoffel
  2024-05-02  8:52       ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Augusto Stoffel @ 2024-04-29 18:12 UTC (permalink / raw)
  To: João Távora; +Cc: Eli Zaretskii, 70554

On Sat, 27 Apr 2024 at 10:46, João Távora wrote:

> Isn't there a way to say this near where the commands are defined,
> perhaps near the `interactive` which marks a given function as a 
> command?  If there isn't, just install this, perhaps with a tweak 
> to the commit message mentioning the top level form, and thanks.

This is not possible while keeping compatibility with older Emacs
versions.  There's already a comment to that effect in the patch, so the
change you mention can be made in the future.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#70554: [PATCH] Eglot: Add 'command-modes' property to all suitable commands
  2024-04-29 18:12     ` Augusto Stoffel
@ 2024-05-02  8:52       ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-05-02  8:52 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: 70554-done, joaotavora

> From: Augusto Stoffel <arstoffel@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  70554@debbugs.gnu.org
> Date: Mon, 29 Apr 2024 20:12:14 +0200
> 
> On Sat, 27 Apr 2024 at 10:46, João Távora wrote:
> 
> > Isn't there a way to say this near where the commands are defined,
> > perhaps near the `interactive` which marks a given function as a 
> > command?  If there isn't, just install this, perhaps with a tweak 
> > to the commit message mentioning the top level form, and thanks.
> 
> This is not possible while keeping compatibility with older Emacs
> versions.  There's already a comment to that effect in the patch, so the
> change you mention can be made in the future.

Thanks, so I've now installed this on the master branch, and I'm
therefore closing this bug.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-02  8:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24 18:45 bug#70554: [PATCH] Eglot: Add 'command-modes' property to all suitable commands Augusto Stoffel
2024-04-27  9:34 ` Eli Zaretskii
2024-04-27  9:46   ` João Távora
2024-04-29 18:12     ` Augusto Stoffel
2024-05-02  8:52       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).