diff options
| author | Christian Howe <cjhowe7@gmail.com> | 2017-04-18 12:59:09 -0400 |
|---|---|---|
| committer | Christian Howe <cjhowe7@gmail.com> | 2017-04-18 12:59:09 -0400 |
| commit | 367a89c423481db18ab1dd346f5b389ca392a69e (patch) | |
| tree | 0c7930e4a3997057b41485bf5748c3ccd287c1f6 /rust-mode.el | |
| parent | dae5af71ebf4b5c6797ef057e8a0ebf655bcdbfb (diff) | |
| download | rust-mode-367a89c423481db18ab1dd346f5b389ca392a69e.tar.gz | |
Allow formatting with long lines
Diffstat (limited to 'rust-mode.el')
| -rw-r--r-- | rust-mode.el | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/rust-mode.el b/rust-mode.el index f1c3994..1fce291 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1195,12 +1195,13 @@ 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 ((ret (call-process-region (point-min) (point-max) rust-rustfmt-bin t '(t nil) nil))) + (if (or (zerop ret) (= ret 3)) + (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"))))) (defconst rust--format-word "\\b\\(else\\|enum\\|fn\\|for\\|if\\|let\\|loop\\|match\\|struct\\|unsafe\\|while\\)\\b") (defconst rust--format-line "\\([\n]\\)") |
