emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rust-mode 6886300 256/486: [master] Copy buffer only when


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 6886300 256/486: [master] Copy buffer only when format changes.
Date: Sat, 7 Aug 2021 09:25:31 -0400 (EDT)

branch: elpa/rust-mode
commit 68863001d75f103f6ffb5d0cc834ed63b7380c6d
Author: Yutian Li <hotpxless@gmail.com>
Commit: Yutian Li <hotpxless@gmail.com>

    [master] Copy buffer only when format changes.
---
 rust-mode.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/rust-mode.el b/rust-mode.el
index 16aaa6d..26cce7e 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1258,8 +1258,10 @@ This is written mainly to be used as 
`end-of-defun-function' for Rust."
     (erase-buffer)
     (insert-buffer-substring buf)
     (if (zerop (call-process-region (point-min) (point-max) rust-rustfmt-bin t 
t nil))
-        (progn (copy-to-buffer buf (point-min) (point-max))
-               (kill-buffer))
+        (progn
+          (if (not (string= (buffer-string) (with-current-buffer buf 
(buffer-string))))
+              (progn (copy-to-buffer buf (point-min) (point-max))))
+          (kill-buffer))
       (error "Rustfmt failed, see *rustfmt* buffer for details"))))
 
 (defun rust-format-buffer ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]