~mgmarlow/public-inbox

flymake-clippy: Allow passing arguments to the clippy command v1 PROPOSED

Graham Marlow: 1
 Allow passing arguments to the clippy command

 1 files changed, 17 insertions(+), 2 deletions(-)
Awesome. I merged the patch for version 1.1.0. Thanks again!
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~mgmarlow/public-inbox/patches/46350/mbox | git am -3
Learn more about email & git

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

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
Just tested your branch, works great!

Graham Marlow <graham@mgmarlow.com> writes: