[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode c0cc6dc 420/486: Allow pass custom flags to rust
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode c0cc6dc 420/486: Allow pass custom flags to rustfmt. (#338) |
Date: |
Sat, 7 Aug 2021 09:26:06 -0400 (EDT) |
branch: elpa/rust-mode
commit c0cc6dc75754fd607572a6fd72945d87729d0174
Author: Nathan Moreau <nathan.moreau@m4x.org>
Commit: GitHub <noreply@github.com>
Allow pass custom flags to rustfmt. (#338)
* rust-rustfmt-switches: new defvar.
* rust-format-diff-buffer, rust--format-call: use the custom flags.
---
rust-mode.el | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/rust-mode.el b/rust-mode.el
index b361749..5c68640 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -165,6 +165,11 @@ to the function arguments. When nil, `->' will be
indented one level."
:type 'string
:group 'rust-mode)
+(defcustom rust-rustfmt-switches '("--edition" "2018")
+ "Arguments to pass when invoking the `rustfmt' executable."
+ :type '(repeat string)
+ :group 'rust-mode)
+
(defcustom rust-cargo-bin "cargo"
"Path to cargo executable."
:type 'string
@@ -1354,8 +1359,14 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(erase-buffer)
(insert-buffer-substring buf)
(let* ((tmpf (make-temp-file "rustfmt"))
- (ret (call-process-region (point-min) (point-max) rust-rustfmt-bin
- t `(t ,tmpf) nil)))
+ (ret (apply 'call-process-region
+ (point-min)
+ (point-max)
+ rust-rustfmt-bin
+ t
+ `(t ,tmpf)
+ nil
+ rust-rustfmt-switches)))
(unwind-protect
(cond
((zerop ret)
@@ -1465,16 +1476,20 @@ Return the created process."
(interactive)
(unless (executable-find rust-rustfmt-bin)
(error "Could not locate executable \%s\"" rust-rustfmt-bin))
- (let ((proc
- (start-process "rustfmt-diff"
- (with-current-buffer
- (get-buffer-create "*rustfmt-diff*")
- (let ((inhibit-read-only t))
- (erase-buffer))
- (current-buffer))
- rust-rustfmt-bin
- "--check"
- (buffer-file-name))))
+ (let* ((buffer
+ (with-current-buffer
+ (get-buffer-create "*rustfmt-diff*")
+ (let ((inhibit-read-only t))
+ (erase-buffer))
+ (current-buffer)))
+ (proc
+ (apply 'start-process
+ "rustfmt-diff"
+ buffer
+ rust-rustfmt-bin
+ "--check"
+ (cons (buffer-file-name)
+ rust-rustfmt-switches))))
(set-process-sentinel proc 'rust-format-diff-buffer-sentinel)
proc))
- [nongnu] elpa/rust-mode 8733792 448/486: Drop Emacs-24, (continued)
- [nongnu] elpa/rust-mode 8733792 448/486: Drop Emacs-24, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9eb2c63 460/486: Fix README internal link (#389), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 13c4335 462/486: Improve doc-strings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c23453d 463/486: rearrange I: Move options and faces to beginning of file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 649f492 484/486: Create rust-cargo.el from existing code, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 198c777 386/486: Replaced font-lock-fontify-buffer with font-lock-ensure, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a871d10 390/486: Merge pull request #298 from jjwest/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0a94268 396/486: Merge pull request #307 from Bunogi/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 86bc286 401/486: Add specific distribution for EVM, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 06b3b60 412/486: update readme (#327), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c0cc6dc 420/486: Allow pass custom flags to rustfmt. (#338),
ELPA Syncer <=
- [nongnu] elpa/rust-mode 888f3de 442/486: rust--format-fix-rustfmt-buffer: replace "stdin:" as well as "<stdin>:"., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ef152ad 459/486: Minor fixes (#388), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0797e7b 017/486: add Url, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5375e54 454/486: Test byte compilation of test code., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 33d178d 030/486: Make 'foo use font-lock-builtin-face, like module names, and make capitalized identifiers optionally use font-lock-type-face, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9e2221c 034/486: Fix typo, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8f926be 031/486: Emacs: Update emacs mode to be more similar to the vim mode., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode cfb4408 354/486: Merge pull request #258 from sebastiencs/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b861aa9 358/486: Fixed indent when ? operator is used in chained method calls, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 31b8453 361/486: update to include line number and column information, ELPA Syncer, 2021/08/07