unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Manuel Uberti <manuel.uberti@inventati.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: ELPA: add flymake-proselint
Date: Tue, 10 Aug 2021 07:40:16 +0200	[thread overview]
Message-ID: <644dcddc-b0a1-f938-dff1-72923ae3de61@inventati.org> (raw)
In-Reply-To: <jwvlf5aa21f.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 359 bytes --]

On 09/08/21 20:48, Stefan Monnier wrote:
> Before I can add it to GNU ELPA, can you please fix the copyright line
> to refer to the FSF rather than to you (which reflects the fact that
> you consider this package as covered by your copyright assignment)?

Sure thing, you can find the updated file attached.


Thank you

-- 
Manuel Uberti
www.manueluberti.eu

[-- Attachment #2: flymake-proselint.el --]
[-- Type: text/x-emacs-lisp, Size: 3638 bytes --]

;;; flymake-proselint.el --- Flymake backend for proselint -*- lexical-binding: t; -*-

;; Copyright (C) 2021  Free Software Foundation, Inc.
;;
;; Author: Manuel Uberti <manuel.uberti@inventati.org>
;; 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

  reply	other threads:[~2021-08-10  5:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-08 10:49 ELPA: add flymake-proselint Manuel Uberti
2021-08-08 14:07 ` Philip Kaludercic
2021-08-09  5:07   ` Manuel Uberti
2021-08-09 18:48 ` Stefan Monnier
2021-08-10  5:40   ` Manuel Uberti [this message]
2021-08-10 13:55     ` Stefan Monnier
2021-08-10 13:59       ` Manuel Uberti
2021-08-10 14:34         ` Stefan Monnier
2021-08-10 14:50           ` Manuel Uberti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=644dcddc-b0a1-f938-dff1-72923ae3de61@inventati.org \
    --to=manuel.uberti@inventati.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).