aboutsummaryrefslogtreecommitdiff
path: root/src/nix/edit.cc
diff options
context:
space:
mode:
authorpennae <82953136+pennae@users.noreply.github.com>2022-04-25 14:02:37 +0000
committerGitHub <noreply@github.com>2022-04-25 14:02:37 +0000
commitd6d6bbd9ef1eed6443165866cd7bd27faa9586a1 (patch)
tree38e55dcce53445088725a86c14c903106879e0b6 /src/nix/edit.cc
parentf2603e9c92947a0e0c01fc34e754270f46c63790 (diff)
parent7f814d6d9af9d78f922d59115a94078f807676a8 (diff)
Merge branch 'master' into lto
Diffstat (limited to 'src/nix/edit.cc')
-rw-r--r--src/nix/edit.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/nix/edit.cc b/src/nix/edit.cc
index fc48db0d7..76a134b1f 100644
--- a/src/nix/edit.cc
+++ b/src/nix/edit.cc
@@ -28,19 +28,19 @@ struct CmdEdit : InstallableCommand
{
auto state = getEvalState();
- auto [v, pos] = installable->toValue(*state);
+ const auto [file, line] = [&] {
+ auto [v, pos] = installable->toValue(*state);
- try {
- pos = findPackageFilename(*state, *v, installable->what());
- } catch (NoPositionInfo &) {
- }
-
- if (pos == noPos)
- throw Error("cannot find position information for '%s", installable->what());
+ try {
+ return findPackageFilename(*state, *v, installable->what());
+ } catch (NoPositionInfo &) {
+ throw Error("cannot find position information for '%s", installable->what());
+ }
+ }();
stopProgressBar();
- auto args = editorFor(pos);
+ auto args = editorFor(file, line);
restoreProcessContext();