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

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

[elpa] externals/eglot 48c3f45 10/12: Close #22: Apply text edits as a s


From: João Távora
Subject: [elpa] externals/eglot 48c3f45 10/12: Close #22: Apply text edits as a single undoable edit
Date: Fri, 22 Jun 2018 11:52:17 -0400 (EDT)

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

    Close #22: Apply text edits as a single undoable edit
    
    As suggested by mkcms <address@hidden>, but do it in
    eglot--apply-text-edits, where it benefits all its users.
    
    Also, just using undo-boundary is not enough, one needs
    undo-amalgamate-change-group to mess with the boundaries already in
    buffer-undo-list.
    
    * eglot.el (eglot--apply-text-edits): Use
      undo-amalgamate-change-group.
---
 eglot.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/eglot.el b/eglot.el
index 9e686ee..2fdf433 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1584,7 +1584,8 @@ If SKIP-SIGNATURE, don't try to send 
textDocument/signatureHelp."
     (eglot--error "Edits on `%s' require version %d, you have %d"
                   (current-buffer) version eglot--versioned-identifier))
   (atomic-change-group
-    (let* ((howmany (length edits))
+    (let* ((change-group (prepare-change-group))
+           (howmany (length edits))
            (reporter (make-progress-reporter
                       (format "[eglot] applying %s edits to `%s'..."
                               howmany (current-buffer))
@@ -1604,6 +1605,7 @@ If SKIP-SIGNATURE, don't try to send 
textDocument/signatureHelp."
             (mapcar (eglot--lambda (&key range newText)
                       (cons newText (eglot--range-region range 'markers)))
                     edits))
+      (undo-amalgamate-change-group change-group)
       (progress-reporter-done reporter))))
 
 (defun eglot--apply-workspace-edit (wedit &optional confirm)



reply via email to

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