branch: externals/eglot commit 48c3f455cf15ad9025821ca227885fcc826c6d54 Author: João Távora <joaotav...@gmail.com> Commit: João Távora <joaotav...@gmail.com>
Close #22: Apply text edits as a single undoable edit As suggested by mkcms <k.mic...@zoho.com>, 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)