Skip to content

Commit 5aeae14

Browse files
committed
rust-format-diff-buffer: use start-process rather than make-process.
1 parent 10ba29e commit 5aeae14

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

rust-mode.el

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,19 +1457,23 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
14571457
(min (point) max-pos)))))
14581458

14591459
(defun rust-format-diff-buffer ()
1460-
"Show diff to current buffer from rustfmt."
1460+
"Show diff to current buffer from rustfmt.
1461+
1462+
Return the created process."
14611463
(interactive)
14621464
(unless (executable-find rust-rustfmt-bin)
14631465
(error "Could not locate executable \%s\"" rust-rustfmt-bin))
1464-
(make-process
1465-
:name "rustfmt-diff"
1466-
:command (list rust-rustfmt-bin "--check" (buffer-file-name))
1467-
:buffer
1468-
(with-current-buffer
1469-
(get-buffer-create "*rustfmt-diff*")
1470-
(erase-buffer)
1471-
(current-buffer))
1472-
:sentinel 'rust-format-diff-buffer-sentinel))
1466+
(let ((proc
1467+
(start-process "rustfmt-diff"
1468+
(with-current-buffer
1469+
(get-buffer-create "*rustfmt-diff*")
1470+
(erase-buffer)
1471+
(current-buffer))
1472+
rust-rustfmt-bin
1473+
"--check"
1474+
(buffer-file-name))))
1475+
(set-process-sentinel proc 'rust-format-diff-buffer-sentinel)
1476+
proc))
14731477

14741478
(defun rust-format-diff-buffer-sentinel (process _e)
14751479
(when (eq 'exit (process-status process))

0 commit comments

Comments
 (0)