From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Uberti Newsgroups: gmane.emacs.devel Subject: ELPA: add flymake-proselint Date: Sun, 8 Aug 2021 12:49:12 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------217C3019E0D9970376983DEA" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4424"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Aug 08 12:53:04 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mCgQR-0000wU-BB for ged-emacs-devel@m.gmane-mx.org; Sun, 08 Aug 2021 12:53:03 +0200 Original-Received: from localhost ([::1]:41138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mCgQP-0004g5-Du for ged-emacs-devel@m.gmane-mx.org; Sun, 08 Aug 2021 06:53:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47382) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCgMw-0003Yu-Tc for emacs-devel@gnu.org; Sun, 08 Aug 2021 06:49:27 -0400 Original-Received: from latitanza.investici.org ([82.94.249.234]:64861) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mCgMu-0000iL-Fy for emacs-devel@gnu.org; Sun, 08 Aug 2021 06:49:26 -0400 Original-Received: from mx3.investici.org (unknown [127.0.0.1]) by latitanza.investici.org (Postfix) with ESMTP id 4GjGDT03HyzGp4G for ; Sun, 8 Aug 2021 10:49:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inventati.org; s=stigmate; t=1628419753; bh=Y3lEY3Bbnkb0HD58PxuXSq5GV9VXiJ8fgCRwrU9uf20=; h=To:From:Subject:Date:From; b=pIa/KFVU/mnI2p455N2Jonb1std+r55jc4tlYtbUkyy6vikY5nHfiaWyd7BghQTlf WLpJ1IcPm8eqpiyKMJSzKUxvt2V6DqLhznFn4a8gPkOAe3/ApUBsw1SMC2WD1fKWXz m5txWEbp8AP/+2N6fHEHUpw2oxZA3rQy/9N8yF50= Original-Received: from [82.94.249.234] (mx3.investici.org [82.94.249.234]) (Authenticated sender: manuel.uberti@inventati.org) by localhost (Postfix) with ESMTPSA id 4GjGDS6bHzzGp4F for ; Sun, 8 Aug 2021 10:49:12 +0000 (UTC) Content-Language: en-GB Received-SPF: pass client-ip=82.94.249.234; envelope-from=manuel.uberti@inventati.org; helo=latitanza.investici.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:272197 Archived-At: This is a multi-part message in MIME format. --------------217C3019E0D9970376983DEA Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, I would like to submit the attached package to ELPA. This package adds a Flymake backend for proselint[1]. For instance, it can be used like this: (add-hook 'markdown-mode-hook #'flymake-proselint-setup) Thank you [1] http://proselint.com/ -- Manuel Uberti www.manueluberti.eu --------------217C3019E0D9970376983DEA Content-Type: text/x-emacs-lisp; charset=UTF-8; name="flymake-proselint.el" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="flymake-proselint.el" ;;; flymake-proselint.el --- Flymake backend for proselint -*- lexical-binding: t; -*- ;; Copyright (C) 2020 Manuel Uberti ;; ;; Author: Manuel Uberti ;; Version: 0.2.0 ;; Keywords: convenience ;; 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 ;; under the terms of the GNU General Public License as published by the Free ;; Software Foundation; either version 3, or (at your option) any later version. ;; ;; flymake-proselint is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more ;; details. ;; ;; You should have received a copy of the GNU General Public License ;; along with flymake-proselint. If not, see http://www.gnu.org/licenses. ;;; Commentary: ;; This package adds support for proselint (http://proselint.com/) in Flymake. ;; Once installed, the backend can be enabled with: ;; (add-hook 'markdown-mode-hook #'flymake-proselint-setup) ;;; Code: (require 'flymake) (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 () "Enable Flymake backend proselint." (add-hook 'flymake-diagnostic-functions #'flymake-proselint-backend nil t)) (provide 'flymake-proselint) ;;; flymake-proselint.el ends here --------------217C3019E0D9970376983DEA--