[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs-26 b0bb181 15/39: Protect Flymake's eager checks aga
From: |
João Távora |
Subject: |
[Emacs-diffs] emacs-26 b0bb181 15/39: Protect Flymake's eager checks against commands like fill-paragraph |
Date: |
Tue, 3 Oct 2017 10:04:49 -0400 (EDT) |
branch: emacs-26
commit b0bb181f9359aff07b09b919b8af397ef39d6784
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Protect Flymake's eager checks 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: since the buffer state might not be final, we might end up with
invalid diagnostic regions after some commands silently insert and
delete newlines (looking at you, fill-paragraph).
* lisp/progmodes/flymake.el (flymake-after-change-function): Pass
`deferred' to flymake--start-syntax-check.
(flymake--start-syntax-check): Take optional `deferred' arg.
---
lisp/progmodes/flymake.el | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index b32e799..b5abf5c 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -475,6 +475,17 @@ If TYPE doesn't declare PROP in either
(flymake-report-status "" "")
(flymake-report-status (format "%d/%d" err-count warn-count) "")))))
+(defun flymake--start-syntax-check (&optional deferred)
+ (cl-labels ((start
+ ()
+ (remove-hook 'post-command-hook #'start 'local)
+ (setq flymake-check-start-time (float-time))
+ (flymake-proc-start-syntax-check)))
+ (if (and deferred
+ this-command)
+ (add-hook 'post-command-hook #'start 'append 'local)
+ (start))))
+
;;;###autoload
(define-minor-mode flymake-mode nil
:group 'flymake :lighter flymake-mode-line
@@ -538,7 +549,7 @@ If TYPE doesn't declare PROP in either
(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 ()
@@ -590,9 +601,6 @@ If TYPE doesn't declare PROP in either
(provide 'flymake)
-(defun flymake--start-syntax-check ()
- (flymake-proc-start-syntax-check))
-
(declare-function flymake-proc-start-syntax-check "flymake-proc")
(declare-function flymake-can-syntax-check-file "flymake-proc")
- [Emacs-diffs] emacs-26 f1601be 02/39: Flymake provides flymake-report re-entry point for backends, (continued)
- [Emacs-diffs] emacs-26 f1601be 02/39: Flymake provides flymake-report re-entry point for backends, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 ae64bf1 08/39: New Flymake variable flymake-diagnostic-types-alist and much cleanup, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 6954270 03/39: Completely rewrite Flymake's subprocess output processing, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 f930963 18/39: Simplify Flymake logging and erroring, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 734aa88 09/39: Flymake's flymake-proc.el parses column numbers from gcc/javac errors, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 9f8ad13 07/39: Refactor Flymake tests in preparation for more tests, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 491cc4a 13/39: Flymake checks file names before considering diagnostics, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 7787988 10/39: Flymake warning face easier to distinguish, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 5ec7d73 19/39: Flymake's flymake-proc.el backend slightly easier to debug, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 9a629a7 23/39: Add interactive flymake-start function, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 b0bb181 15/39: Protect Flymake's eager checks against commands like fill-paragraph,
João Távora <=
- [Emacs-diffs] emacs-26 b2f8b8b 16/39: More Flymake cleanup before advancing to backend redesign, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 22a7372 31/39: Flymake uses proper idle timers, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 87993cd 28/39: Explicitly add a(n empty) keymap for Flymake, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 bb8b663 04/39: Move symbols in flymake-proc.el to separate namespace, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 483f1e8 22/39: A couple of Flymake backends for emacs-lisp-mode, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 5235eaf 25/39: Treat Flymake errors as just another type of diagnostic, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 8118f0f 24/39: Fix three Flymake bugs when checking C header files, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 e0df7b9 21/39: Fancy Flymake mode-line construct displays status, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 cd39edb 26/39: Remove old flymake-display-err-menu-for-current-line, it's useless, João Távora, 2017/10/03
- [Emacs-diffs] emacs-26 2e84179 34/39: Tweak Flymake autoloads and dependencies, João Távora, 2017/10/03