[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa c948713 035/139: Auto-reconnect on unexpected conn
From: |
João Távora |
Subject: |
[elpa] externals/elpa c948713 035/139: Auto-reconnect on unexpected connection loss |
Date: |
Mon, 14 May 2018 09:53:30 -0400 (EDT) |
branch: externals/elpa
commit c948713b050fe209572b362799ae688d1c0629f6
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Auto-reconnect on unexpected connection loss
* eglot.el (eglot-reconnect): Only quit if indeed not quit
already.
(eglot-new-process): Burn the command in the bootstrap fn.
(eglot--process-sentinel): Automatically reconnect if closed
unexpectedly.
(eglot--warn): Also message to *Messages*
---
eglot.el | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/eglot.el b/eglot.el
index aa23252..71dab80 100644
--- a/eglot.el
+++ b/eglot.el
@@ -162,7 +162,8 @@ Call SUCCESS-FN with no args if all goes well."
"Reconnect to PROCESS.
INTERACTIVE is t if called interactively."
(interactive (list (eglot--current-process-or-lose) t))
- (eglot-quit-server process 'sync interactive)
+ (when (process-live-p process)
+ (eglot-quit-server process 'sync interactive))
(eglot--connect (eglot--short-name process)
(eglot--bootstrap-fn process)
(lambda ()
@@ -174,7 +175,12 @@ INTERACTIVE is t if called interactively."
(interactive (list t))
(let ((project (project-current)))
(unless project (eglot--error "(new-process) Cannot work without a current
project!"))
- (let ((current-process (eglot--current-process)))
+ (let ((current-process (eglot--current-process))
+ (command (let ((probe (cdr (assoc major-mode eglot-executables))))
+ (unless probe
+ (eglot--error "Don't know how to start EGLOT for %s
buffers"
+ major-mode))
+ probe)))
(cond ((and current-process
(process-live-p current-process))
(eglot--message "(new-process) Reconnecting instead")
@@ -187,11 +193,7 @@ INTERACTIVE is t if called interactively."
(lambda (name)
(eglot-make-local-process
name
- (let ((probe (cdr (assoc major-mode eglot-executables))))
- (unless probe
- (eglot--error "Don't know how to start EGLOT for %s
buffers"
- major-mode))
- probe)))
+ command))
(lambda ()
(eglot--message "Connected")
(dolist (buffer (buffer-list))
@@ -221,8 +223,10 @@ INTERACTIVE is t if called interactively."
(eglot--message "(sentinel) Moribund process exited with status %s"
(process-exit-status process)))
(t
- (eglot--warn "(sentinel) Process unexpectedly changed to %s"
- change)))
+ (eglot--warn
+ "(sentinel) Reconnecting after process unexpectedly changed to %s."
+ change)
+ (eglot-reconnect process)))
(delete-process process)))
(defun eglot--process-filter (proc string)
@@ -633,6 +637,7 @@ running. INTERACTIVE is t if called interactively."
(defun eglot--warn (format &rest args)
"Warning message with FORMAT and ARGS."
+ (apply #'eglot--message (concat "(warning) " format) args)
(let ((warning-minimum-level :error))
(display-warning 'eglot
(apply #'format format args)
- [elpa] externals/elpa efd14d6 015/139: Fix mode line, (continued)
- [elpa] externals/elpa efd14d6 015/139: Fix mode line, João Távora, 2018/05/14
- [elpa] externals/elpa c222c3b 019/139: Lay groundwork for uniform treatment of network connections, João Távora, 2018/05/14
- [elpa] externals/elpa 16be2fc 020/139: Fix parser to accept multiple messages in one chunk, João Távora, 2018/05/14
- [elpa] externals/elpa 6f0a8df 008/139: Organize a bit, João Távora, 2018/05/14
- [elpa] externals/elpa 0222e7e 007/139: Improve `eglot--current-process', João Távora, 2018/05/14
- [elpa] externals/elpa 7c82a03 024/139: Start experimenting with python, João Távora, 2018/05/14
- [elpa] externals/elpa 8bd634c 016/139: Start working on this again, João Távora, 2018/05/14
- [elpa] externals/elpa dfab9a0 011/139: Experimental diagnostic overlays, João Távora, 2018/05/14
- [elpa] externals/elpa 22dc2f7 034/139: Ready to start fixing flymake integration, João Távora, 2018/05/14
- [elpa] externals/elpa 931093e 032/139: Don't clutter UI with warnings, João Távora, 2018/05/14
- [elpa] externals/elpa c948713 035/139: Auto-reconnect on unexpected connection loss,
João Távora <=
- [elpa] externals/elpa 3489176 004/139: Add a mode-line construct and some minor fanciness, João Távora, 2018/05/14
- [elpa] externals/elpa bc011d0 010/139: Minor cleanup, João Távora, 2018/05/14
- [elpa] externals/elpa e1d36d2 014/139: Fix some byte-compilation warnings, João Távora, 2018/05/14
- [elpa] externals/elpa 1dc2a9f 021/139: Implement spinners and RLS's window/progress, João Távora, 2018/05/14
- [elpa] externals/elpa 95983c9 028/139: Change status to error everytime an error is found, João Távora, 2018/05/14
- [elpa] externals/elpa 328c7ae 025/139: Auto update mode-line after setting some process properties, João Távora, 2018/05/14
- [elpa] externals/elpa 2775dea 003/139: Rename eglot--continuations eglot--pending-continuations, João Távora, 2018/05/14
- [elpa] externals/elpa 75495dc 033/139: Slightly more user friendly start, João Távora, 2018/05/14
- [elpa] externals/elpa 6f6f01d 018/139: Doc fixes, João Távora, 2018/05/14
- [elpa] externals/elpa 0ec7801 012/139: Simplify `eglot--protocol-initialize`, João Távora, 2018/05/14