function editormain(filename) local buf = read_file(filename) setup_editor() while 1 do buf:redraw() local command = read_command() if command == exit_command then break end buf:execute(command) end buf:save() end