[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flymake-kondor 7cc3adf 15/19: Remove flymake-quickdef depe
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flymake-kondor 7cc3adf 15/19: Remove flymake-quickdef dependency |
Date: |
Fri, 8 Oct 2021 08:58:16 -0400 (EDT) |
branch: elpa/flymake-kondor
commit 7cc3adf26e340b44d6d1ab53b12b578096c6ccad
Author: Manuel Uberti <manuel.uberti@inventati.org>
Commit: Manuel Uberti <manuel.uberti@inventati.org>
Remove flymake-quickdef dependency
---
flymake-kondor.el | 78 +++++++++++++++++++++++++++++++++++++------------------
1 file changed, 53 insertions(+), 25 deletions(-)
diff --git a/flymake-kondor.el b/flymake-kondor.el
index 3173e8a..afc9a45 100644
--- a/flymake-kondor.el
+++ b/flymake-kondor.el
@@ -5,7 +5,7 @@
;; Author: https://turbocafe.keybase.pub
;; Created: 3 November 2019
;; Version: 0.0.3
-;; Package-Requires: ((emacs "26.1") (flymake-quickdef "1.0.0"))
+;; Package-Requires: ((emacs "26.1"))
;; URL: https://github.com/turbo-cafe/flymake-kondor
;;; Commentary:
@@ -36,32 +36,60 @@
;;; Code:
(require 'flymake)
-(require 'flymake-quickdef)
-
-(flymake-quickdef-backend flymake-kondor-backend
- :pre-let ((kondor-exec (executable-find "clj-kondo"))
- (lang (file-name-extension buffer-file-name)))
- :pre-check (unless kondor-exec (error "Not found clj-kondo on PATH"))
- :write-type 'pipe
- :proc-form (list kondor-exec "--lint" "-" "--lang" lang)
- :search-regexp "^.+:\\([[:digit:]]+\\):\\([[:digit:]]+\\):
\\([[:alpha:]]+\\): \\(.+\\)$"
- :prep-diagnostic
- (let* ((lnum (string-to-number (match-string 1)))
- (lcol (string-to-number (match-string 2)))
- (severity (match-string 3))
- (msg (match-string 4))
- (pos (flymake-diag-region fmqd-source lnum lcol))
- (beg (car pos))
- (end (cdr pos))
- (type (cond
- ((string= severity "error") :error)
- ((string= severity "warning") :warning)
- ((string= severity "info") :note)
- (t :note))))
- (list fmqd-source beg end type msg)))
+
+(defvar-local flymake-kondor--flymake-proc nil)
+
+(defun flymake-kondor-backend (report-fn &rest _args)
+ "Build the Flymake backend for clj-kondo with REPORT-FN."
+ (unless (executable-find "clj-kondo")
+ (user-error "Executable clj-kondo not found on PATH"))
+
+ (when (process-live-p flymake-kondor--flymake-proc)
+ (kill-process flymake-kondor--flymake-proc))
+
+ (let* ((source (current-buffer))
+ (lang (file-name-extension (buffer-file-name source))))
+ (save-restriction
+ (widen)
+ (setq
+ flymake-kondor--flymake-proc
+ (make-process
+ :name "flymake-kondor" :noquery t :connection-type 'pipe
+ :buffer (generate-new-buffer " *flymake-kondor*")
+ :command `("clj-kondo" "--lint" "-" "--lang" ,lang)
+ :sentinel
+ (lambda (proc _event)
+ (when (eq 'exit (process-status proc))
+ (unwind-protect
+ (if (with-current-buffer source (eq proc
flymake-kondor--flymake-proc))
+ (with-current-buffer (process-buffer proc)
+ (goto-char (point-min))
+ (cl-loop
+ while (search-forward-regexp
+ "^.+:\\([[:digit:]]+\\):\\([[:digit:]]+\\):
\\([[:alpha:]]+\\): \\(.+\\)$"
+ nil t)
+ for lnum = (string-to-number (match-string 1))
+ for lcol = (string-to-number (match-string 2))
+ for type = (let ((severity (match-string 3)))
+ (cond
+ ((string= severity "error") :error)
+ ((string= severity "warning") :warning)
+ ((string= severity "info") :note)
+ (t :note)))
+ for msg = (match-string 4)
+ for (beg . end) = (flymake-diag-region source lnum lcol)
+ collect (flymake-make-diagnostic source beg end type
msg)
+ into diags
+ finally (funcall report-fn diags)))
+ (flymake-log :warning "Canceling obsolete check %s"
+ proc))
+ (kill-buffer (process-buffer proc)))))))
+ (process-send-region flymake-kondor--flymake-proc (point-min)
(point-max))
+ (process-send-eof flymake-kondor--flymake-proc))))
+
;;;###autoload
(defun flymake-kondor-setup ()
- "Enable flymake backend."
+ "Enable Flymake backend."
(add-hook 'flymake-diagnostic-functions #'flymake-kondor-backend nil t))
(provide 'flymake-kondor)
- [nongnu] branch elpa/flymake-kondor created (now 0058ef5), ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 29f80de 01/19: v0.0.1, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 19292a8 02/19: package-linted source, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 5e447cc 03/19: checkdock source, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 0de12e7 04/19: melpa and github instructions, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor dc50d6a 07/19: melpa package test and build, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 7cc3adf 15/19: Remove flymake-quickdef dependency,
ELPA Syncer <=
- [nongnu] elpa/flymake-kondor 72052b5 14/19: increment version, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor e885669 08/19: package-lint fixes, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor c17c1c6 18/19: Remove reference to flymake-quickdef, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 2af1876 05/19: readme, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 8353e0a 06/19: title, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor aadb1ea 09/19: add license, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor c931266 10/19: resolved issue #1, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 530bf3e 11/19: Merge pull request #1 from turbo-cafe/qiuckdef, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 636c505 12/19: Pass lang to check edn files correctly, ELPA Syncer, 2021/10/08
- [nongnu] elpa/flymake-kondor 34da152 13/19: Merge pull request #3 from manuel-uberti/specify-lang, ELPA Syncer, 2021/10/08