summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2019-07-04 00:34:26 +0100
committerJoão Távora <joaotavora@gmail.com>2019-07-04 00:38:46 +0100
commit5b48dab412c61980bca63a67a5d548d07e56b404 (patch)
tree42a9d05e5c1022321e1c7f98381ef68e76d9d1ac
parent22d99801edb8647c7adad01e6825a12849426419 (diff)
downloademacs-5b48dab412c61980bca63a67a5d548d07e56b404.tar.gz
Fix Flymake's user-visible accessors of diagnostic positions
Diagnostics are supported by overlays, and they can legitimately move around. So flymake-diagnostic-beg and flymake-diagnostic-end must look up the overlay positions, not the immutable slots of the flymake--diag structure, which become stale. * lisp/progmodes/flymake.el (version): Bump to 1.0.8. (flymake-diagnostic-beg, flymake-diagnostic-end): Use diag's overlay. (flymake-show-diagnostic): Use flymake-diagnostic-end, flymake-diagnostic-beg.
-rw-r--r--lisp/progmodes/flymake.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index d662aaf4257..e8a4334fe96 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -4,7 +4,7 @@
;; Author: Pavel Kobyakov <pk_at_work@yahoo.com>
;; Maintainer: João Távora <joaotavora@gmail.com>
-;; Version: 1.0.7
+;; Version: 1.0.8
;; Package-Requires: ((emacs "26.1"))
;; Keywords: c languages tools
@@ -344,11 +344,17 @@ diagnostics at BEG."
(flymake--diag-accessor flymake-diagnostic-buffer flymake--diag-buffer buffer)
(flymake--diag-accessor flymake-diagnostic-text flymake--diag-text text)
(flymake--diag-accessor flymake-diagnostic-type flymake--diag-type type)
-(flymake--diag-accessor flymake-diagnostic-beg flymake--diag-beg beg)
-(flymake--diag-accessor flymake-diagnostic-end flymake--diag-end end)
(flymake--diag-accessor flymake-diagnostic-backend flymake--diag-backend backend)
(flymake--diag-accessor flymake-diagnostic-data flymake--diag-data backend)
+(defun flymake-diagnostic-beg (diag)
+ "Get Flymake diagnostic DIAG's start position."
+ (overlay-start (flymake--diag-overlay diag)))
+
+(defun flymake-diagnostic-end (diag)
+ "Get Flymake diagnostic DIAG's end position."
+ (overlay-end (flymake--diag-overlay diag)))
+
(cl-defun flymake--overlays (&key beg end filter compare key)
"Get flymake-related overlays.
If BEG is non-nil and END is nil, consider only `overlays-at'
@@ -1294,8 +1300,8 @@ default) no filter is applied."
(with-selected-window
(display-buffer (current-buffer) other-window)
(goto-char (flymake--diag-beg diag))
- (pulse-momentary-highlight-region (flymake--diag-beg diag)
- (flymake--diag-end diag)
+ (pulse-momentary-highlight-region (flymake-diagnostic-beg diag)
+ (flymake-diagnostic-end diag)
'highlight))
(current-buffer))))