emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eglot 059ea59 43/69: Optionally shutdown after killing


From: João Távora
Subject: [elpa] externals/eglot 059ea59 43/69: Optionally shutdown after killing last buffer of managed project (#309)
Date: Sun, 20 Oct 2019 08:21:50 -0400 (EDT)

branch: externals/eglot
commit 059ea59d5f4453090629e1382762d264e7d8831c
Author: Ingo Lohmar <address@hidden>
Commit: João Távora <address@hidden>

    Optionally shutdown after killing last buffer of managed project (#309)
    
    This should close issue #217, also cf. #270.
    
    * eglot.el (eglot-autoshutdown): New defcustom.
    (eglot--managed-mode-onoff): Shutdown if so configured and
    no managed buffers left.
    
    Co-authored-by: João Távora <address@hidden>
---
 eglot.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index 279fbee..cf2f371 100644
--- a/eglot.el
+++ b/eglot.el
@@ -170,6 +170,10 @@ as 0, i.e. don't block at all."
   :type '(choice (boolean :tag "Whether to inhibit autoreconnection")
                  (integer :tag "Number of seconds")))
 
+(defcustom eglot-autoshutdown nil
+  "If non-nil, shut down server after killing last managed buffer."
+  :type 'boolean)
+
 (defcustom eglot-events-buffer-size 2000000
   "Control the size of the Eglot events buffer.
 If a number, don't let the buffer grow larger than that many
@@ -1224,7 +1228,11 @@ Reset in `eglot--managed-mode-onoff'.")
              (setq eglot--cached-current-server nil)
              (when server
                (setf (eglot--managed-buffers server)
-                     (delq buf (eglot--managed-buffers server)))))))))
+                     (delq buf (eglot--managed-buffers server)))
+               (when (and eglot-autoshutdown
+                          (not (eglot--shutdown-requested server))
+                          (not (eglot--managed-buffers server)))
+                 (eglot-shutdown server))))))))
 
 (defun eglot--current-server ()
   "Find the current logical EGLOT server."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]