diff --git a/layers/+lang/rust/funcs.el b/layers/+lang/rust/funcs.el index 7a58be61d..03bcba3a4 100644 --- a/layers/+lang/rust/funcs.el +++ b/layers/+lang/rust/funcs.el @@ -92,6 +92,7 @@ If `help-window-select' is non-nil, also select the help window." (md5 (buffer-file-name)))) (defun spacemacs//rust-quick-run-compilation-finish-function (buffer status) + (setq compilation-finish-functions (delete 'spacemacs//rust-quick-run-compilation-finish-function compilation-finish-functions)) (if (and (string-match "finished" status) (with-current-buffer buffer (string-match (concat "rustc -o " temporary-file-directory) (buffer-string)))) @@ -108,6 +109,7 @@ using `cargo-process-run'." (interactive) (setq spacemacs//rust-quick-run-tmp-file (spacemacs//rust-quick-run-generate-tmp-file-name(buffer-file-name))) + (add-to-list 'compilation-finish-functions 'spacemacs//rust-quick-run-compilation-finish-function) (compile (format "rustc -o %s %s" (shell-quote-argument spacemacs//rust-quick-run-tmp-file) diff --git a/layers/+lang/rust/packages.el b/layers/+lang/rust/packages.el index 7ab458221..d272fdcc3 100644 --- a/layers/+lang/rust/packages.el +++ b/layers/+lang/rust/packages.el @@ -102,8 +102,7 @@ (spacemacs/declare-prefix-for-mode 'rust-mode "m=" "format") (spacemacs/set-leader-keys-for-major-mode 'rust-mode "==" 'rust-format-buffer - "q" 'spacemacs/rust-quick-run) - (add-to-list 'compilation-finish-functions 'spacemacs//rust-quick-run-compilation-finish-function)))) + "q" 'spacemacs/rust-quick-run)))) (defun rust/post-init-smartparens () (with-eval-after-load 'smartparens