summaryrefslogtreecommitdiff
path: root/rust-rustfmt.el
diff options
context:
space:
mode:
authorBrent Westbrook <brentrwestbrook@gmail.com>2022-12-20 14:59:31 -0500
committerBrent Westbrook <brentrwestbrook@gmail.com>2022-12-20 14:59:31 -0500
commit4f7581d4c3b07f93deb4f187b7b92468a656b756 (patch)
tree4b576e5d031f3d7740d8a42a4b8d9081e5398928 /rust-rustfmt.el
parent384051e23f0f2e2950e6ce2efd1a2e8ac0c53613 (diff)
downloadrust-mode-4f7581d4c3b07f93deb4f187b7b92468a656b756.tar.gz
check for rustfmt window before deleting it, fixes the fix to #475
adapted from https://github.com/dominikh/go-mode.el/blob/08aa90d52f0e7d2ad02f961b554e13329672d7cb/go-mode.el#L1986
Diffstat (limited to 'rust-rustfmt.el')
-rw-r--r--rust-rustfmt.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/rust-rustfmt.el b/rust-rustfmt.el
index ff5ba25..de618cb 100644
--- a/rust-rustfmt.el
+++ b/rust-rustfmt.el
@@ -69,7 +69,10 @@
(with-current-buffer buf
(replace-buffer-contents rust-rustfmt-buffername))
(copy-to-buffer buf (point-min) (point-max))))
- (kill-buffer-and-window))
+ (let ((win (get-buffer-window rust-rustfmt-buffername)))
+ (if win
+ (quit-window t win)
+ (kill-buffer rust-rustfmt-buffername))))
((= ret 3)
(if (not (string= (buffer-string)
(with-current-buffer buf (buffer-string))))