From 9d779d63b7cba6687a6e7d8c09189b6a13b5033e Mon Sep 17 00:00:00 2001 From: Saul Pwanson Date: Thu, 26 Oct 2023 16:58:08 -0700 Subject: [PATCH] [macros-] save file as longname/keystroke #2084 --- visidata/cmdlog.py | 2 +- visidata/macros.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/visidata/cmdlog.py b/visidata/cmdlog.py index 3c2ded218..f80ef05ea 100644 --- a/visidata/cmdlog.py +++ b/visidata/cmdlog.py @@ -45,7 +45,7 @@ def checkVersion(vd, desired_version): vd.fail("version %s required" % desired_version) @VisiData.api -def fnSuffix(vd, prefix): +def fnSuffix(vd, prefix:str): i = 0 fn = prefix + '.vdj' while Path(fn).exists(): diff --git a/visidata/macros.py b/visidata/macros.py index 581b6f802..fc7bf97bf 100644 --- a/visidata/macros.py +++ b/visidata/macros.py @@ -84,7 +84,7 @@ def setMacro(ks, vs): def saveMacro(self, rows, ks): vs = copy(self) vs.rows = rows - macropath = Path(vd.fnSuffix(vd.options.visidata_dir+"macro")) + macropath = Path(vd.fnSuffix(str(Path(vd.options.visidata_dir)/ks))) vd.save_vdj(macropath, vs) setMacro(ks, vs) vd.macrosheet.source.append_tsv_row((ks, macropath))