aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2025-01-29 08:33:54 +0000
committerJoão Távora2025-01-29 08:56:02 +0000
commite2ff77052da91e662bbd3cb19a742604db742d32 (patch)
tree69cec932aef38683ebc2fcddafc4cc408bc34425
parent2e3b085d447bc2cd1a0e779145be9cab9a15d7af (diff)
downloademacs-e2ff77052da91e662bbd3cb19a742604db742d32.tar.gz
emacs-e2ff77052da91e662bbd3cb19a742604db742d32.zip
Eglot: in eglot-code-action-indications, make 'margin' interactive
Didn't know it was possible, thanks to Ergus <spacibba@aol.com> for the tip about binding [left-margin mouse-2] in the keymap. The technique adopted in 'eglot-mouse-call' possibly still doesn't work very well if the margin thing we're clicking on is not on the line point is currently on. But we don't have that problem (yet?) because LSP action suggestions function mostly on a "at point" basis. * lisp/progmodes/eglot.el (eglot-code-action-indications): Adjust docstring. (eglot--mouse-call): Don't go anywhere except in text area. (eglot-diagnostics-map): Bind eglot-mouse-actions to left-margin.
-rw-r--r--lisp/progmodes/eglot.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 48b1d785d8e..e7b50d25bb5 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -595,7 +595,6 @@ Note additionally:
595 595
596- `margin' and `nearby' are incompatible. If both are specified, 596- `margin' and `nearby' are incompatible. If both are specified,
597 the latter takes priority; 597 the latter takes priority;
598- `margin's indicator is not interactive;
599- `mode-line' only works if `eglot-mode-line-action-suggestion' exists in 598- `mode-line' only works if `eglot-mode-line-action-suggestion' exists in
600 `eglot-mode-line-format' (which see)." 599 `eglot-mode-line-format' (which see)."
601 :type '(set 600 :type '(set
@@ -2214,8 +2213,8 @@ If it is activated, also signal textDocument/didOpen."
2214 (interactive "e") 2213 (interactive "e")
2215 (let ((start (event-start event))) (with-selected-window (posn-window start) 2214 (let ((start (event-start event))) (with-selected-window (posn-window start)
2216 (save-excursion 2215 (save-excursion
2217 (goto-char (or (posn-point start) 2216 (unless (posn-area start)
2218 (point))) 2217 (goto-char (posn-point start)))
2219 (call-interactively what) 2218 (call-interactively what)
2220 (when update-mode-line 2219 (when update-mode-line
2221 (force-mode-line-update t))))))) 2220 (force-mode-line-update t)))))))
@@ -2459,6 +2458,7 @@ still unanswered LSP requests to the server\n"))))
2459(defvar eglot-diagnostics-map 2458(defvar eglot-diagnostics-map
2460 (let ((map (make-sparse-keymap))) 2459 (let ((map (make-sparse-keymap)))
2461 (define-key map [mouse-2] #'eglot-code-actions-at-mouse) 2460 (define-key map [mouse-2] #'eglot-code-actions-at-mouse)
2461 (define-key map [left-margin mouse-2] #'eglot-code-actions-at-mouse)
2462 map) 2462 map)
2463 "Keymap active in Eglot-backed Flymake diagnostic overlays.") 2463 "Keymap active in Eglot-backed Flymake diagnostic overlays.")
2464 2464