From 62c670c19e575a0d7dd723cbd195c18de60bb494 Mon Sep 17 00:00:00 2001 From: Graham Marlow Date: Thu, 2 Nov 2023 09:16:36 -0700 Subject: Add support for custom clippy args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Introduce a new defcustom for providing arguments to the cargo clippy binary. Co-authored-by: Jens Östlund Co-authored-by: Graham --- 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 ;; 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)) -- cgit v1.2.3