[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 7724813 306/486: Merge pull request #206 from cj
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 7724813 306/486: Merge pull request #206 from cjhowe7/master |
Date: |
Sat, 7 Aug 2021 09:25:41 -0400 (EDT) |
branch: elpa/rust-mode
commit 77248135153a6c15cfc35ff9d5db550a5b1a8197
Merge: 3220937 610fe1f
Author: Tom Tromey <tom@tromey.com>
Commit: GitHub <noreply@github.com>
Merge pull request #206 from cjhowe7/master
Allow formatting with long lines (fixes #186)
---
rust-mode.el | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/rust-mode.el b/rust-mode.el
index 9f9e391..1a9d77d 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1197,12 +1197,26 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(with-current-buffer (get-buffer-create "*rustfmt*")
(erase-buffer)
(insert-buffer-substring buf)
- (if (zerop (call-process-region (point-min) (point-max) rust-rustfmt-bin t
t nil))
- (progn
- (if (not (string= (buffer-string) (with-current-buffer buf
(buffer-string))))
- (copy-to-buffer buf (point-min) (point-max)))
- (kill-buffer))
- (error "Rustfmt failed, see *rustfmt* buffer for details"))))
+ (let* ((tmpf (make-temp-file "rustfmt"))
+ (ret (call-process-region (point-min) (point-max) rust-rustfmt-bin
+ t `(t ,tmpf) nil)))
+ (unwind-protect
+ (cond
+ ((zerop ret)
+ (if (not (string= (buffer-string)
+ (with-current-buffer buf (buffer-string))))
+ (copy-to-buffer buf (point-min) (point-max)))
+ (kill-buffer))
+ ((= ret 3)
+ (if (not (string= (buffer-string)
+ (with-current-buffer buf (buffer-string))))
+ (copy-to-buffer buf (point-min) (point-max)))
+ (erase-buffer)
+ (insert-file-contents tmpf)
+ (error "Rustfmt could not format some lines, see *rustfmt* buffer
for details"))
+ (t
+ (error "Rustfmt failed, see *rustfmt* buffer for details"))))
+ (delete-file tmpf))))
(defconst rust--format-word
"\\b\\(else\\|enum\\|fn\\|for\\|if\\|let\\|loop\\|match\\|struct\\|unsafe\\|while\\)\\b")
(defconst rust--format-line "\\([\n]\\)")
- [nongnu] elpa/rust-mode 1ff1d75 193/486: Merge pull request #90 from Wilfred/fix_type_word_boundaries, (continued)
- [nongnu] elpa/rust-mode 1ff1d75 193/486: Merge pull request #90 from Wilfred/fix_type_word_boundaries, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 30d1dac 198/486: Recognize compiler help and notes as "info" messages, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 61a35f6 202/486: Merge pull request #97 from syohex/update-url, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0cf2bc3 255/486: Merge pull request #157 from fmdkdd/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c2a0c13 269/486: Add info to enable rustfmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode cd09a54 280/486: Merge pull request #189 from froydnj/minor-cleanups, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 19e6f60 291/486: Merge pull request #199 from tromey/open-paren-in-column-0, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7f7b2ac 293/486: mention keybinding for rustfmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 758ab8c 303/486: Add support for "default" keyword, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a73e9ee 004/486: Update reserved words for syntax highlighters (vim is still behind, though), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7724813 306/486: Merge pull request #206 from cjhowe7/master,
ELPA Syncer <=
- [nongnu] elpa/rust-mode ac6a45e 308/486: Merge pull request #213 from KeenS/restore-points, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d38bfb8 309/486: Set `compile-command' in `rust-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c00c8a9 312/486: Require `json'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 90f70ac 328/486: Use `font-lock-variable-name-face' for `let' bindings., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9eda807 341/486: Merge pull request #239 from shepmaster/no-more-int-float, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1275a19 363/486: make rustc-colon-compilation-regexps an info type, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9154e0e 372/486: silence byte-compiler, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5f37343 379/486: Add rust-indent-return-type-to-arguments variable, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8cd18cc 385/486: Merge pull request #293 from TristanCacqueray/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode df31a6e 393/486: Don't call syntax-ppss twice for strings ending with r., ELPA Syncer, 2021/08/07