[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 8665005 436/486: Introduce constant for *rustfmt
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 8665005 436/486: Introduce constant for *rustfmt*. |
Date: |
Sat, 7 Aug 2021 09:26:09 -0400 (EDT) |
branch: elpa/rust-mode
commit 86650056717be0661feae32e294ff991c087ed4d
Author: Nathan Moreau <nathan.moreau@m4x.org>
Commit: Nathan Moreau <nathan.moreau@m4x.org>
Introduce constant for *rustfmt*.
---
rust-mode.el | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/rust-mode.el b/rust-mode.el
index 0245527..d4b27c2 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1440,9 +1440,11 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(point)))
;; Formatting using rustfmt
+(defconst rust-rustfmt-buffername "*rustfmt*")
+
(defun rust--format-call (buf)
"Format BUF using rustfmt."
- (with-current-buffer (get-buffer-create "*rustfmt*")
+ (with-current-buffer (get-buffer-create rust-rustfmt-buffername)
(erase-buffer)
(insert-buffer-substring buf)
(let* ((tmpf (make-temp-file "rustfmt"))
@@ -1479,7 +1481,7 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
;; Since we run rustfmt through stdin we get <stdin> markers in the
;; output. This replaces them with the buffer name instead.
(defun rust--format-fix-rustfmt-buffer (buffer-name)
- (with-current-buffer (get-buffer "*rustfmt*")
+ (with-current-buffer (get-buffer rust-rustfmt-buffername)
(goto-char (point-min))
(while (re-search-forward "--> <stdin>:")
(replace-match (format "--> %s:" buffer-name)))))
@@ -1490,7 +1492,7 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(defun rust--format-error-handler ()
(let ((ok nil))
(when rust-format-show-buffer
- (display-buffer (get-buffer "*rustfmt*"))
+ (display-buffer (get-buffer rust-rustfmt-buffername))
(setq ok t))
(when rust-format-goto-problem
(rust-goto-format-problem)
@@ -1506,7 +1508,7 @@ rustfmt complain in the echo area."
;; This uses position in *rustfmt* buffer to know which is the next
;; error to jump to, and source: line in the buffer to figure which
;; buffer it is from.
- (let ((rustfmt (get-buffer "*rustfmt*")))
+ (let ((rustfmt (get-buffer rust-rustfmt-buffername)))
(if (not rustfmt)
(message "No *rustfmt*, no problems.")
(let ((target-buffer (with-current-buffer rustfmt
@@ -1817,7 +1819,7 @@ Return the created process."
(when rust-format-on-save
(if (not (executable-find rust-rustfmt-bin))
(error "Could not locate executable \"%s\"" rust-rustfmt-bin)
- (when (get-buffer "*rustfmt*")
+ (when (get-buffer rust-rustfmt-buffername)
;; KLDUGE: re-run the error handlers -- otherwise message area
;; would show "Wrote ..." instead of the error description.
(or (rust--format-error-handler)
- [nongnu] elpa/rust-mode 15a077a 458/486: rustc-colon-compilation-regexps: improve highlighting., (continued)
- [nongnu] elpa/rust-mode 15a077a 458/486: rustc-colon-compilation-regexps: improve highlighting., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 00177f5 461/486: compile-mode integration: add link to code references. (#391), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5585cf9 477/486: rust-mode: Cosmetics, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3fa8f0b 479/486: Add non-empty commentary section, slightly reword summary, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7ff04a8 337/486: Merge pull request #234 from jjwest/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 70ff9a0 421/486: electric-pair-mode: prevent self-insert of `>' when already inserted. (#337), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4fd637c 428/486: rust-insert-dbg: handle the case of string literals. (#342), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 844bb51 429/486: add support for "async fn", ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 63ec74c 434/486: Enforce use of spaces for indentation and cleanup whitespace (#353), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a36c96a 435/486: integrate rustfmt error messages, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8665005 436/486: Introduce constant for *rustfmt*.,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 08d7141 449/486: README: support for emacs 24 has been dropped., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1603a25 455/486: Change 'rust-build' to 'rust-compile' in README.md, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6e4835c 456/486: Update README.md, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5dc219f 465/486: rearrange III: Mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode beda16d 466/486: rearrange IV: Misc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f9e3618 468/486: Divide library into sections, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e9e9e32 472/486: Add release build/run functions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e006788 474/486: Add .dir-locals.el, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7fdb9c2 450/486: Use <kbd> to indicate keyboard input in README (#375), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d211e68 453/486: Fix various byte compilation warnings in rust-mode-tests.el., ELPA Syncer, 2021/08/07