~mgmarlow/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

Re: [PATCH flymake-clippy] Allow passing arguments to the clippy command

Details
Message ID
<20231102163317.4708-1-graham@mgmarlow.com>
DKIM signature
missing
Download raw message
Patch: +17 -2
I went ahead and made a few edits myself. Would you mind testing them
out to see if it works for you? The new defcustom is named
flymake-clippy-bin-args.

Once verified I'll push up a new version.

---

Introduce a new defcustom for providing arguments to the cargo clippy
binary.

Co-authored-by: Jens Östlund <hi@iensu.me>
Co-authored-by: Graham <info@mgmarlow.com>
---
 flymake-clippy.el | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/flymake-clippy.el b/flymake-clippy.el
index e9dfffc..1cdca7e 100644
--- a/flymake-clippy.el
+++ b/flymake-clippy.el
@@ -5,7 +5,7 @@
;; Author: Graham Marlow <info@mgmarlow.com>
;; Keywords: tools
;; URL: https://sr.ht/~mgmarlow/flymake-clippy/
;; Version: 1.0.1
;; Version: 1.1.0
;; Package-Requires: ((emacs "26.1"))

;; This program is free software; you can redistribute it and/or modify
@@ -32,6 +32,18 @@

(require 'cl-lib)

(defgroup flymake-clippy nil
  "Flymake backend for Clippy."
  :group 'programming)

(defcustom flymake-clippy-bin-args nil
  "A list of arguments passed to the `cargo clippy' command.

For example, a value of `(\"--\" \"-W\" \"clippy::pedantic\")'
results in the command `cargo clippy -- -W clippy::pedantic'."
  :type '(repeat string)
  :group 'flymake-clippy)

;; Capture group source example:
;; "warning: ..."
;;    --> src/filename.rs
@@ -62,6 +74,9 @@
             (any "0-9")))
           line-end)))

(defun flymake-clippy--bin ()
  (append (list "cargo" "clippy") flymake-clippy-bin-args))

(defvar-local flymake-clippy--proc nil
  "Clippy subprocess object, used to ensure obsolete processes aren't reused.")

@@ -84,7 +99,7 @@ with the appropriate Flymake hook."
            (make-process
             :name "flymake-clippy" :noquery t :connection-type 'pipe
             :buffer (generate-new-buffer "*flymake-clippy*")
             :command '("cargo" "clippy")
             :command (flymake-clippy--bin)
             :sentinel
             (lambda (proc _event)
               (when (memq (process-status proc) '(exit signal))
-- 
2.34.1

Re: [PATCH flymake-clippy] Allow passing arguments to the clippy command

Details
Message ID
<m2wmuzkfln.fsf@fabriken.lan>
In-Reply-To
<20231102163317.4708-1-graham@mgmarlow.com> (view parent)
DKIM signature
missing
Download raw message
Just tested your branch, works great!

Graham Marlow <graham@mgmarlow.com> writes:

> I went ahead and made a few edits myself. Would you mind testing them
> out to see if it works for you? The new defcustom is named
> flymake-clippy-bin-args.
>
> Once verified I'll push up a new version.
>
> ---
>
> Introduce a new defcustom for providing arguments to the cargo clippy
> binary.
>
> Co-authored-by: Jens Östlund <hi@iensu.me>
> Co-authored-by: Graham <info@mgmarlow.com>
> ---
>  flymake-clippy.el | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/flymake-clippy.el b/flymake-clippy.el
> index e9dfffc..1cdca7e 100644
> --- a/flymake-clippy.el
> +++ b/flymake-clippy.el
> @@ -5,7 +5,7 @@
>  ;; Author: Graham Marlow <info@mgmarlow.com>
>  ;; Keywords: tools
>  ;; URL: https://sr.ht/~mgmarlow/flymake-clippy/
> -;; Version: 1.0.1
> +;; Version: 1.1.0
>  ;; Package-Requires: ((emacs "26.1"))
>
>  ;; This program is free software; you can redistribute it and/or modify
> @@ -32,6 +32,18 @@
>
>  (require 'cl-lib)
>
> +(defgroup flymake-clippy nil
> +  "Flymake backend for Clippy."
> +  :group 'programming)
> +
> +(defcustom flymake-clippy-bin-args nil
> +  "A list of arguments passed to the `cargo clippy' command.
> +
> +For example, a value of `(\"--\" \"-W\" \"clippy::pedantic\")'
> +results in the command `cargo clippy -- -W clippy::pedantic'."
> +  :type '(repeat string)
> +  :group 'flymake-clippy)
> +
>  ;; Capture group source example:
>  ;; "warning: ..."
>  ;;    --> src/filename.rs
> @@ -62,6 +74,9 @@
>               (any "0-9")))
>             line-end)))
>
> +(defun flymake-clippy--bin ()
> +  (append (list "cargo" "clippy") flymake-clippy-bin-args))
> +
>  (defvar-local flymake-clippy--proc nil
>    "Clippy subprocess object, used to ensure obsolete processes aren't reused.")
>
> @@ -84,7 +99,7 @@ with the appropriate Flymake hook."
>              (make-process
>               :name "flymake-clippy" :noquery t :connection-type 'pipe
>               :buffer (generate-new-buffer "*flymake-clippy*")
> -             :command '("cargo" "clippy")
> +             :command (flymake-clippy--bin)
>               :sentinel
>               (lambda (proc _event)
>                 (when (memq (process-status proc) '(exit signal))

Re: [PATCH flymake-clippy] Allow passing arguments to the clippy command

Details
Message ID
<098b9d38-dd0c-bf04-98b1-feb0c3dbcf9d@mgmarlow.com>
In-Reply-To
<m2wmuzkfln.fsf@fabriken.lan> (view parent)
DKIM signature
missing
Download raw message
Awesome. I merged the patch for version 1.1.0. Thanks again!
Reply to thread Export thread (mbox)