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

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

[elpa] externals/eglot 0b9cffe 08/12: Per #22: Apply text edits atomical


From: João Távora
Subject: [elpa] externals/eglot 0b9cffe 08/12: Per #22: Apply text edits atomically
Date: Fri, 22 Jun 2018 11:52:16 -0400 (EDT)

branch: externals/eglot
commit 0b9cffeda617679772f88f4c232f0b8704c1ae33
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Per #22: Apply text edits atomically
    
    As suggested by mkcms <address@hidden>, but do it in
    eglot--apply-text-edits, where it benefits all its users.
    
    * eglot.el (eglot--apply-text-edits): Use atomic-change-group.
---
 eglot.el | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/eglot.el b/eglot.el
index e96a3e6..489e365 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1583,17 +1583,18 @@ If SKIP-SIGNATURE, don't try to send 
textDocument/signatureHelp."
   (unless (or (not version) (equal version eglot--versioned-identifier))
     (eglot--error "Edits on `%s' require version %d, you have %d"
                   (current-buffer) version eglot--versioned-identifier))
-  (mapc (pcase-lambda (`(,newText ,beg . ,end))
-          (save-restriction
-            (narrow-to-region beg end)
-            (let ((source (current-buffer)))
-              (with-temp-buffer
-                (insert newText)
-                (let ((temp (current-buffer)))
-                  (with-current-buffer source (replace-buffer-contents 
temp)))))))
-        (mapcar (eglot--lambda (&key range newText)
-                  (cons newText (eglot--range-region range 'markers)))
-                edits))
+  (atomic-change-group
+    (mapc (pcase-lambda (`(,newText ,beg . ,end))
+            (save-restriction
+              (narrow-to-region beg end)
+              (let ((source (current-buffer)))
+                (with-temp-buffer
+                  (insert newText)
+                  (let ((temp (current-buffer)))
+                    (with-current-buffer source (replace-buffer-contents 
temp)))))))
+          (mapcar (eglot--lambda (&key range newText)
+                    (cons newText (eglot--range-region range 'markers)))
+                  edits)))
   (eglot--message "%s: Performed %s edits" (current-buffer) (length edits)))
 
 (defun eglot--apply-workspace-edit (wedit &optional confirm)



reply via email to

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