all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* ELPA: add flymake-proselint
@ 2021-08-08 10:49 Manuel Uberti
  2021-08-08 14:07 ` Philip Kaludercic
  2021-08-09 18:48 ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Manuel Uberti @ 2021-08-08 10:49 UTC (permalink / raw)
  To: emacs-devel

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

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

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

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

;; Copyright (C) 2020  Manuel Uberti <manuel.uberti@inventati.org>
;;
;; 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ELPA: add flymake-proselint
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Philip Kaludercic @ 2021-08-08 14:07 UTC (permalink / raw)
  To: Manuel Uberti; +Cc: emacs-devel

Manuel Uberti <manuel.uberti@inventati.org> writes:

> Hi,
>
> I would like to submit the attached package to ELPA.

You should probably add a link to a repository where you work on the
package, so that it can be added to ELPA more easily.

> 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/

-- 
	Philip Kaludercic



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ELPA: add flymake-proselint
  2021-08-08 14:07 ` Philip Kaludercic
@ 2021-08-09  5:07   ` Manuel Uberti
  0 siblings, 0 replies; 9+ messages in thread
From: Manuel Uberti @ 2021-08-09  5:07 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: emacs-devel

On 08/08/21 16:07, Philip Kaludercic wrote:
> You should probably add a link to a repository where you work on the
> package, so that it can be added to ELPA more easily.

The file I attached before contains this URL:

https://github.com/manuel-uberti/flymake-proselint

This is where I maintain it.

-- 
Manuel Uberti
www.manueluberti.eu



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ELPA: add flymake-proselint
  2021-08-08 10:49 ELPA: add flymake-proselint Manuel Uberti
  2021-08-08 14:07 ` Philip Kaludercic
@ 2021-08-09 18:48 ` Stefan Monnier
  2021-08-10  5:40   ` Manuel Uberti
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2021-08-09 18:48 UTC (permalink / raw)
  To: Manuel Uberti; +Cc: emacs-devel

Manuel Uberti [2021-08-08 12:49:12] wrote:
> I would like to submit the attached package to ELPA.

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)?


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ELPA: add flymake-proselint
  2021-08-09 18:48 ` Stefan Monnier
@ 2021-08-10  5:40   ` Manuel Uberti
  2021-08-10 13:55     ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Manuel Uberti @ 2021-08-10  5:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

[-- 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ELPA: add flymake-proselint
  2021-08-10  5:40   ` Manuel Uberti
@ 2021-08-10 13:55     ` Stefan Monnier
  2021-08-10 13:59       ` Manuel Uberti
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2021-08-10 13:55 UTC (permalink / raw)
  To: Manuel Uberti; +Cc: emacs-devel

Manuel Uberti [2021-08-10 07:40:16] wrote:
> 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.

http://elpa.gnu.org/devel/flymake-proselint.html

A release package will be created next time you change the
`Version:` header line.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ELPA: add flymake-proselint
  2021-08-10 13:55     ` Stefan Monnier
@ 2021-08-10 13:59       ` Manuel Uberti
  2021-08-10 14:34         ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Manuel Uberti @ 2021-08-10 13:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 10/08/21 15:55, Stefan Monnier wrote:
> http://elpa.gnu.org/devel/flymake-proselint.html

Fantastic, thank you.

> A release package will be created next time you change the
> `Version:` header line.

Since this is my first time on GNU ELPA, should I update 'Version:' now to have 
the package on GNU ELPA as well? It seems available only on GNU-devel ELPA at 
the moment.

-- 
Manuel Uberti
www.manueluberti.eu



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ELPA: add flymake-proselint
  2021-08-10 13:59       ` Manuel Uberti
@ 2021-08-10 14:34         ` Stefan Monnier
  2021-08-10 14:50           ` Manuel Uberti
  0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2021-08-10 14:34 UTC (permalink / raw)
  To: Manuel Uberti; +Cc: emacs-devel

Manuel Uberti [2021-08-10 15:59:33] wrote:
> On 10/08/21 15:55, Stefan Monnier wrote:
>> http://elpa.gnu.org/devel/flymake-proselint.html
> Fantastic, thank you.
>> A release package will be created next time you change the
>> `Version:` header line.
> Since this is my first time on GNU ELPA, should I update 'Version:' now to
> have the package on GNU ELPA as well?

Sure.

> It seems available only on GNU-devel ELPA at the moment.

The reason why 0.2.0 is not on GNU ELPA is that the commit that
corresponds to that release still has your name rather than the FSF on
the copyright line.


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: ELPA: add flymake-proselint
  2021-08-10 14:34         ` Stefan Monnier
@ 2021-08-10 14:50           ` Manuel Uberti
  0 siblings, 0 replies; 9+ messages in thread
From: Manuel Uberti @ 2021-08-10 14:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On 10/08/21 16:34, Stefan Monnier wrote:
> The reason why 0.2.0 is not on GNU ELPA is that the commit that
> corresponds to that release still has your name rather than the FSF on
> the copyright line.

Thanks for the clarification, I updated the Version.

-- 
Manuel Uberti
www.manueluberti.eu



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-10 14:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.