[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/flymake-refactor e1b913f 11/12: Re-implement wrapa
From: |
João Távora |
Subject: |
[Emacs-diffs] scratch/flymake-refactor e1b913f 11/12: Re-implement wraparound for flymake-goto-next-error |
Date: |
Wed, 27 Sep 2017 13:47:30 -0400 (EDT) |
branch: scratch/flymake-refactor
commit e1b913f316ffb6faa0a90c4bf81cf1b58793bf24
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Re-implement wraparound for flymake-goto-next-error
Manual mentions this, so it's probably a good idea to keep it. Added
a defcustom flymake-wrap-around to control this.
* lisp/progmodes/flymake-ui.el (flymake-wrap-around): New variable.
(flymake-goto-next-error): Wrap around according to flymake-wrap-around.
* test/lisp/progmodes/flymake-tests.el (different-diagnostic-types)
(dummy-backends): Use flymake-wrap-around.
---
lisp/progmodes/flymake-ui.el | 26 +++++++++++++++++++-------
test/lisp/progmodes/flymake-tests.el | 6 ++++--
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/lisp/progmodes/flymake-ui.el b/lisp/progmodes/flymake-ui.el
index f39ecf4..4ac9e0a 100644
--- a/lisp/progmodes/flymake-ui.el
+++ b/lisp/progmodes/flymake-ui.el
@@ -115,6 +115,10 @@ See `flymake-error-bitmap' and `flymake-warning-bitmap'."
"it is superseded by `warning-minimum-log-level.'"
"26.1")
+(defcustom flymake-wrap-around t
+ "If non-nil, moving to errors wraps around buffer boundaries."
+ :group 'flymake :type 'boolean)
+
(defvar-local flymake-timer nil
"Timer for starting syntax check.")
@@ -693,13 +697,21 @@ diagnostics of type `:error' and `:warning'."
filter)))))
:compare (if (cl-plusp n) #'< #'>)
:key #'overlay-start))
- (chain (cl-member-if (lambda (ov)
- (if (cl-plusp n)
- (> (overlay-start ov)
- (point))
- (< (overlay-start ov)
- (point))))
- ovs))
+ (tail (cl-member-if (lambda (ov)
+ (if (cl-plusp n)
+ (> (overlay-start ov)
+ (point))
+ (< (overlay-start ov)
+ (point))))
+ ovs))
+ (chain (if flymake-wrap-around
+ (if tail
+ (progn
+ (setcdr (last tail) ovs)
+ tail)
+ (setcdr (last ovs) ovs)
+ ovs)
+ tail))
(target (nth (1- n) chain)))
(cond (target
(goto-char (overlay-start target))
diff --git a/test/lisp/progmodes/flymake-tests.el
b/test/lisp/progmodes/flymake-tests.el
index 494d1c9..e313846 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -128,7 +128,8 @@ SEVERITY-PREDICATE is used to setup
(should (eq 'flymake-warning (face-at-point)))
(flymake-goto-next-error)
(should (eq 'flymake-error (face-at-point)))
- (should-error (flymake-goto-next-error nil nil t)) ))
+ (let ((flymake-wrap-around nil))
+ (should-error (flymake-goto-next-error nil nil t))) ))
(defmacro flymake-tests--assert-set (set
should
@@ -243,7 +244,8 @@ SEVERITY-PREDICATE is used to setup
(should (eq 'flymake-warning (face-at-point))) ; dolor
(flymake-goto-next-error)
(should (eq 'flymake-error (face-at-point))) ; prognata
- (should-error (flymake-goto-next-error nil nil t))))))
+ (let ((flymake-wrap-around nil))
+ (should-error (flymake-goto-next-error nil nil t)))))))
(provide 'flymake-tests)
- [Emacs-diffs] scratch/flymake-refactor updated (7140018 -> 3b6c736), João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor d68448f 01/12: More cleanup before advancing to backend redesign, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 245114e 08/12: Fix autoload conflict between flymake.el and flymake-ui.el, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 879dcef 04/12: Misc cleanup in flymake-proc.el, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor e1b913f 11/12: Re-implement wraparound for flymake-goto-next-error,
João Távora <=
- [Emacs-diffs] scratch/flymake-refactor 8e42a5d 06/12: Cleanup some flymake-ui.el internals, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 3dfe11c 03/12: Simplify flymake logging and erroring., João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 820b460 10/12: Add interactive flymake-start function, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 4fea8a9 05/12: Allow filtering in flymake-goto-[next/prev]-error, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 4e2cbaa 07/12: Fancy mode-line construct for flymake-mode, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 3b6c736 12/12: Start rewriting flymake manual, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 26f1e0c 02/12: Replace flymake-backends with flymake-diagnostic-functions, João Távora, 2017/09/27
- [Emacs-diffs] scratch/flymake-refactor 7a22358 09/12: A couple of new flymake backends for emacs-lisp-mode, João Távora, 2017/09/27