diff options
| author | João Távora | 2019-02-10 12:05:52 +0000 |
|---|---|---|
| committer | João Távora | 2019-02-10 12:06:24 +0000 |
| commit | b78363eb0f51126b2c22d26ea1b91f6e4569e167 (patch) | |
| tree | 885a218bc4ee01851dd6476ee470103bbb45d446 | |
| parent | f8e9da8bb6424215924b0de008b87c0c28fa930a (diff) | |
| download | emacs-b78363eb0f51126b2c22d26ea1b91f6e4569e167.tar.gz emacs-b78363eb0f51126b2c22d26ea1b91f6e4569e167.zip | |
Cleanup stale diagnostics on Flymake restart
Not doing so would cause duplicate diagnostics. See
https://github.com/joaotavora/eglot/issues/223 for an example.
* lisp/progmodes/flymake.el (Version): 1.0.4
(flymake-mode): Cleanup overlays before starting Flymake.
| -rw-r--r-- | lisp/progmodes/flymake.el | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index d7cb226773c..15a4d259859 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> | 5 | ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com> |
| 6 | ;; Maintainer: João Távora <joaotavora@gmail.com> | 6 | ;; Maintainer: João Távora <joaotavora@gmail.com> |
| 7 | ;; Version: 1.0.3 | 7 | ;; Version: 1.0.4 |
| 8 | ;; Package-Requires: ((emacs "26.1")) | 8 | ;; Package-Requires: ((emacs "26.1")) |
| 9 | ;; Keywords: c languages tools | 9 | ;; Keywords: c languages tools |
| 10 | 10 | ||
| @@ -974,6 +974,11 @@ special *Flymake log* buffer." :group 'flymake :lighter | |||
| 974 | (add-hook 'after-save-hook 'flymake-after-save-hook nil t) | 974 | (add-hook 'after-save-hook 'flymake-after-save-hook nil t) |
| 975 | (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t) | 975 | (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t) |
| 976 | 976 | ||
| 977 | ;; If Flymake happened to be alrady already ON, we must cleanup | ||
| 978 | ;; existing diagnostic overlays, lest we forget them by blindly | ||
| 979 | ;; reinitializing `flymake--backend-state' in the next line. | ||
| 980 | ;; See https://github.com/joaotavora/eglot/issues/223. | ||
| 981 | (mapc #'delete-overlay (flymake--overlays)) | ||
| 977 | (setq flymake--backend-state (make-hash-table)) | 982 | (setq flymake--backend-state (make-hash-table)) |
| 978 | (setq flymake--recent-changes nil) | 983 | (setq flymake--recent-changes nil) |
| 979 | 984 | ||