]> git.eshelyaron.com Git - emacs.git/commitdiff
Bail early from eglot--apply-text-edits if nothing to do
authorJoão Távora <joaotavora@gmail.com>
Sun, 19 Mar 2023 19:44:31 +0000 (19:44 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sun, 19 Mar 2023 19:53:48 +0000 (19:53 +0000)
* lisp/progmodes/eglot.el (eglot--apply-text-edits): Early return.

lisp/progmodes/eglot.el

index dbd3eff67d15172754249b633af6de02cef053b3..7a076c134fc941bf1d713fb4ddfc05f9540ec1c3 100644 (file)
@@ -3219,8 +3219,9 @@ Returns a list as described in docstring of `imenu--index-alist'."
                                  ,(eglot--TextDocumentIdentifier))
                                :cancel-on-input non-essential))))))
 
-(defun eglot--apply-text-edits (edits &optional version)
+(cl-defun eglot--apply-text-edits (edits &optional version)
   "Apply EDITS for current buffer if at VERSION, or if it's nil."
+  (unless edits (cl-return-from eglot--apply-text-edits))
   (unless (or (not version) (equal version eglot--versioned-identifier))
     (jsonrpc-error "Edits on `%s' require version %d, you have %d"
                    (current-buffer) version eglot--versioned-identifier))