Skip to content

Commit

Permalink
use rustic-save-some-buffers instead of save-some-buffers
Browse files Browse the repository at this point in the history
when called in rust project

close #424
  • Loading branch information
brotzeit committed Aug 17, 2022
1 parent 4fe7ff5 commit 78a7161
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions rustic-rustfmt.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 78a7161

Please sign in to comment.