From 03bce74262f419d0bb75944e78b6b33067e4c04e Mon Sep 17 00:00:00 2001 From: Manuel Ebert Date: Fri, 3 Jan 2014 15:52:59 +0100 Subject: [PATCH] Make editing work with templates --- jrnl/util.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jrnl/util.py b/jrnl/util.py index a14e2915..7a049ac0 100644 --- a/jrnl/util.py +++ b/jrnl/util.py @@ -128,11 +128,9 @@ def load_and_fix_json(json_path): def get_text_from_editor(config, template=""): tmpfile = os.path.join(tempfile.gettempdir(), "jrnl") - if template: - with codecs.open(tmpfile, 'w', "utf-8") as f: + with codecs.open(tmpfile, 'w', "utf-8") as f: + if template: f.write(template) - with open(tmpfile, 'w'): - pass subprocess.call(config['editor'].split() + [tmpfile]) with codecs.open(tmpfile, "r", "utf-8") as f: raw = f.read()