[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/flymake-refactor 7140018 25/52: Protect flymake-ui
From: |
João Távora |
Subject: |
[Emacs-diffs] scratch/flymake-refactor 7140018 25/52: Protect flymake-ui against commands like fill-paragraph |
Date: |
Sun, 1 Oct 2017 12:40:47 -0400 (EDT) |
branch: scratch/flymake-refactor
commit 71400181cdacd6f996284cbd5b9a41b98cf9b838
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Protect flymake-ui against commands like fill-paragraph
If flymake-start-syntax-check-on-newline is t, check should start as
soon as a newline is seen by after-change-functions. But don't rush
it because since the buffer state might not be final and we end up
with invalid diagnostic regions after some commands, like
fill-paragraph, which might insert and deletes newlines.
* lisp/progmodes/flymake-ui.el
(flymake-after-change-function): Pass `deferred' to
flymake--start-syntax-check.
(flymake--start-syntax-check): Take optional `deferred' arg.
---
lisp/progmodes/flymake-ui.el | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/flymake-ui.el b/lisp/progmodes/flymake-ui.el
index 4cdad95..25d8493 100644
--- a/lisp/progmodes/flymake-ui.el
+++ b/lisp/progmodes/flymake-ui.el
@@ -462,9 +462,16 @@ with flymake-specific meaning can also be used.
(when (with-current-buffer buffer (funcall (car candidate)))
(throw 'done (cdr candidate))))))
-(defun flymake--start-syntax-check ()
- (setq flymake-check-start-time (float-time))
- (funcall flymake--backend))
+(defun flymake--start-syntax-check (&optional deferred)
+ (cl-labels ((start
+ ()
+ (remove-hook 'post-command-hook #'start 'local)
+ (setq flymake-check-start-time (float-time))
+ (funcall flymake--backend)))
+ (if (and deferred
+ this-command)
+ (add-hook 'post-command-hook #'start 'append 'local)
+ (start))))
;;;###autoload
(define-minor-mode flymake-mode nil
@@ -534,7 +541,7 @@ with flymake-specific meaning can also be used.
(let((new-text (buffer-substring start stop)))
(when (and flymake-start-syntax-check-on-newline (equal new-text "\n"))
(flymake-log 3 "starting syntax check as new-line has been seen")
- (flymake--start-syntax-check))
+ (flymake--start-syntax-check 'deferred))
(setq flymake-last-change-time (float-time))))
(defun flymake-after-save-hook ()
- [Emacs-diffs] scratch/flymake-refactor 4292342 13/52: Further simplify progmodes/flymake-ui.el, (continued)
- [Emacs-diffs] scratch/flymake-refactor 4292342 13/52: Further simplify progmodes/flymake-ui.el, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor c5cc7e9 17/52: Make debugging flymake-proc.el easier, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 2693054 14/52: Flymake faces are not just for "lines" anymore, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 991c88f 18/52: flymake-warning face easier to distinguish from flymake-error, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 12aa247 19/52: Protect against timer triggers when no flymake-mode, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 740572e 05/52: Completely rewrite flymake's subprocess output processing, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 14db516 22/52: flymake-ui.el checks file names before considering diagnostics, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 61ba20b 21/52: Echo flymake error messages when navigating errors interactively, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor b2c4135 15/52: Clarify logic around flymake-diagnostic-types-alist, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor bac7512 12/52: New flymake-diagnostic-types-alist and more cleanup, João Távora, 2017/10/01
- [Emacs-diffs] scratch/flymake-refactor 7140018 25/52: Protect flymake-ui against commands like fill-paragraph,
João Távora <=
- [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