summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2021-03-29 19:13:00 +0200
committerbrotzeit <brotzeitmacher@gmail.com>2021-04-23 13:57:07 +0200
commit494d59f92cbe12533eb89b202fc4f5342afcd543 (patch)
tree22f3a04d3700d3332714b3714124a8f765c049ff
parent3eb6d2fc2dcdf117e0570fa1891ccf63720f27ca (diff)
downloadrust-mode-494d59f92cbe12533eb89b202fc4f5342afcd543.tar.gz
Make most additional libraries optional
-rw-r--r--rust-mode.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/rust-mode.el b/rust-mode.el
index 94604e1..2b9490b 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -17,6 +17,16 @@
(eval-when-compile (require 'rx))
+(defvar rust-load-optional-libraries t
+ "Whether loading `rust-mode' also loads optional libraries.
+This variable might soon be remove again.")
+
+(when rust-load-optional-libraries
+ (require 'rust-cargo)
+ (require 'rust-compile)
+ (require 'rust-playpen)
+ (require 'rust-rustfmt))
+
(defvar electric-pair-inhibit-predicate)
(defvar electric-pair-skip-self)
(defvar electric-indent-chars)
@@ -188,9 +198,10 @@ Use idomenu (imenu with `ido-mode') for best mileage.")
(defvar rust-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map (kbd "C-c C-f") 'rust-format-buffer)
(define-key map (kbd "C-c C-d") 'rust-dbg-wrap-or-unwrap)
- (define-key map (kbd "C-c C-n") 'rust-goto-format-problem)
+ (when rust-load-optional-libraries
+ (define-key map (kbd "C-c C-f") 'rust-format-buffer)
+ (define-key map (kbd "C-c C-n") 'rust-goto-format-problem))
map)
"Keymap for Rust major mode.")