Skip to content

Commit 2bc6bd0

Browse files
committed
feat: Add nix3-compile-in-comint-mode option
1 parent 2ef90c0 commit 2bc6bd0

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

nix3-core.el

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@
6161
"String used as a separator in `completing-read-multiple'."
6262
:type 'string)
6363

64+
(defcustom nix3-compile-in-comint-mode t
65+
"Whether to run `compile' in `comint-mode'.
66+
67+
If this option is t, background nix processes will be run in
68+
`comint-mode' with `compilation-shell-minor-mode'. See `compile' for details."
69+
:type 'boolean)
70+
6471
;;;; Variables
6572

6673
(defvar nix3-config-cache nil)
@@ -99,7 +106,8 @@ This command discard the exit code or output of the command."
99106
;; Use compile for now, but it may be a better way
100107
(compile (mapconcat #'shell-quote-argument
101108
(cons cmd args)
102-
" ")))
109+
" ")
110+
nix3-compile-in-comint-mode))
103111

104112
(defun nix3-system ()
105113
"Return the system name of Nix."

nix3-flake.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,8 @@ non-interactively."
11681168
(concat "nix flake lock "
11691169
(mapconcat (lambda (name)
11701170
(format "--update-input %s" name))
1171-
names " "))))))
1171+
names " ")))
1172+
nix3-compile-in-comint-mode)))
11721173

11731174
(provide 'nix3-flake)
11741175
;;; nix3-flake.el ends here

nix3-transient.el

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ will be refreshed."
612612
(nix3-transient-with-directory
613613
(compile (nix3-transient--shell-command
614614
nix3-transient-flake-output
615-
(transient-args 'nix3-transient-build)))))
615+
(transient-args 'nix3-transient-build))
616+
nix3-compile-in-comint-mode)))
616617

617618
(transient-define-prefix nix3-transient-run ()
618619
["nix run"
@@ -639,7 +640,8 @@ will be refreshed."
639640
(transient-args 'nix3-transient-run))
640641
(if nix3-transient-command-args
641642
(concat " -- " nix3-transient-command-args)
642-
"")))))
643+
""))
644+
nix3-compile-in-comint-mode)))
643645

644646
(defun nix3-transient--run-term ()
645647
(interactive)
@@ -679,7 +681,8 @@ will be refreshed."
679681
(nix3-transient-with-directory
680682
(compile (nix3-transient--shell-command
681683
nil
682-
(transient-args 'nix3-transient-flake-check)))))
684+
(transient-args 'nix3-transient-flake-check))
685+
nix3-compile-in-comint-mode)))
683686

684687
(transient-define-prefix nix3-transient-flake-lock ()
685688
["nix flake lock/update"
@@ -710,7 +713,8 @@ will be refreshed."
710713
(append (transient-args 'nix3-transient-flake-lock)
711714
(mapcar (lambda (input)
712715
(list "--update-input" input))
713-
nix3-transient-updated-inputs))))))))
716+
nix3-transient-updated-inputs)))))
717+
nix3-compile-in-comint-mode)))
714718

715719
(defun nix3-transient-input ()
716720
(interactive)
@@ -742,7 +746,8 @@ will be refreshed."
742746
(interactive)
743747
(nix3-transient-with-directory
744748
(compile (nix3-transient--shell-command
745-
nix3-transient-flake-output))))
749+
nix3-transient-flake-output)
750+
nix3-compile-in-comint-mode)))
746751

747752
(defun nix3-transient--command-description ()
748753
(string-join (cons "nix" nix3-transient-nix-command) " "))

0 commit comments

Comments
 (0)