branch: elpa/nix-mode
commit c016c5503dc29c78d59a11c5a9cc31b7cc4e5e60
Author: Akira Komamura <[email protected]>
Commit: Akira Komamura <[email protected]>
nix-flake: Reuse the last flake when two C-u is given
---
nix-flake.el | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/nix-flake.el b/nix-flake.el
index 011e2a2f8a..8371337cc7 100644
--- a/nix-flake.el
+++ b/nix-flake.el
@@ -391,9 +391,12 @@ DIR is a directory on the file system in which flake.nix
resides.
Alternatively, you can specify FLAKE-REF which follows the syntax
of flake-url. It can refer to a remote url, a local file path, or
whatever supported by Nix."
- (interactive (if (consp current-prefix-arg)
- (list nil :flake-ref (nix-flake--select-flake))
- (list default-directory)))
+ (interactive (pcase current-prefix-arg
+ ('(4) (list nil :flake-ref (nix-flake--select-flake)))
+ ('(16) (if nix-flake-ref
+ (list nil :flake-ref nix-flake-ref)
+ (user-error "Last flake is unavailable")))
+ (_ (list default-directory))))
(cl-assert (or (file-directory-p dir)
flake-ref)
nil