File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -1555,7 +1555,8 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
1555
1555
(setq-local parse-sexp-lookup-properties t )
1556
1556
(setq-local electric-pair-inhibit-predicate 'rust-electric-pair-inhibit-predicate-wrap )
1557
1557
1558
- (add-hook 'before-save-hook 'rust--before-save-hook nil t )
1558
+ (add-hook 'before-save-hook 'rust-before-save-hook nil t )
1559
+ (add-hook 'after-save-hook 'rust-after-save-hook nil t )
1559
1560
1560
1561
(setq-local rust-buffer-project nil )
1561
1562
@@ -1571,9 +1572,17 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
1571
1572
(require 'rust-mode )
1572
1573
(rust-mode ))
1573
1574
1574
- (defun rust--before-save-hook ()
1575
- (when rust-format-on-save (rust-format-buffer)))
1576
-
1575
+ (defun rust-before-save-hook ()
1576
+ (when rust-format-on-save
1577
+ (condition-case nil
1578
+ (rust-format-buffer)
1579
+ (error nil ))))
1580
+
1581
+ (defun rust-after-save-hook ()
1582
+ (when rust-format-on-save
1583
+ (unless (executable-find rust-rustfmt-bin)
1584
+ (error " Could not locate executable \" %s \" " rust-rustfmt-bin))))
1585
+
1577
1586
(defvar rustc-compilation-regexps
1578
1587
(let ((file " \\ ([^\n ]+\\ )" )
1579
1588
(start-line " \\ ([0-9]+\\ )" )
You can’t perform that action at this time.
0 commit comments