[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 8d8c90d 45/54: Fix #182: add public hook eglot-ma
From: |
João Távora |
Subject: |
[elpa] externals/eglot 8d8c90d 45/54: Fix #182: add public hook eglot-managed-mode-hook |
Date: |
Thu, 16 Apr 2020 05:31:52 -0400 (EDT) |
branch: externals/eglot
commit 8d8c90d0d654d262e0ff43f45444ec6a512b8185
Author: Felicián Németh <address@hidden>
Commit: Felicián Németh <address@hidden>
Fix #182: add public hook eglot-managed-mode-hook
Per #354.
* eglot.el (eglot-managed-p): New function.
(eglot--managed-mode-hook): Obsolete it.
(eglot-managed-mode-hook): New hook variable.
(eglot--managed-mode): Run the new hook.
* README.md (Customization): Mention the new hook.
---
README.md | 4 ++++
eglot.el | 15 ++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index fc20623..70f5837 100644
--- a/README.md
+++ b/README.md
@@ -290,6 +290,10 @@ lisp:
- `eglot-server-initialized-hook`: Hook run after server is
successfully initialized;
+- `eglot-managed-mode-hook`: Hook run after Eglot started or stopped
+ managing a buffer. Use `eglot-managed-p` to tell if current buffer
+ is still being managed.
+
# How does Eglot work?
`M-x eglot` starts a server via a shell-command guessed from
diff --git a/eglot.el b/eglot.el
index 7f506c8..4c65af0 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1234,6 +1234,17 @@ For example, to keep your Company customization use
(defvar-local eglot--cached-server nil
"A cached reference to the current EGLOT server.")
+(defun eglot-managed-p ()
+ "Tell if current buffer is managed by EGLOT."
+ eglot--managed-mode)
+
+(make-obsolete-variable
+ 'eglot--managed-mode-hook 'eglot-managed-mode-hook "1.6")
+
+(defvar eglot-managed-mode-hook nil
+ "A hook run by EGLOT after it started/stopped managing a buffer.
+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."
nil nil eglot-mode-map
@@ -1289,7 +1300,9 @@ For example, to keep your Company customization use
(delq (current-buffer) (eglot--managed-buffers server)))
(when (and eglot-autoshutdown
(null (eglot--managed-buffers server)))
- (eglot-shutdown server)))))))
+ (eglot-shutdown server))))))
+ ;; Note: the public hook runs before the internal eglot--managed-mode-hook.
+ (run-hooks 'eglot-managed-mode-hook))
(defun eglot--managed-mode-off ()
"Turn off `eglot--managed-mode' unconditionally."
- [elpa] externals/eglot ae0943f 40/54: Revert the last change about column calculation, (continued)
- [elpa] externals/eglot ae0943f 40/54: Revert the last change about column calculation, João Távora, 2020/04/16
- [elpa] externals/eglot e53dd5c 46/54: Per #354: make a public reader for project-nickname, João Távora, 2020/04/16
- [elpa] externals/eglot 4f6e152 51/54: Fix #430: send shutdown and exit messages without arguments, João Távora, 2020/04/16
- [elpa] externals/eglot 8332cdf 52/54: Fix eglot-move-to-lsp-abiding-column (#361), João Távora, 2020/04/16
- [elpa] externals/eglot 864a493 50/54: Close #323: add a simple github issue template, João Távora, 2020/04/16
- [elpa] externals/eglot 4496657 34/54: Close #393: use completing-read in eglot-code-actions, João Távora, 2020/04/16
- [elpa] externals/eglot 9c52f24 36/54: Fix #277: Send exit as a notification, João Távora, 2020/04/16
- [elpa] externals/eglot 9f10a27 42/54: Explain the animations in the README, João Távora, 2020/04/16
- [elpa] externals/eglot e02479a 54/54: * eglot.el (Version): Bump to 1.6, João Távora, 2020/04/16
- [elpa] externals/eglot 212a7f7 43/54: Per #315: call shutdown/exit methods with params:{}, not null, João Távora, 2020/04/16
- [elpa] externals/eglot 8d8c90d 45/54: Fix #182: add public hook eglot-managed-mode-hook,
João Távora <=
- [elpa] externals/eglot 16dd4b8 47/54: Close #414: mention eglot-find-* in README, João Távora, 2020/04/16
- [elpa] externals/eglot 2209779 49/54: Fix #425: Ignore empty hover info, João Távora, 2020/04/16
- [elpa] externals/eglot 606e234 48/54: Close #415: mention soft dependencies in README, João Távora, 2020/04/16
- [elpa] externals/eglot cacfd24 53/54: Fix #361: abide by LSP when reporting and moving to columns, João Távora, 2020/04/16