~manuel-uberti/flymake-proselint

c5eaeee1a712231610f0c2e677cf299ed691d847 — Philip Kaludercic 2 years ago 47b7618
Add a user option for the Proselint executable name

* flymake-proselint.el (flymake-proselint-executable): Add new option.
(flymake-proselint--options): Use new option.
(flymake-proselint-generate-configuration): Use new option.
(flymake-proselint-backend): Use new option.
1 files changed, 9 insertions(+), 5 deletions(-)

M flymake-proselint.el
M flymake-proselint.el => flymake-proselint.el +9 -5
@@ 41,6 41,10 @@
  :prefix "flymake-proselint-"
  :group 'flymake)

(defcustom flymake-proselint-executable "proselint"
  "Name of the Proselint executable."
  :type 'string)

(defcustom flymake-proselint-message-format
  "%m%r"
  "A format string to generate diagnostic messages.


@@ 55,7 59,7 @@ The following %-sequences are replaced:
  ;; Regenerate using:
  ;;
  ;; (with-temp-buffer
  ;;   (call-process "proselint" nil t nil "--dump-config")
  ;;   (call-process flymake-proselint-executable nil t nil "--dump-config")
  ;;   (goto-char (point-min))
  ;;   (let ((config (json-parse-buffer :object-type 'alist)))
  ;;     (mapcar #'car (alist-get 'checks config))))


@@ 224,7 228,7 @@ will be nil."
                   flymake-proselint-config-directory)))
      (unless (file-exists-p output)
        (let* ((config (with-temp-buffer
                         (call-process "proselint" nil t nil "--dump-config")
                         (call-process flymake-proselint-executable nil t nil "--dump-config")
                         (goto-char (point-min))
                         (json-parse-buffer :object-type 'alist)))
               (checks (alist-get 'checks config)))


@@ 316,7 320,7 @@ A successfully parsed message is passed onto the function
  "Flymake backend for Proselint.
REPORT-FN is the flymake reporter function.  See the Info
node (flymake) Backend functions for more details."
  (unless (executable-find "proselint")
  (unless (executable-find flymake-proselint-executable)
    (user-error "Executable proselint not found on PATH"))

  (when (process-live-p flymake-proselint--flymake-proc)


@@ 327,8 331,8 @@ node (flymake) Backend functions for more details."
               :buffer (generate-new-buffer " *proselint-flymake*")
               :command
               (if-let* ((conf (flymake-proselint-generate-configuration)))
                   (list "proselint" "--config" conf "--json" "-")
                 '("proselint" "--json" "-"))
                   (list flymake-proselint-executable "--config" conf "--json" "-")
                 (list flymake-proselint-executable "--json" "-"))
               :sentinel #'flymake-proselint-sentinel)))
    (process-put proc 'source (current-buffer))
    (process-put proc 'report-fn report-fn)