]> git.eshelyaron.com Git - emacs.git/commit
Work around a bug in emacs's change detection
authorJoão Távora <joaotavora@gmail.com>
Thu, 9 May 2019 10:38:58 +0000 (11:38 +0100)
committerJoão Távora <joaotavora@gmail.com>
Fri, 10 May 2019 21:28:36 +0000 (22:28 +0100)
commitfaa0500ff769e14365492ea6b1cc80c7e9d23725
treec918bfce493a490d5ffaf71a621337856b9fef30
parentc90f33dc212259220aea1cd9edf73cf1fe2c0826
Work around a bug in emacs's change detection

When using capitalize-word, or any case-fiddling function,
before-change-functions will record e.g. the whole word's start and
end, even though only the first character has changed.  Not only is
this longer than needed but also conflicts with what we get in
after-change-functions, which records just the one-char-long change.

Also, if the word didn't need any fiddling at all then
before-change-function will run but after-change-functions won't: an
"orphan" before-change will erroneously be sent to the server.

* eglot.el (eglot--after-change): Detect problematic case and fix
change description.
(eglot--before-change): Store markers of changed region.
(eglot--signal-textDocument/didChange): Weed out orphan changes.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/259
lisp/progmodes/eglot.el