[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/flymake-refactor e1b913f 36/52: Re-implement wrapa
From: |
João Távora |
Subject: |
[Emacs-diffs] scratch/flymake-refactor e1b913f 36/52: Re-implement wraparound for flymake-goto-next-error |
Date: |
Sun, 1 Oct 2017 12:40:49 -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 d3168cf 09/52: Make lisp/progmodes/flymake-ui.el some 150 lines lighter, (continued)
- [Emacs-diffs] scratch/flymake-refactor d3168cf 09/52: Make lisp/progmodes/flymake-ui.el some 150 lines lighter, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor f3b8a72 20/52: Refactor flymake-tests.el in preparation for more tests, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 593d4303 23/52: Add a new flymake test for multiple errors and warnings, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor d68448f 26/52: More cleanup before advancing to backend redesign, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 245114e 33/52: Fix autoload conflict between flymake.el and flymake-ui.el, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 4fea8a9 30/52: Allow filtering in flymake-goto-[next/prev]-error, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 192cb7f 24/52: flymake-ui.el highlights GCC notes detected by flymake-proc.el, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 879dcef 29/52: Misc cleanup in flymake-proc.el, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 820b460 35/52: Add interactive flymake-start function, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 8e42a5d 31/52: Cleanup some flymake-ui.el internals, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor e1b913f 36/52: Re-implement wraparound for flymake-goto-next-error,
João Távora <=
- [Emacs-diffs] scratch/flymake-refactor 3dfe11c 28/52: Simplify flymake logging and erroring., João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 9329265 40/52: Treat flymake errors as just another type of diagnostic, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 38c7d4f 41/52: Remove old flymake-display-err-menu-for-current-line, it's useless, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 7a22358 34/52: A couple of new flymake backends for emacs-lisp-mode, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 9d93d46 42/52: New flymake fringe bitmaps, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 4e2cbaa 32/52: Fancy mode-line construct for flymake-mode, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 54ec5eb 47/52: Improve use of flymake-no-changes-timeout, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 95c126c 46/52: flymake-diagnostic-types-alist now uses flymake-category, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 1d58e32 39/52: Fix flymake-wrap-around for buffers with no errors, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 1116aa7 43/52: * lisp/progmodes/flymake-ui.el (flymake-mode-map): Bind "M-n" and "M-p", João Távora, 2017/10/01