diff options
author | João Távora <joaotavora@gmail.com> | 2017-11-11 23:44:52 +0000 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2017-11-11 23:44:52 +0000 |
commit | e286b3381fa1be64174832560da963b1c0191640 (patch) | |
tree | 868f64028e662664e8d47d21027213f812f20d68 /lisp | |
parent | 9533d76b0b5bfe2df1cccc55a92c2545b1de4e2b (diff) | |
download | emacs-e286b3381fa1be64174832560da963b1c0191640.tar.gz |
Fix more flymake-diag-region eob corner cases and add tests (bug#29201)
* lisp/progmodes/flymake.el (flymake-diag-region): Correct
more eob corner cases.
* test/lisp/progmodes/flymake-tests.el
(eob-region-and-trailing-newline): New test.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/progmodes/flymake.el | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index b4ab7f223f2..241ea00d645 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -318,7 +318,11 @@ region is invalid." (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 @@ region is invalid." (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))))))) |