From: joaotavora@gmail.com (João Távora)
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 29201@debbugs.gnu.org
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 [thread overview]
Message-ID: <87k1yyitr2.fsf@gmail.com> (raw)
In-Reply-To: <638b80d6-2772-7650-b4ac-f43c3146bfaf@yandex.ru> (Dmitry Gutov's message of "Fri, 10 Nov 2017 02:02:04 +0200")
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)))))))
next prev parent reply other threads:[~2017-11-10 5:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-07 23:26 bug#29201: 26.0.90; Flymake skips indicator when a backend reports a diagnostic at EOB Dmitry Gutov
2017-11-09 21:18 ` João Távora
2017-11-10 0:02 ` Dmitry Gutov
2017-11-10 5:32 ` João Távora [this message]
2017-11-10 11:19 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k1yyitr2.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=29201@debbugs.gnu.org \
--cc=dgutov@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).