bug#81621: 32.0.50; regression in 6223d243da3f45 - cursor moves erratically
João Távora <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
Platon Pronko <[email protected]> writes: > I am using lsp-mode with company-box for completions display. If > completion popup is visible and I type characters, the position of the > cursor jumps around, seemingly to the beginning of line or file. > > How to reproduce: > If I wrap this goto-char & apply block in save-excursion, then the > problem goes away. I couldn't reproduce (sorry, too much setup), but I think you're right, this was a bit sloppy, indeed. I'll push the patch after my sig master shortly, then you can test. João diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 2d9ff648dce..6a36aa9845f 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1256,13 +1256,15 @@ flymake-make-report-fn BACKEND is used to help Flymake distinguish different diagnostic sources. If provided, TOKEN helps Flymake distinguish between different runs of the same backend." - (let ((buffer (current-buffer)) - (point (point))) + (let ((buffer (current-buffer)) (p (point-marker))) (lambda (&rest args) (when (buffer-live-p buffer) (with-current-buffer buffer - (goto-char point) - (apply #'flymake--handle-report backend token args)))))) + (save-excursion + (goto-char p) + (unwind-protect + (apply #'flymake--handle-report backend token args) + (set-marker p nil)))))))) (defun flymake--collect (fn &optional message-prefix) "Collect Flymake backends matching FN.