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

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

[elpa] externals/eglot 65aadca 46/49: Fix #620: simplify eglot--apply-wo


From: Stefan Monnier
Subject: [elpa] externals/eglot 65aadca 46/49: Fix #620: simplify eglot--apply-workspace-edit
Date: Wed, 17 Mar 2021 18:41:51 -0400 (EDT)

branch: externals/eglot
commit 65aadca313c07f93c11578520b2740eb52f2ddfd
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Fix #620: simplify eglot--apply-workspace-edit
    
    Suggested by Brian Leung.
    
    * eglot.el (eglot--apply-workspace-edit): simplify
---
 eglot.el | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/eglot.el b/eglot.el
index 964658a..f7632cb 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2530,8 +2530,7 @@ is not active."
                      (eglot--dbind ((VersionedTextDocumentIdentifier) uri 
version)
                          textDocument
                        (list (eglot--uri-to-path uri) edits version)))
-                   documentChanges))
-          edit)
+                   documentChanges)))
       (cl-loop for (uri edits) on changes by #'cddr
                do (push (list (eglot--uri-to-path uri) edits) prepared))
       (if (or confirm
@@ -2541,17 +2540,11 @@ is not active."
                    (format "[eglot] Server wants to edit:\n  %s\n Proceed? "
                            (mapconcat #'identity (mapcar #'car prepared) "\n  
")))
             (eglot--error "User cancelled server edit")))
-      (while (setq edit (car prepared))
-        (pcase-let ((`(,path ,edits ,version)  edit))
-          (with-current-buffer (find-file-noselect path)
-            (eglot--apply-text-edits edits version))
-          (pop prepared))
-        t)
-      (unwind-protect
-          (if prepared (eglot--warn "Caution: edits of files %s failed."
-                                    (mapcar #'car prepared))
-            (eldoc)
-            (eglot--message "Edit successful!"))))))
+      (cl-loop for edit in prepared
+               for (path edits version) = edit
+               do (with-current-buffer (find-file-noselect path)
+                    (eglot--apply-text-edits edits version))
+               finally (eldoc) (eglot--message "Edit successful!")))))
 
 (defun eglot-rename (newname)
   "Rename the current symbol to NEWNAME."



reply via email to

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