e: fix erc

This commit is contained in:
2019-07-07 14:39:15 +02:00
parent 7c208e926b
commit 1d22d27f23

15
erc
View File

@@ -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