[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa 77856c2 130/139: Reinstate the catch/loop/throw id
From: |
João Távora |
Subject: |
[elpa] externals/elpa 77856c2 130/139: Reinstate the catch/loop/throw idiom in eglot-request |
Date: |
Mon, 14 May 2018 09:53:49 -0400 (EDT) |
branch: externals/elpa
commit 77856c2f9194b6975421be411d80cfcf102fd10d
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Reinstate the catch/loop/throw idiom in eglot-request
This reverts parts of commit 29f58a6514aec28e4e6df9611e4f58c7289e3cc6.
Unfortunately, this may cause problems when calling the error
callbacks directly as in the process sentinel. In that particular
scenario the accept-process-output won't have return, because no
output has is being handled. Consequently, if we're unlucky, we have
another 30 seconds to way before the flag is tested and the loop
exits.
* eglot.el (eglot-request): Use catch/loop/throw again
---
eglot.el | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/eglot.el b/eglot.el
index 13f6f61..6f90349 100644
--- a/eglot.el
+++ b/eglot.el
@@ -651,20 +651,25 @@ DEFERRED is passed to `eglot--async-request', which see."
;; bad idea, since that might lead to the request never having a
;; chance to run, because `eglot--ready-predicates'.
(when deferred (eglot--signal-textDocument/didChange))
- (let ((retval))
- (eglot--async-request
- proc method params
- :success-fn (lambda (&rest args)
- (setq retval `(done ,(if (vectorp (car args))
- (car args) args))))
- :error-fn (eglot--lambda (&key code message &allow-other-keys)
- (setq retval `(error ,(format "Oops: %s: %s" code message))))
- :timeout-fn (lambda ()
- (setq retval '(error "Timed out")))
- :deferred deferred)
- (while (not retval) (accept-process-output nil 30))
- (when (eq 'error (car retval)) (eglot--error (cadr retval)))
- (cadr retval)))
+ (let* ((done (make-symbol "eglot--request-catch-tag"))
+ (res
+ (catch done (eglot--async-request
+ proc method params
+ :success-fn (lambda (&rest args)
+ (throw done (if (vectorp (car args))
+ (car args) args)))
+ :error-fn (eglot--lambda
+ (&key code message &allow-other-keys)
+ (throw done
+ `(error ,(format "Oops: %s: %s"
+ code message))))
+ :timeout-fn (lambda ()
+ (throw done '(error "Timed out")))
+ :deferred deferred)
+ ;; now spin, baby!
+ (while t (accept-process-output nil 0.01)))))
+ (when (and (listp res) (eq 'error (car res))) (eglot--error (cadr res)))
+ res))
(cl-defun eglot--notify (process method params)
"Notify PROCESS of something, don't expect a reply.e"
- [elpa] externals/elpa 0625b6c 123/139: (eglot--xref-make): Fix Use of cl-destructuring-bind., (continued)
- [elpa] externals/elpa 0625b6c 123/139: (eglot--xref-make): Fix Use of cl-destructuring-bind., João Távora, 2018/05/14
- [elpa] externals/elpa 56cf02d 126/139: Rework autoreconnection logic, João Távora, 2018/05/14
- [elpa] externals/elpa 49fb02f 135/139: Use RLS in Travis CI and add actual tests, João Távora, 2018/05/14
- [elpa] externals/elpa 29f58a6 127/139: Get rid of catch/loop/throw idiom (suggested by Thien-Thi Nguyen), João Távora, 2018/05/14
- [elpa] externals/elpa 418412b 131/139: Fix copyright header. Obviously not since 2003, João Távora, 2018/05/14
- [elpa] externals/elpa 54fc885 113/139: More RLS-specifics: update Flymake diags when indexing done, João Távora, 2018/05/14
- [elpa] externals/elpa 8a80fb7 105/139: Simplify `eglot-shutdown`, João Távora, 2018/05/14
- [elpa] externals/elpa d40f9ac 094/139: Half-decent imenu support via textDocument/documentSymbol, João Távora, 2018/05/14
- [elpa] externals/elpa 42177d0 107/139: New "deferred requests" that wait until server is ready, João Távora, 2018/05/14
- [elpa] externals/elpa ef80455 121/139: Support :completionItem/resolve, João Távora, 2018/05/14
- [elpa] externals/elpa 77856c2 130/139: Reinstate the catch/loop/throw idiom in eglot-request,
João Távora <=
- [elpa] externals/elpa d1cdcf1 119/139: Friendlier M-x eglot, João Távora, 2018/05/14
- [elpa] externals/elpa 4c0bfc3 139/139: Support didChangeWatchedFiles with dynamic registration, João Távora, 2018/05/14
- [elpa] externals/elpa fceb6bb 090/139: Get rid of eglot--special-buffer-process, João Távora, 2018/05/14
- [elpa] externals/elpa 714e5be 086/139: Half-baked textDocument/hover support, João Távora, 2018/05/14
- [elpa] externals/elpa e9b5e54 077/139: ETOOMANYLAMBDAS, João Távora, 2018/05/14
- [elpa] externals/elpa f257d63 089/139: * eglot.el: Reformat to shave off some lines., João Távora, 2018/05/14
- [elpa] externals/elpa 5ce9ab0 106/139: Call eglot-eldoc-function after completion finishes, João Távora, 2018/05/14
- [elpa] externals/elpa d431d41 088/139: Fix bug in hover support, João Távora, 2018/05/14
- [elpa] externals/elpa d0b7773 117/139: Reduce log chatter, João Távora, 2018/05/14
- [elpa] externals/elpa 9af84a2 124/139: Prepare to sumbit to GNU ELPA, João Távora, 2018/05/14