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