GNU bug report logs - #29201
26.0.90; Flymake skips indicator when a backend reports a diagnostic at EOB

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Tue, 7 Nov 2017 23:28:02 UTC

Severity: normal

Tags: fixed

Found in version 26.0.90

Fixed in version 26.1

Done: joaotavora <at> gmail.com (João Távora)

Bug is archived. No further changes may be made.

Full log


Message #18 received at 29201 <at> debbugs.gnu.org (full text, mbox):

From: joaotavora <at> gmail.com (João Távora)
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 29201 <at> debbugs.gnu.org
Subject: Re: 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
Dmitry Gutov <dgutov <at> 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)))))))





This bug report was last modified 7 years and 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.