all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#65519: 30.0.50; [FR Eglot] keymaps for useful functions
@ 2023-08-25  6:46 Gerd Möllmann
  2023-08-25  9:37 ` João Távora
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Möllmann @ 2023-08-25  6:46 UTC (permalink / raw)
  To: 65519

There are some useful eglot functions that can currently only invoked
with M-x, by default.  I'm currently defining a keymap

(define-keymap :prefix 'my-eglot-bindings
  "a" 'eglot-code-actions
  "f" 'eglot-format
  "h" 'eglot-inlay-hints-mode
  "r" 'eglot-rename)

that I bind to a a prefix key in c-mode-common-hook.

Feature request: Could eglot-mode do something like that?

In GNU Emacs 30.0.50 (build 2, aarch64-apple-darwin22.6.0, NS
 appkit-2299.70 Version 13.5 (Build 22G74)) of 2023-08-24 built on
 Mini.fritz.box
Repository revision: 53c07bd04bf59f63e49af2c626714bf3fdd03ad6
Repository branch: scratch/pkg
Windowing system distributor 'Apple', version 10.3.2299
System Description:  macOS 13.5





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

* bug#65519: 30.0.50; [FR Eglot] keymaps for useful functions
  2023-08-25  6:46 bug#65519: 30.0.50; [FR Eglot] keymaps for useful functions Gerd Möllmann
@ 2023-08-25  9:37 ` João Távora
  2023-08-26  5:20   ` Gerd Möllmann
  0 siblings, 1 reply; 3+ messages in thread
From: João Távora @ 2023-08-25  9:37 UTC (permalink / raw)
  To: Gerd Möllmann; +Cc: 65519

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

> There are some useful eglot functions that can currently only invoked
> with M-x, by default.  I'm currently defining a keymap
>
> (define-keymap :prefix 'my-eglot-bindings
>   "a" 'eglot-code-actions
>   "f" 'eglot-format
>   "h" 'eglot-inlay-hints-mode
>   "r" 'eglot-rename)
>
> that I bind to a a prefix key in c-mode-common-hook.

I think this is a fine way to go about it.

> Feature request: Could eglot-mode do something like that?

This request comes up often.  The reason Eglot does this is partly
answered in the top bullet of eglot.el's description:

;; * Eglot's main job is to hook up the information that language
;;   servers offer via LSP to Emacs's UI facilities: Xref for
;;   definition-chasing, Flymake for diagnostics, Eldoc for at-point
;;   documentation, etc.  Eglot's job is generally *not* to provide
;;   such a UI itself, though a small number of simple
;;   counter-examples do exist, e.g. in the `eglot-rename' command or
;;   the `eglot-inlay-hints-mode' minor mode.  When a new UI is
;;   evidently needed, consider adding a new package to Emacs, or
;;   extending an existing one.

So this is how Eglot wants to sell itself: to be a low-profile
middle-man between Emacs and LSP.  It doesn't always work and people
understandibly want Eglot to be more of a front-man.

I try to resist this temptation as much as possible because that leads
to bloat and duplicated functionality with idiosyncractic interfaces.

So I always push for other "standard" packages to provide the UI.  But
as you can see in those 4 examples, I ended up being pragmatic and
putting the command in Eglot itself.

But it's not unthinkable (in fact, it's desired I think and I've looked
into it) that 'eglot-format' simply dissolves into Emacs's longstanding
'indent.el' machinery.  And there's some talk of a "refactoring
interface" for Emacs in emacs-devel (I think).  So that's where
'eglot-code-actions' and 'eglot-rename' should really live.

In short, I think it's OK to be pragmatic.  Why not make a
eglot-bindings.el package?

João





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

* bug#65519: 30.0.50; [FR Eglot] keymaps for useful functions
  2023-08-25  9:37 ` João Távora
@ 2023-08-26  5:20   ` Gerd Möllmann
  0 siblings, 0 replies; 3+ messages in thread
From: Gerd Möllmann @ 2023-08-26  5:20 UTC (permalink / raw)
  To: João Távora; +Cc: 65519

João Távora <joaotavora@gmail.com> writes:

> Gerd Möllmann <gerd.moellmann@gmail.com> writes:
>
>> There are some useful eglot functions that can currently only invoked
>> with M-x, by default.  I'm currently defining a keymap
>>
>> (define-keymap :prefix 'my-eglot-bindings
>>   "a" 'eglot-code-actions
>>   "f" 'eglot-format
>>   "h" 'eglot-inlay-hints-mode
>>   "r" 'eglot-rename)
>>
>> that I bind to a a prefix key in c-mode-common-hook.
>
> I think this is a fine way to go about it.
>
>> Feature request: Could eglot-mode do something like that?
>
> This request comes up often.  The reason Eglot does this is partly
> answered in the top bullet of eglot.el's description:
>
> ;; * Eglot's main job is to hook up the information that language
> ;;   servers offer via LSP to Emacs's UI facilities: Xref for
> ;;   definition-chasing, Flymake for diagnostics, Eldoc for at-point
> ;;   documentation, etc.  Eglot's job is generally *not* to provide
> ;;   such a UI itself, though a small number of simple
> ;;   counter-examples do exist, e.g. in the `eglot-rename' command or
> ;;   the `eglot-inlay-hints-mode' minor mode.  When a new UI is
> ;;   evidently needed, consider adding a new package to Emacs, or
> ;;   extending an existing one.
>
> So this is how Eglot wants to sell itself: to be a low-profile
> middle-man between Emacs and LSP.  It doesn't always work and people
> understandibly want Eglot to be more of a front-man.
>
> I try to resist this temptation as much as possible because that leads
> to bloat and duplicated functionality with idiosyncractic interfaces.

Ok.

> So I always push for other "standard" packages to provide the UI.  But
> as you can see in those 4 examples, I ended up being pragmatic and
> putting the command in Eglot itself.
>
> But it's not unthinkable (in fact, it's desired I think and I've looked
> into it) that 'eglot-format' simply dissolves into Emacs's longstanding
> 'indent.el' machinery.  And there's some talk of a "refactoring
> interface" for Emacs in emacs-devel (I think).  So that's where
> 'eglot-code-actions' and 'eglot-rename' should really live.
>
> In short, I think it's OK to be pragmatic.  Why not make a
> eglot-bindings.el package?

You mean making an ELPA package? Sorry, that's too much effort for me.
Maybe someone else will do it.





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

end of thread, other threads:[~2023-08-26  5:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-25  6:46 bug#65519: 30.0.50; [FR Eglot] keymaps for useful functions Gerd Möllmann
2023-08-25  9:37 ` João Távora
2023-08-26  5:20   ` Gerd Möllmann

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.