diff options
| author | Nathan Moreau <nathan.moreau@m4x.org> | 2019-09-23 23:26:26 +0200 |
|---|---|---|
| committer | Nathan Moreau <nathan.moreau@m4x.org> | 2019-09-26 20:24:33 +0200 |
| commit | 5aeae14343fe325c03f097570721c76b57086856 (patch) | |
| tree | 0a1fc98a28cd87271d41acfbb5ba6f31723dd008 /rust-mode.el | |
| parent | 10ba29e7395af6bbc19ffcfd525008dc8a0a0db1 (diff) | |
| download | rust-mode-5aeae14343fe325c03f097570721c76b57086856.tar.gz | |
rust-format-diff-buffer: use start-process rather than make-process.
Diffstat (limited to 'rust-mode.el')
| -rw-r--r-- | rust-mode.el | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/rust-mode.el b/rust-mode.el index e71207c..210b433 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1457,19 +1457,23 @@ This is written mainly to be used as `end-of-defun-function' for Rust." (min (point) max-pos))))) (defun rust-format-diff-buffer () - "Show diff to current buffer from rustfmt." + "Show diff to current buffer from rustfmt. + +Return the created process." (interactive) (unless (executable-find rust-rustfmt-bin) (error "Could not locate executable \%s\"" rust-rustfmt-bin)) - (make-process - :name "rustfmt-diff" - :command (list rust-rustfmt-bin "--check" (buffer-file-name)) - :buffer - (with-current-buffer - (get-buffer-create "*rustfmt-diff*") - (erase-buffer) - (current-buffer)) - :sentinel 'rust-format-diff-buffer-sentinel)) + (let ((proc + (start-process "rustfmt-diff" + (with-current-buffer + (get-buffer-create "*rustfmt-diff*") + (erase-buffer) + (current-buffer)) + rust-rustfmt-bin + "--check" + (buffer-file-name)))) + (set-process-sentinel proc 'rust-format-diff-buffer-sentinel) + proc)) (defun rust-format-diff-buffer-sentinel (process _e) (when (eq 'exit (process-status process)) |
