[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode b7237b0 405/486: Add rust-format-diff-buffer
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode b7237b0 405/486: Add rust-format-diff-buffer |
Date: |
Sat, 7 Aug 2021 09:26:02 -0400 (EDT) |
branch: elpa/rust-mode
commit b7237b0edfc6f8518c2f8c8a4d83638960af88e4
Author: Phillip Lord <phillip.lord@russet.org.uk>
Commit: Nathan Moreau <nathan.moreau@m4x.org>
Add rust-format-diff-buffer
This command displays the output of rustfmt-diff.
---
rust-mode.el | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/rust-mode.el b/rust-mode.el
index c81f421..85c1a23 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1456,6 +1456,27 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(forward-char columns)))
(min (point) max-pos)))))
+(defun rust-format-diff-buffer ()
+ "Show diff to current buffer from rustfmt."
+ (interactive)
+ (unless (executable-find rust-rustfmt-bin)
+ (error "Could not locate executable \%s\"" rust-rustfmt-bin))
+ (make-process
+ :name "rustfmt-diff"
+ :command (list rust-rustfmt-bin "--check" (buffer-file-name))
+ :buffer
+ (with-current-buffer
+ (get-buffer-create "*rustfmt-diff*")
+ (erase-buffer)
+ (current-buffer))
+ :sentinel 'rust-format-diff-buffer-sentinel))
+
+(defun rust-format-diff-buffer-sentinel (process e)
+ (when (eq 'exit (process-status process))
+ (if (> (process-exit-status process) 0)
+ (display-buffer "*rustfmt-diff*")
+ (message "rustfmt check passed."))))
+
(defun rust-format-buffer ()
"Format the current buffer using rustfmt."
(interactive)
- [nongnu] elpa/rust-mode 5375e54 454/486: Test byte compilation of test code., (continued)
- [nongnu] elpa/rust-mode 5375e54 454/486: Test byte compilation of test code., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 33d178d 030/486: Make 'foo use font-lock-builtin-face, like module names, and make capitalized identifiers optionally use font-lock-type-face, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9e2221c 034/486: Fix typo, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8f926be 031/486: Emacs: Update emacs mode to be more similar to the vim mode., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode cfb4408 354/486: Merge pull request #258 from sebastiencs/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b861aa9 358/486: Fixed indent when ? operator is used in chained method calls, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 31b8453 361/486: update to include line number and column information, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3254297 366/486: Bump version, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d3a7025 377/486: Merge pull request #292 from mookid/imenu-impl, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode dd231ed 383/486: Avoid signaling "Beginning of buffer" in rust-lookng-back-macro, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b7237b0 405/486: Add rust-format-diff-buffer,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 10ba29e 406/486: Silence byte-compiler, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c8217a3 425/486: Fix rust-insert-dbg for emacs-version < 25. (#339), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0e25008 043/486: rust-mode: Default rust-indent-offset to 4, not default-tab-width, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 679501e 056/486: Cover all cases for padding in paragraph fills as intended, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bee96e8 067/486: Fix emacs indentation of multi-line match patterns, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9d8dff8 077/486: Use defvar for rust-top-item-beg-re instead, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e2cd79b 084/486: auto merge of #14818 : tomjakubowski/rust/emacs-attributes-key-value, r=pnkfelix, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9672625 066/486: Added more scripts to tidy check, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7cb68f7 088/486: Add new keywords (particularly `where` & `virtual`) to editor modes., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode efbc810 089/486: Replaced some TODO by FIXME, ELPA Syncer, 2021/08/07