From 81b7c8e7d736d4118cb52afcaf6a46a55646fabf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 21 Jun 2018 17:48:10 +0100 Subject: [PATCH] Apply text edits as a single undoable edit As suggested by mkcms , 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. GitHub-reference: close https://github.com/joaotavora/eglot/issues/22 --- lisp/progmodes/eglot.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 9e686eece63..2fdf433c55a 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/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) -- 2.39.2