diff options
| author | Nathan Moreau <nathan.moreau@m4x.org> | 2019-09-23 23:38:09 +0200 |
|---|---|---|
| committer | Nathan Moreau <nathan.moreau@m4x.org> | 2019-09-26 20:24:33 +0200 |
| commit | 86b82ad377c3f51f4d96f67073ecdec6dffdcbee (patch) | |
| tree | 541528883ff5eb5b95898ec86abf94bea88905d2 | |
| parent | 5aeae14343fe325c03f097570721c76b57086856 (diff) | |
| download | rust-mode-86b82ad377c3f51f4d96f67073ecdec6dffdcbee.tar.gz | |
rust-format-diff-buffer-sentinel: use diff-mode and pop-to-buffer.
| -rw-r--r-- | rust-mode.el | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rust-mode.el b/rust-mode.el index 210b433..f2c4d86 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1467,7 +1467,8 @@ Return the created process." (start-process "rustfmt-diff" (with-current-buffer (get-buffer-create "*rustfmt-diff*") - (erase-buffer) + (let ((inhibit-read-only t)) + (erase-buffer)) (current-buffer)) rust-rustfmt-bin "--check" @@ -1478,7 +1479,10 @@ Return the created process." (defun rust-format-diff-buffer-sentinel (process _e) (when (eq 'exit (process-status process)) (if (> (process-exit-status process) 0) - (display-buffer "*rustfmt-diff*") + (with-current-buffer "*rustfmt-diff*" + (let ((inhibit-read-only t)) + (diff-mode)) + (pop-to-buffer (current-buffer))) (message "rustfmt check passed.")))) (defun rust-format-buffer () |
