branch: elpa/nix-mode
commit 0c2807f037c3372363f59c626b2f305e32e685d7
Author: Matthew Bauer <[email protected]>
Commit: Matthew Bauer <[email protected]>
Cleanup nix-build.el
---
nix-build.el | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/nix-build.el b/nix-build.el
index 0bea996f4a..df85a676d6 100644
--- a/nix-build.el
+++ b/nix-build.el
@@ -1,4 +1,4 @@
-;;; nix.el -- run nix commands in Emacs -*- lexical-binding: t -*-
+;;; nix-build.el -- run nix commands in Emacs -*- lexical-binding: t -*-
;; Author: Matthew Bauer <[email protected]>
;; Homepage: https://github.com/NixOS/nix-mode
@@ -8,21 +8,20 @@
;;; Commentary:
-;; To use this just run:
-
-;; M-x RET nix-shell RET
-
-;; This will give you some
-
;;; Code:
(require 'nix)
(require 'nix-search)
-(defun nix-build (&optional attr)
- "Run nix-build in a compilation buffer."
- (interactive (list (nix-search-read-attr "./.")))
- (setq compile-command (format "%s -A '%s'" nix-build-executable attr))
+(defun nix-build (&optional file attr)
+ "Run nix-build in a compilation buffer.
+FILE the file to parse.
+ATTR the attribute to build."
+ (interactive (list (nix-read-file) nil))
+ (unless attr (setq attr (nix-read-attr file)))
+
+ (setq compile-command (format "%s %s -A '%s'" nix-build-executable
+ file attr))
(setq-default compilation-directory default-directory)
(compilation-start compile-command nil
(apply-partially (lambda (attr _)