From 1d22d27f2376f39f1cde002c23af0770c127dea5 Mon Sep 17 00:00:00 2001 From: hellerve Date: Sun, 7 Jul 2019 14:39:15 +0200 Subject: [PATCH] e: fix erc --- erc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/erc b/erc index 3f51592..f03d049 100644 --- a/erc +++ b/erc @@ -30,7 +30,12 @@ end keys["!"] = function() command = prompt("shell command: %s") - command = string.gsub(command, "%$", get_filename()) + + if command == nil then + return + end + + command = string.gsub(command, "%$", get_filename() or "") handle = io.popen(command) result = handle:read("*a") handle:close() @@ -41,6 +46,12 @@ end meta_commands["carp"] = function() file = get_filename() + + if file == nil then + message("File has no name!") + return + end + handle = io.popen("carp --check "..file) result = handle:read("*a") handle:close() @@ -56,7 +67,7 @@ meta_commands["carp"] = function() f, l, c, msg = string.match(result, "([^:]+):(%d+):(%d+) (.-)[\r\n].*") - if f == file then + if string.match(f, file) then move(tonumber(l)-1, tonumber(c)) message(msg) end