[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/flymake-proselint ea6a1d1 15/18: Build backend without
From: |
ELPA Syncer |
Subject: |
[elpa] externals/flymake-proselint ea6a1d1 15/18: Build backend without flymake-quickdef |
Date: |
Mon, 9 Aug 2021 14:57:23 -0400 (EDT) |
branch: externals/flymake-proselint
commit ea6a1d181c4f8fe7b0ed72a7a550086d399d5346
Author: Manuel Uberti <manuel.uberti@inventati.org>
Commit: Manuel Uberti <manuel.uberti@inventati.org>
Build backend without flymake-quickdef
---
flymake-proselint.el | 65 ++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 48 insertions(+), 17 deletions(-)
diff --git a/flymake-proselint.el b/flymake-proselint.el
index 9606add..f98f6a1 100644
--- a/flymake-proselint.el
+++ b/flymake-proselint.el
@@ -5,7 +5,7 @@
;; Author: Manuel Uberti <manuel.uberti@inventati.org>
;; Version: 0.1.0
;; Keywords: convenience
-;; Package-Requires: ((emacs "26.1") (flymake-quickdef "1.0.0"))
+;; Package-Requires: ((emacs "26.1"))
;; URL: https://github.com/manuel-uberti/flymake-proselint
;; flymake-proselint is free software; you can redistribute it and/or modify it
@@ -30,22 +30,53 @@
;;; Code:
(require 'flymake)
-(require 'flymake-quickdef)
-
-(flymake-quickdef-backend
- flymake-proselint-backend
- :pre-let ((proselint-exec (executable-find "proselint")))
- :pre-check (unless proselint-exec (user-error "Executable proselint not
found on PATH"))
- :write-type 'pipe
- :proc-form (list proselint-exec "-")
- :search-regexp "^.+:\\([[:digit:]]+\\):\\([[:digit:]]+\\): \\(.+\\)$"
- :prep-diagnostic (let* ((lnum (string-to-number (match-string 1)))
- (lcol (string-to-number (match-string 2)))
- (msg (match-string 3))
- (pos (flymake-diag-region fmqd-source lnum lcol))
- (beg (car pos))
- (end (cdr pos)))
- (list fmqd-source beg end :warning msg)))
+
+(defvar-local flymake-proselint--flymake-proc nil)
+
+(defun flymake-proselint-backend (report-fn &rest _args)
+ (unless (executable-find "proselint")
+ (user-error "Executable proselint not found on PATH"))
+
+ (when (process-live-p flymake-proselint--flymake-proc)
+ (kill-process flymake-proselint--flymake-proc))
+
+ (let ((source (current-buffer)))
+ (save-restriction
+ (widen)
+ (setq
+ flymake-proselint--flymake-proc
+ (make-process
+ :name "proselint-flymake" :noquery t :connection-type 'pipe
+ :buffer (generate-new-buffer " *proselint-flymake*")
+ :command '("proselint" "-")
+ :sentinel
+ (lambda (proc _event)
+ (when (eq 'exit (process-status proc))
+ (unwind-protect
+ (if (with-current-buffer source (eq proc
flymake-proselint--flymake-proc))
+ (with-current-buffer (process-buffer proc)
+ (goto-char (point-min))
+ (cl-loop
+ while (search-forward-regexp
+ "^.+:\\([[:digit:]]+\\):\\([[:digit:]]+\\):
\\(.+\\)$"
+ nil t)
+ for msg = (match-string 3)
+ for (beg . end) = (flymake-diag-region
+ source
+ (string-to-number (match-string 1))
+ (string-to-number (match-string 2)))
+ collect (flymake-make-diagnostic source
+ beg
+ end
+ :warning
+ 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-proselint--flymake-proc (point-min)
(point-max))
+ (process-send-eof flymake-proselint--flymake-proc))))
;;;###autoload
(defun flymake-proselint-setup ()
- [elpa] externals/flymake-proselint adf1ce7 18/18: Update installation instructions, (continued)
- [elpa] externals/flymake-proselint adf1ce7 18/18: Update installation instructions, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint d99034a 12/18: Minor wording fix, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint 9a92fd8 07/18: Fix spelling, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint e4b6daa 01/18: First commit, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint 444bf06 10/18: Add MELPA instructions, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint cb36a7c 13/18: Refine example, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint b949503 14/18: Fix example, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint 4375cba 11/18: Add MELPA badge, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint 9d90a6b 08/18: Add .gitignore, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint e34155e 06/18: Fix version, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint ea6a1d1 15/18: Build backend without flymake-quickdef,
ELPA Syncer <=
- [elpa] externals/flymake-proselint f94565d 17/18: Update installation instructions, ELPA Syncer, 2021/08/09
- [elpa] externals/flymake-proselint b1ec0b5 16/18: Bump version, ELPA Syncer, 2021/08/09