[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode a5bf79a563 425/500: Merge pull request #120 from
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode a5bf79a563 425/500: Merge pull request #120 from znewman01/master |
Date: |
Sat, 29 Jan 2022 08:27:51 -0500 (EST) |
branch: elpa/nix-mode
commit a5bf79a563f9ef2b77b91a2ecaa112d3153beacf
Merge: 7d09073976 7556c032dc
Author: Matthew Bauer <mjbauer95@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #120 from znewman01/master
Use the located nixfmt binary for formatting.
---
nix-format.el | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/nix-format.el b/nix-format.el
index f43dc4d908..1f97e8a086 100644
--- a/nix-format.el
+++ b/nix-format.el
@@ -13,24 +13,29 @@
:group 'nix
:type 'string)
-(defun nix--format-call (buf)
+(defun nix--format-call (buf nixfmt-bin)
"Format BUF using nixfmt."
(with-current-buffer (get-buffer-create "*nixfmt*")
(erase-buffer)
(insert-buffer-substring buf)
- (if (zerop (call-process-region (point-min) (point-max) nix-nixfmt-bin t t
nil))
+ (if (zerop (call-process-region (point-min) (point-max) nixfmt-bin t t
nil))
(progn
(if (not (string= (buffer-string) (with-current-buffer buf
(buffer-string))))
(copy-to-buffer buf (point-min) (point-max)))
(kill-buffer))
(error "Nixfmt failed, see *nixfmt* buffer for details"))))
+(defun nix--find-nixfmt ()
+ "Find the nixfmt binary, or error if it's missing."
+ (let ((nixfmt-bin (executable-find nix-nixfmt-bin)))
+ (unless nixfmt-bin
+ (error "Could not locate executable \"%s\"" nix-nixfmt-bin))
+ nixfmt-bin))
+
(defun nix-format-buffer ()
"Format the current buffer using nixfmt."
(interactive)
- (unless (executable-find nix-nixfmt-bin)
- (error "Could not locate executable \"%s\"" nix-nixfmt-bin))
- (nix--format-call (current-buffer))
+ (nix--format-call (current-buffer) (nix--find-nixfmt))
(message "Formatted buffer with nixfmt."))
(provide 'nix-format)
- [nongnu] elpa/nix-mode ade1d49841 128/500: Fixup indentation logic., (continued)
- [nongnu] elpa/nix-mode ade1d49841 128/500: Fixup indentation logic., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 414a40fe54 131/500: Add hydra mode (#25), ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode f7fa332705 155/500: Add nix-shell custom group, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 6573b1d70e 145/500: Add nix-shell.el, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 0af6073003 171/500: Add nix-mode to nix-mode group., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode af686b570c 159/500: Fix package-lint complaints., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 3fa526ee57 165/500: Add MELPA badges to READM.md, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 420cbbf94c 215/500: Reorganization, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 1090226479 224/500: nix-repl-show -> nix-repl, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 588246b499 229/500: Fix escaping of characters, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode a5bf79a563 425/500: Merge pull request #120 from znewman01/master,
ELPA Syncer <=
- [nongnu] elpa/nix-mode 7593b023a7 405/500: Merge pull request #110 from leungbk/repl-history, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 1fdf8e654a 444/500: Merge pull request #132 from league/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 8e20de5ba7 462/500: Merge pull request #134 from nagy/store-path, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 01e37b6761 464/500: Merge pull request #139 from akirak/fix/nix-24-for-25, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 8a05b88eb3 448/500: Fix a typo, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 207e5c0a92 455/500: nix-format.el: Add nix-format-before-save, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 86b7195b3e 010/500: Use warning font lock for upper case vars, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode c81c03b35e 403/500: nix-repl: use history file, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode c19e103eee 430/500: Add support nix 2.4 flakes in search, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 5fa017c6ad 393/500: Merge pull request #105 from rossabaker/completions, ELPA Syncer, 2022/01/29