From: João Távora Date: Sat, 26 May 2018 15:13:53 +0000 (+0100) Subject: Simpify eglot--server-receive X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~541 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=545e9c8a1314aa095f6e12e9764011441f182bed;p=emacs.git Simpify eglot--server-receive * eglot.el (eglot--obj): Cleanup whitespace. (eglot--server-receive): Simplify. --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 8fe24ed1978..51bcc8bd2d2 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -115,7 +115,7 @@ lasted more than that many seconds." ;;; API (WORK-IN-PROGRESS!) ;;; -(defmacro eglot--obj (&rest what) +(defmacro eglot--obj (&rest what) "Make WHAT a JSON object suitable for `json-encode'." (declare (debug (&rest form))) ;; FIXME: not really API. Should it be? @@ -582,29 +582,28 @@ originated." (gethash id (eglot--pending-continuations server))))) (eglot--log-event server message 'server) (when error (setf (eglot--status server) `(,error t))) - (unless (or (null method) - (keywordp method)) + (unless (or (null method) (keywordp method)) (setq method (intern (format ":%s" method)))) - (cond ((and method id) - (condition-case-unless-debug _err - (apply #'eglot-handle-request server id method params) - (cl-no-applicable-method - (eglot--reply server id - :error `(:code -32601 :message "Method unimplemented"))))) - (method - (condition-case-unless-debug _err - (apply #'eglot-handle-notification server method params) - (cl-no-applicable-method - (eglot--log-event - server '(:error `(:message "Notification unimplemented")))))) - (continuations - (cancel-timer (cl-third continuations)) - (remhash id (eglot--pending-continuations server)) - (if error - (funcall (cl-second continuations) error) - (funcall (cl-first continuations) result))) - (id - (eglot--warn "Ooops no continuation for id %s" id))) + (cond + (method + (condition-case-unless-debug _err + (if id + (apply #'eglot-handle-request server id method params) + (apply #'eglot-handle-notification server method params)) + (cl-no-applicable-method + (if id + (eglot--reply + server id :error `(:code -32601 :message "Method unimplemented")) + (eglot--log-event + server '(:error `(:message "Notification unimplemented"))))))) + (continuations + (cancel-timer (cl-third continuations)) + (remhash id (eglot--pending-continuations server)) + (if error + (funcall (cl-second continuations) error) + (funcall (cl-first continuations) result))) + (id + (eglot--warn "Ooops no continuation for id %s" id))) (eglot--call-deferred server) (force-mode-line-update t))))