From 78a71617b93af24f5fadf61e82ec0b303b994a5d Mon Sep 17 00:00:00 2001 From: brotzeit Date: Wed, 17 Aug 2022 15:56:27 +0200 Subject: [PATCH] use rustic-save-some-buffers instead of save-some-buffers when called in rust project close #424 --- rustic-rustfmt.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rustic-rustfmt.el b/rustic-rustfmt.el index 275982dc..0a0a2d11 100644 --- a/rustic-rustfmt.el +++ b/rustic-rustfmt.el @@ -456,9 +456,13 @@ non-nil." (or rustic-format-on-save (eq rustic-format-trigger 'on-save))) (defun rustic-save-some-buffers-advice (orig-fun &rest args) - (let ((rustic-format-trigger nil) - (rustic-format-on-save nil)) - (apply orig-fun args))) + "Use `rustic-save-some-buffers' instead when called in rust project. +Otherwise turn off rustic format functionality and run `save-some-buffers'." + (if (rustic-buffer-crate t) + (rustic-save-some-buffers) + (let ((rustic-format-trigger nil) + (rustic-format-on-save nil)) + (apply orig-fun args)))) (advice-add 'save-some-buffers :around #'rustic-save-some-buffers-advice)