bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29201: 26.0.90; Flymake skips indicator when a backend reports a dia


From: João Távora
Subject: bug#29201: 26.0.90; Flymake skips indicator when a backend reports a diagnostic at EOB
Date: Fri, 10 Nov 2017 05:32:17 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)

Dmitry Gutov <dgutov@yandex.ru> writes:

> So I think the important point is to skip the trailing whitespace
> first. Maybe this calls for a test case or two.

Indeed, the tests to flymake-diag-region should be 6-fold though. Two
tests, with and without column indication, where eob is being pointed
to, for each of these buffer fixtures

   w/o trailing newline -> highlight last line of visible chars
   with trailing newline -> highlight last line of visible chars
   with two trailing newlines -> highlight wide last line of whitespace

...but I'm too lazy at this time of night to do the tests, though I
do have the patch I think should fix them :-)

Thanks,
João

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index b4ab7f223f..241ea00d64 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -318,7 +318,11 @@ flymake-diag-region
             (goto-char (point-min))
             (forward-line (1- line))
             (cl-flet ((fallback-bol
-                       () (progn (back-to-indentation) (point)))
+                       ()
+                       (back-to-indentation)
+                       (if (eobp)
+                           (line-beginning-position 0)
+                         (point)))
                       (fallback-eol
                        (beg)
                        (progn
@@ -335,11 +339,11 @@ flymake-diag-region
                                        (not (= sexp-end beg))
                                        sexp-end)
                                   (and (< (goto-char (1+ beg)) (point-max))
-                                       (point))))
-                         (safe-end (or end
-                                       (fallback-eol beg))))
-                    (cons (if end beg (fallback-bol))
-                          safe-end))
+                                       (point)))))
+                    (if end
+                        (cons beg end)
+                      (cons (setq beg (fallback-bol))
+                            (fallback-eol beg))))
                 (let* ((beg (fallback-bol))
                        (end (fallback-eol beg)))
                   (cons beg end)))))))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]