From e7e39f3701be967f86248e9356323384c4b5d9ea Mon Sep 17 00:00:00 2001 From: Nathan Moreau Date: Sun, 12 Apr 2020 17:38:48 +0200 Subject: [PATCH 1/3] rust--format-fix-rustfmt-buffer: replace "stdin:" as well as ":". --- rust-mode.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust-mode.el b/rust-mode.el index f91d5ff5..154978b4 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1484,6 +1484,8 @@ This is written mainly to be used as `end-of-defun-function' for Rust." (with-current-buffer (get-buffer rust-rustfmt-buffername) (goto-char (point-min)) (while (re-search-forward "--> :" nil t) + (replace-match (format "--> %s:" buffer-name))) + (while (re-search-forward "--> stdin:" nil t) (replace-match (format "--> %s:" buffer-name))))) ;; If rust-mode has been configured to navigate to source of the error From 458175908caf0b7995bd1077c55f3398c9aa7761 Mon Sep 17 00:00:00 2001 From: Nathan Moreau Date: Sun, 12 Apr 2020 17:40:29 +0200 Subject: [PATCH 2/3] rust-format-show-buffer: default to true. Otherwise it might not be clear what the problem is, in case of whitespace issues. --- rust-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-mode.el b/rust-mode.el index 154978b4..b6ef25b3 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -198,7 +198,7 @@ to the function arguments. When nil, `->' will be indented one level." :safe #'booleanp :group 'rust-mode) -(defcustom rust-format-show-buffer nil +(defcustom rust-format-show-buffer t "Show *rustfmt* buffer if formatting detected problems." :type 'boolean :safe #'booleanp From 6f32687331f527a272ae765837a2124fb7f7f72d Mon Sep 17 00:00:00 2001 From: Nathan Moreau Date: Sun, 12 Apr 2020 17:52:14 +0200 Subject: [PATCH 3/3] rust-goto-format-problem: make sure to always just to a buffer that exists. --- rust-mode.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-mode.el b/rust-mode.el index b6ef25b3..9d17cc08 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1534,7 +1534,7 @@ rustfmt complain in the echo area." (if (re-search-forward "\nerror:.+\n" nil t) (buffer-substring p0 (point)) (buffer-substring p0 (point-max))))))))) - (when (and target-buffer target-point) + (when (and target-buffer (get-buffer target-buffer) target-point) (switch-to-buffer target-buffer) (goto-char (point-min)) (forward-line (1- (car target-point)))