branch: elpa/rust-mode commit b2b18aa6c135d9b06242b3d081d94fe0c0cb8e86 Merge: 150b61f7ed 7c5de035fa Author: Sibi Prabakaran <s...@psibi.in> Commit: GitHub <nore...@github.com>
Merge pull request #534 from tarsiiformes/fixup Fix ancient defect and dependency complications related to having two rust-mode implementations --- rust-mode-treesitter.el | 7 ++++--- rust-mode.el | 10 ++++++---- rust-prog-mode.el | 3 ++- rust-rustfmt.el | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/rust-mode-treesitter.el b/rust-mode-treesitter.el index 89c7cd43f5..21eab59f91 100644 --- a/rust-mode-treesitter.el +++ b/rust-mode-treesitter.el @@ -5,12 +5,13 @@ ;;; Code: +(require 'rust-mode) + +;; Do not compile or load on Emacs releases that don't support +;; this. See https://github.com/rust-lang/rust-mode/issues/520. (when (version<= "29.1" emacs-version) - ;; We have the when macro because of - ;; https://github.com/rust-lang/rust-mode/issues/520 (require 'treesit) (require 'rust-ts-mode) - (require 'rust-common) (define-derived-mode rust-mode rust-ts-mode "Rust" "Major mode for Rust code. diff --git a/rust-mode.el b/rust-mode.el index a0f6542753..8d38295b04 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -71,10 +71,6 @@ instead of `prog-mode'. This option requires emacs29+." map) "Keymap for Rust major mode.") -(if (and (version<= "29.1" emacs-version) rust-mode-treesitter-derive) - (require 'rust-mode-treesitter) - (require 'rust-prog-mode)) - ;;;###autoload (autoload 'rust-mode "rust-mode" "Major mode for Rust code." t) @@ -82,6 +78,12 @@ instead of `prog-mode'. This option requires emacs29+." (add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode)) (provide 'rust-mode) + +(if (and rust-mode-treesitter-derive + (version<= "29.1" emacs-version)) + (require 'rust-mode-treesitter) + (require 'rust-prog-mode)) + (require 'rust-utils) ;;; rust-mode.el ends here diff --git a/rust-prog-mode.el b/rust-prog-mode.el index 51e802ddcb..05bc5e0daf 100644 --- a/rust-prog-mode.el +++ b/rust-prog-mode.el @@ -4,7 +4,8 @@ ;; rust-mode code deriving from prog-mode instead of rust-ts-mode ;;; Code: -(require 'rust-common) + +(require 'rust-mode) (defvar electric-pair-inhibit-predicate) (defvar electric-pair-skip-self) diff --git a/rust-rustfmt.el b/rust-rustfmt.el index f609980382..cab183c598 100644 --- a/rust-rustfmt.el +++ b/rust-rustfmt.el @@ -87,8 +87,8 @@ (insert-file-contents tmpf) (rust--format-fix-rustfmt-buffer (buffer-name buf)) (error "Rustfmt failed, see %s buffer for details" - rust-rustfmt-buffername)))) - (delete-file tmpf)))))) + rust-rustfmt-buffername))) + (delete-file tmpf))))))) ;; Since we run rustfmt through stdin we get <stdin> markers in the ;; output. This replaces them with the buffer name instead.