[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/flymake-refactor 879dcef 29/52: Misc cleanup in fl
From: |
João Távora |
Subject: |
[Emacs-diffs] scratch/flymake-refactor 879dcef 29/52: Misc cleanup in flymake-proc.el |
Date: |
Sun, 1 Oct 2017 12:40:48 -0400 (EDT) |
branch: scratch/flymake-refactor
commit 879dcefe263cf27ff0793be8146728237acdd699
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Misc cleanup in flymake-proc.el
Improve description of what this file contains.
Better name for the backend function. Fix the case where it is run
interactively.
Keep the output buffer alive iff the external process panics.
* lisp/progmodes/flymake-proc.el
(flymake-proc-legacy-flymake): Rename from
flymake-proc-start-syntax-check. Allow running interactively.
(flymake-start-syntax-check): Obsolete alias for
flymake-proc-legacy-flymake.
(flymake-proc-start-syntax-check): Delete.
(flymake-diagnostic-functions): Include flymake-proc-legacy-flymake
(flymake-proc--process-sentinel): Keep output buffer alive.
Clarify with comments.
---
lisp/progmodes/flymake-proc.el | 58 ++++++++++++++++++++++++++++--------------
1 file changed, 39 insertions(+), 19 deletions(-)
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 0050a44..fb664f9 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -1,4 +1,4 @@
-;;; flymake-proc.el --- Flymake for external syntax checker processes -*-
lexical-binding: t; -*-
+;;; flymake-proc.el --- Flymake backend for external tools -*-
lexical-binding: t; -*-
;; Copyright (C) 2003-2017 Free Software Foundation, Inc.
@@ -26,9 +26,13 @@
;;
;; Flymake is a minor Emacs mode performing on-the-fly syntax checks.
;;
-;; This file contains the most original implementation of flymake's
-;; main source of on-the-fly diagnostic info, the external syntax
-;; checker backend.
+;; This file contains a significant part of the original flymake's
+;; implementation, a buffer-checking mechanism that parses the output
+;; of an external syntax check tool with regular expressions.
+;;
+;; That work has been adapted into a flymake "backend" function,
+;; `flymake-proc-legacy-flymake' suitable for adding to the
+;; `flymake-diagnostic-functions' variable.
;;
;;; Bugs/todo:
@@ -496,7 +500,9 @@ Create parent directories as needed."
(diagnostics (process-get
proc
'flymake-proc--collected-diagnostics))
- (interrupted (process-get proc 'flymake-proc--interrupted)))
+ (interrupted (process-get proc 'flymake-proc--interrupted))
+ (panic nil)
+ (output-buffer (process-get proc 'flymake-proc--output-buffer)))
(flymake-log 2 "process %d exited with code %d"
(process-id proc) exit-status)
(unwind-protect
@@ -508,19 +514,24 @@ Create parent directories as needed."
(funcall flymake-proc--report-fn diagnostics))
(interrupted
(flymake-proc--panic :stopped interrupted))
+ (diagnostics
+ ;; non-zero exit but some diagnostics is quite
+ ;; normal...
+ (funcall flymake-proc--report-fn diagnostics))
((null diagnostics)
- ;; non-zero exit but no errors is strange
+ ;; ...but no diagnostics is strange, so panic.
+ (setq panic t)
(flymake-proc--panic
:configuration-error
(format "Command %s errored, but no diagnostics"
- command)))
- (diagnostics
- (funcall flymake-proc--report-fn diagnostics)))))
+ command))))))
(delete-process proc)
(setq flymake-proc--processes
(delq proc flymake-proc--processes))
- (unless (> flymake-log-level 2)
- (kill-buffer (process-get proc 'flymake-proc--output-buffer)))))))
+ (if panic
+ (flymake-log 1 "Output buffer %s kept alive for debugging"
+ output-buffer)
+ (kill-buffer output-buffer))))))
(defun flymake-proc--panic (problem explanation)
"Tell flymake UI about a fatal PROBLEM with this backend.
@@ -686,13 +697,21 @@ expression. A match indicates `:warning' type, otherwise
(flymake-log 1 "Failed to delete dir %s, error ignored" dir-name))))
-(defun flymake-proc-start-syntax-check (report-fn &optional interactive)
- "Start syntax checking for current buffer."
+(defun flymake-proc-legacy-flymake (report-fn &optional interactive)
+ "Flymake backend based on the original flymake implementation.
+This function is suitable for inclusion in
+`flymake-dianostic-types-alist'. For backward compatibility, it
+can also be executed interactively independently of
+`flymake-mode'."
;; Interactively, behave as if flymake had invoked us through its
;; `flymake-diagnostic-functions' with a suitable ID so flymake can
;; clean up consistently
- (interactive (list (flymake-make-report-fn 'flymake-proc-start-syntax-check)
- t))
+ (interactive (list
+ (lambda (diags &rest args)
+ (apply (flymake-make-report-fn 'flymake-proc-legacy-flymake)
+ diags
+ (append args '(:force t))))
+ t))
(cond
((process-live-p flymake-proc--process)
(when interactive
@@ -727,6 +746,10 @@ expression. A match indicates `:warning' type, otherwise
dir)
t)))))))
+(define-obsolete-function-alias 'flymake-start-syntax-check
+ 'flymake-proc-legacy-flymake "26.1"
+ "Flymake backend based on the original flymake implementation.")
+
(defun flymake-proc--start-syntax-check-process (cmd args dir)
"Start syntax check process."
(condition-case-unless-debug err
@@ -1069,7 +1092,7 @@ Use CREATE-TEMP-F for creating temp copy."
;;;; Hook onto flymake-ui
(add-to-list 'flymake-diagnostic-functions
- 'flymake-proc-start-syntax-check)
+ 'flymake-proc-legacy-flymake)
;;;;
@@ -1253,9 +1276,6 @@ Return its components if so, nil otherwise.")
(define-obsolete-function-alias 'flymake-safe-delete-directory
'flymake-proc--safe-delete-directory "26.1"
nil)
- (define-obsolete-function-alias 'flymake-start-syntax-check
- 'flymake-proc-start-syntax-check "26.1"
- "Start syntax checking for current buffer.")
(define-obsolete-function-alias 'flymake-stop-all-syntax-checks
'flymake-proc-stop-all-syntax-checks "26.1"
"Kill all syntax check processes.")
- [Emacs-diffs] scratch/flymake-refactor b2c4135 15/52: Clarify logic around flymake-diagnostic-types-alist, (continued)
- [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, 2017/10/01
- [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 <=
- [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, 2017/10/01
- [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