ronantakizawa/codereview-bench huggingface dataset:
Repository: neovim/neovim
File: src/nvim/quickfix.c (C)

Code before:
  FUNC_ATTR_NONNULL_ALL
{
  qf_list_T *const qfl = qf_get_curlist(qi);
  win_T *const save_curwin = curwin;

  FOR_ALL_TAB_WINDOWS(tp, win) {
    if (is_qf_win(win, qi)) {
      curwin = win;
      qf_set_title_var(qfl);
    }
  }
  curwin = save_curwin;
}

// Find the quickfix buffer.  If it exists, update the contents.
static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
{
  // Check if a buffer for the quickfix list exists.  Update it.
  buf_T *buf = qf_find_buf(qi);
  if (buf == NULL) {
    return;
  }

  linenr_T old_line_count = buf->b_ml.ml_line_count;
  colnr_T old_endcol = ml_get_buf_len(buf, old_line_count);
  bcount_t old_byte_count = get_region_bytecount(buf, 1, old_line_count, 0, old_endcol);
  int qf_winid = 0;

  win_T *win;
  if (IS_LL_STACK(qi)) {
    if (curwin->w_llist == qi) {
      win = curwin;
    } else {
      // Find the file window (non-quickfix) with this location list
      win = qf_find_win_with_loclist(qi);
      if (win == NULL) {
        // File window is not found. Find the location list window.
        win = qf_find_win(qi);
      }
      if (win == NULL) {
        return;
      }
    }
    qf_winid = (int)win->handle;
  }

  // autocommands may cause trouble
  incr_quickfix_busy();

  aco_save_T aco;


Review comment (suggestion):
```suggestion
  bcount_t old_bytecount = get_region_bytecount(buf, 1, old_line_count, 0, old_endcol);
```

Code after:
  FUNC_ATTR_NONNULL_ALL
{
  qf_list_T *const qfl = qf_get_curlist(qi);
  win_T *const save_curwin = curwin;

  FOR_ALL_TAB_WINDOWS(tp, win) {
    if (is_qf_win(win, qi)) {
      curwin = win;
      qf_set_title_var(qfl);
    }
  }
  curwin = save_curwin;
}

// Find the quickfix buffer.  If it exists, update the contents.
static void qf_update_buffer(qf_info_T *qi, qfline_T *old_last)
{
  // Check if a buffer for the quickfix list exists.  Update it.
  buf_T *buf = qf_find_buf(qi);
  if (buf == NULL) {
    return;
  }

  linenr_T old_line_count = buf->b_ml.ml_line_count;
  colnr_T old_endcol = ml_get_buf_len(buf, old_line_count);
  bcount_t old_bytecount = get_region_bytecount(buf, 1, old_line_count, 0, old_endcol);
  int qf_winid = 0;

  win_T *win;
  if (IS_LL_STACK(qi)) {
    if (curwin->w_llist == qi) {
      win = curwin;
    } else {
      // Find the file window (non-quickfix) with this location list
      win = qf_find_win_with_loclist(qi);
      if (win == NULL) {
        // File window is not found. Find the location list window.
        win = qf_find_win(qi);
      }
      if (win == NULL) {
        return;
      }
    }
    qf_winid = (int)win->handle;
  }

  // autocommands may cause trouble
  incr_quickfix_busy();

  aco_save_T aco;
Repository: neovim/neovim
File: runtime/lua/vim/_buf.lua (Lua)

Code before:
local M = {}

--- Adds one or more blank lines above or below the cursor.
--- @param above? boolean Place blank line(s) above the cursor
local function add_blank(above)
  local offset = above and 1 or 0
  local repeated = vim.fn['repeat']({ '' }, vim.v.count1)
  local linenr = vim.api.nvim_win_get_cursor(0)[1]
  vim.api.nvim_buf_set_lines(0, linenr - offset, linenr - offset, true, repeated)
end

function M.space_above()
  add_blank(true)
end

function M.space_below()
  add_blank()
end

return M


Review comment (suggestion):
Add the TODO comments to this file too. Once the TODO is resolved these should be inlined into `_defaults.lua` so let's make that clear to future readers.

Code after:
local M = {}

--- Adds one or more blank lines above or below the cursor.
-- TODO: move to _defaults.lua once it is possible to assign a Lua function to options #25672
--- @param above? boolean Place blank line(s) above the cursor
local function add_blank(above)
  local offset = above and 1 or 0
  local repeated = vim.fn['repeat']({ '' }, vim.v.count1)
  local linenr = vim.api.nvim_win_get_cursor(0)[1]
  vim.api.nvim_buf_set_lines(0, linenr - offset, linenr - offset, true, repeated)
end

-- TODO: move to _defaults.lua once it is possible to assign a Lua function to options #25672
function M.space_above()
  add_blank(true)
end

-- TODO: move to _defaults.lua once it is possible to assign a Lua function to options #25672
function M.space_below()
  add_blank()
end

return M
Repository: neovim/neovim
File: runtime/lua/vim/_buf.lua (Lua)

Code before:
-- TODO: move to _defaults.lua once it is possible to assign a Lua function to options #25672
local M = {}

--- Adds one or more blank lines above or below the cursor.
--- @param above? boolean Place blank line(s) above the cursor
local function add_blank(above)
  local offset = above and 1 or 0
  local repeated = vim.fn['repeat']({ '' }, vim.v.count1)
  local linenr = vim.api.nvim_win_get_cursor(0)[1]
  vim.api.nvim_buf_set_lines(0, linenr - offset, linenr - offset, true, repeated)
end

function M.space_above()
  add_blank(true)
end

function M.space_below()
  add_blank()
end

return M


Review comment (suggestion):
let's add this todo on each of the functions. since `_buf.lua` might be extended for other purposes later, having this top-level TODO would be confusing

Code after:
local M = {}

--- Adds one or more blank lines above or below the cursor.
-- TODO: move to _defaults.lua once it is possible to assign a Lua function to options #25672
--- @param above? boolean Place blank line(s) above the cursor
local function add_blank(above)
  local offset = above and 1 or 0
  local repeated = vim.fn['repeat']({ '' }, vim.v.count1)
  local linenr = vim.api.nvim_win_get_cursor(0)[1]
  vim.api.nvim_buf_set_lines(0, linenr - offset, linenr - offset, true, repeated)
end

-- TODO: move to _defaults.lua once it is possible to assign a Lua function to options #25672
function M.space_above()
  add_blank(true)
end

-- TODO: move to _defaults.lua once it is possible to assign a Lua function to options #25672
function M.space_below()
  add_blank()
end

return M
Repository: neovim/neovim
File: runtime/lua/vim/health/health.lua (Lua)

Code before:
    string.format(
      '## Problem:\n\n\n\n'
        .. '## Steps to reproduce:\n\n```\nnvim --clean\n\n```\n\n'
        .. '## Expected behavior:\n\n\n\n'
        .. '## Nvim version (nvim -v):\n\n%s\n\n'
        .. '## Vim (not Nvim) behaves the same?\n\n\n\n'
        .. '## Operating system/version:\n\n%s\n\n'
        .. '## Terminal name/version:\n\n%s\n\n'
        .. '## $TERM environment variable:\n\n%s\n\n'
        .. '## Installation:\n\n',
      version_for_report,
      os_string,
      terminal,
      term_env
    )
  )

  local encoded_body = vim.uri_encode(body) --- @type string
  local issue_url = 'https://github.com/neovim/neovim/issues/new?labels=bug&body=' .. encoded_body
  vim.schedule(function()
    local win = vim.api.nvim_get_current_win()
    local buf = vim.api.nvim_win_get_buf(win)
    if vim.bo[buf].filetype ~= 'checkhealth' then
      return
    end
    _G._bugreport_open = function()
      vim.ui.open(issue_url)
    end
    vim.wo[win].winbar =
      '%#WarningMsg#%@v:lua._bugreport_open@Click to Create Bug Report on GitHub%X%*'
  end)
end

function M.check()
  check_config()
  check_runtime()
  check_performance()
  check_rplugin_manifest()
  check_sysinfo()
  check_terminal()
  check_tmux()
  check_external_tools()
end

return M


Review comment (bug):
As always, we want to "namespace" anything in a global scope.
```suggestion
    _G._nvim_health_bugreport_open = function()
```

Should probably do something like `_G._... = nil` on BufDelete.

Code after:

  local os_info = vim.uv.os_uname()
  local os_string = os_info.sysname .. ' ' .. os_info.release
  local terminal = detect_terminal()
  local term_env = vim.env.TERM or 'unknown'

  vim.health.info('Nvim version: ' .. nvim_version)
  vim.health.info('Operating system: ' .. os_string)
  vim.health.info('Terminal: ' .. terminal)
  vim.health.info('$TERM: ' .. term_env)

  local body = vim.text.indent(
    0,
    string.format(
      [[
    ## Problem:



    ## Steps to reproduce:
    ```
    nvim --clean
    ```

    ## Expected behavior:



    ## Nvim version (nvim -v):

    %s

    ## Vim (not Nvim) behaves the same?



    ## Operating system/version:

    %s

    ## Terminal name/version:

    %s

    ## $TERM environment variable:

    %s

    ## Installation:

]],
Repository: neovim/neovim
File: test/functional/lua/snippet_spec.lua (Lua)

Code before:
local n = require('test.functional.testnvim')()

local buf_lines = n.buf_lines
local clear = n.clear
local eq = t.eq
local exec_lua = n.exec_lua
local feed = n.feed
local api = n.api
local fn = n.fn
local matches = t.matches
local pcall_err = t.pcall_err
local poke_eventloop = n.poke_eventloop
local retry = t.retry

describe('vim.snippet', function()
  before_each(function()
    clear()
    exec_lua(function()
      local function set_snippet_jump(direction, key)
        vim.keymap.set({ 'i', 's' }, key, function()
          if vim.snippet.active({ direction = direction }) then
            return string.format('<Cmd>lua vim.snippet.jump(%d)<CR>', direction)
          else
            return key
          end
        end, { desc = 'vim.snippet.jump if active, otherwise ' .. key, expr = true })
      end

      set_snippet_jump(1, '<Tab>')
      set_snippet_jump(-1, '<S-Tab>')
    end)
  end)
  after_each(clear)

  --- @param snippet string[]
  --- @param expected string[]
  --- @param settings? string
  --- @param prefix? string
  local function test_expand_success(snippet, expected, settings, prefix)
    if settings then
      exec_lua(settings)
    end
    if prefix then
      feed('i' .. prefix)
    end
    exec_lua('vim.snippet.expand(...)', table.concat(snippet, '\n'))
    eq(expected, buf_lines(0))
  end

  local function wait_for_pum()
    retry(nil, nil, function()

Review comment (suggestion):
```suggestion
        end, { silent = true, expr = true })
```

For test purposes the description is irrelevant, but I think we should set `silent` and `expr` like the default mapping does.

Code after:
local n = require('test.functional.testnvim')()

local buf_lines = n.buf_lines
local clear = n.clear
local eq = t.eq
local exec_lua = n.exec_lua
local feed = n.feed
local api = n.api
local fn = n.fn
local matches = t.matches
local pcall_err = t.pcall_err
local poke_eventloop = n.poke_eventloop
local retry = t.retry

describe('vim.snippet', function()
  before_each(function()
    clear()
    exec_lua(function()
      local function set_snippet_jump(direction, key)
        vim.keymap.set({ 'i', 's' }, key, function()
          if vim.snippet.active({ direction = direction }) then
            return string.format('<Cmd>lua vim.snippet.jump(%d)<CR>', direction)
          else
            return key
          end
        end, { silent = true, expr = true })
      end

      set_snippet_jump(1, '<Tab>')
      set_snippet_jump(-1, '<S-Tab>')
    end)
  end)
  after_each(clear)

  --- @param snippet string[]
  --- @param expected string[]
  --- @param settings? string
  --- @param prefix? string
  local function test_expand_success(snippet, expected, settings, prefix)
    if settings then
      exec_lua(settings)
    end
    if prefix then
      feed('i' .. prefix)
    end
    exec_lua('vim.snippet.expand(...)', table.concat(snippet, '\n'))
    eq(expected, buf_lines(0))
  end

  local function wait_for_pum()
    retry(nil, nil, function()
Repository: neovim/neovim
File: runtime/lua/vim/lsp/completion.lua (Lua)

Code before:
  ---@type fun(item: lsp.CompletionItem):boolean
  local matches
  if not prefix:find('%w') then
    matches = function(_)
      return true
    end
  else
    ---@param item lsp.CompletionItem
    matches = function(item)
      if item.filterText then
        return match_item_by_value(item.filterText, prefix)
      end

      if item.textEdit then
        -- server took care of filtering
        return true
      end

      return match_item_by_value(item.label, prefix)
    end
  end

  local candidates = {}
  local bufnr = api.nvim_get_current_buf()
  local user_convert = vim.tbl_get(buf_handles, bufnr, 'convert')
  local kind_highlights = generate_kind_hlgroup()
  for _, item in ipairs(items) do
    if matches(item) then
      local word = get_completion_word(item, prefix, match_item_by_value)
      local hl_group = ''
      if
        item.deprecated
        or vim.list_contains((item.tags or {}), protocol.CompletionTag.Deprecated)
      then
        hl_group = 'DiagnosticDeprecated'
      end
      local completion_item = {
        word = word,
        abbr = item.label,
        kind = protocol.CompletionItemKind[item.kind] or 'Unknown',
        menu = item.detail or '',
        info = get_doc(item),
        icase = 1,
        dup = 1,
        empty = 1,
        abbr_hlgroup = hl_group,
        kind_hlgroup = kind_highlights[item.kind],
        user_data = {
          nvim = {
            lsp = {
              completion_item = item,

Review comment (suggestion):
```suggestion
  local kind_hlgroups = generate_kind_hlgroup()
```

Code after:
---@return string? kind text or "■" for colors
---@return string? highlight group for colors
local function generate_kind(item)
  if not lsp.protocol.CompletionItemKind[item.kind] then
    return 'Unknown'
  end
  if item.kind ~= lsp.protocol.CompletionItemKind.Color then
    return lsp.protocol.CompletionItemKind[item.kind]
  end
  local doc = get_doc(item)
  if #doc == 0 then
    return
  end

  -- extract hex from RGB format
  local r, g, b = doc:match('rgb%((%d+)%s*,?%s*(%d+)%s*,?%s*(%d+)%)')
  local hex = r and string.format('%02x%02x%02x', tonumber(r), tonumber(g), tonumber(b))
    or doc:match('#?([%da-fA-F]+)')

  if not hex then
    return
  end

  -- expand 3-digit hex to 6-digit
  if #hex == 3 then
    hex = hex:gsub('.', '%1%1')
  end

  if #hex ~= 6 then
    return
  end

  hex = hex:lower()
  local group = ('@lsp.color.%s'):format(hex)
  if #api.nvim_get_hl(0, { name = group }) == 0 then
    api.nvim_set_hl(0, group, { fg = '#' .. hex })
  end

  return '■', group
end

--- Turns the result of a `textDocument/completion` request into vim-compatible
--- |complete-items|.
---
--- @param result vim.lsp.CompletionResult Result of `textDocument/completion`
--- @param prefix string prefix to filter the completion items
--- @param client_id integer? Client ID
--- @param server_start_boundary integer? server start boundary
--- @param line string? current line content
--- @param lnum integer? 0-indexed line number
--- @param encoding string? encoding
Repository: neovim/neovim
File: test/functional/plugin/lsp/completion_spec.lua (Lua)

Code before:
    local result = complete('fo|', completion_list)
    local expected = {
      {
        abbr = 'foo',
        word = 'foo',
      },
      {
        abbr = 'bar',
        word = 'bar',
      },
    }
    result = vim.tbl_map(function(x)
      return {
        abbr = x.abbr,
        word = x.word,
      }
    end, result.items)
    local sorter = function(a, b)
      return a.word > b.word
    end
    table.sort(expected, sorter)
    table.sort(result, sorter)
    eq(expected, result)
  end)

  it('uses exists highlight group for kind', function()
    local completion_list = {
      { label = 'Text', kind = 1 },
      { label = 'Method', kind = 2 },
      { label = 'Function', kind = 3 },
      { label = 'Constructor', kind = 4 },
      { label = 'Field', kind = 5 },
      { label = 'Variable', kind = 6 },
      { label = 'Class', kind = 7 },
      { label = 'Interface', kind = 8 },
      { label = 'Module', kind = 9 },
      { label = 'Property', kind = 10 },
      { label = 'Unit', kind = 11 },
      { label = 'Value', kind = 12 },
      { label = 'Enum', kind = 13 },
      { label = 'Keyword', kind = 14 },
      { label = 'Snippet', kind = 15 },
      { label = 'Color', kind = 16 },
      { label = 'File', kind = 17 },
      { label = 'Reference', kind = 18 },
      { label = 'Folder', kind = 19 },
      { label = 'EnumMember', kind = 20 },
      { label = 'Constant', kind = 21 },
      { label = 'Struct', kind = 22 },
      { label = 'Event', kind = 23 },
      { label = 'Operator', kind = 24 },

Review comment (suggestion):
```suggestion
  it('uses existing highlight group for kind_hlgroup', function()
```

Code after:
    local result = complete('fo|', completion_list)
    local expected = {
      {
        abbr = 'foo',
        word = 'foo',
      },
    }
    result = vim.tbl_map(function(x)
      return {
        abbr = x.abbr,
        word = x.word,
      }
    end, result.items)
    local sorter = function(a, b)
      return a.word > b.word
    end
    table.sort(expected, sorter)
    table.sort(result, sorter)
    eq(expected, result)
  end)

  it('generate "■" symbol with highlight group for CompletionItemKind.Color', function()
    local completion_list = {
      { label = 'text-red-300', kind = 16, documentation = 'color: rgb(252, 165, 165)' },
    }
    local result = complete('|', completion_list)
    result = vim.tbl_map(function(x)
      return {
        word = x.word,
        kind_hlgroup = x.kind_hlgroup,
        kind = x.kind,
      }
    end, result.items)
    eq({ { word = 'text-red-300', kind_hlgroup = '@lsp.color.fca5a5', kind = '■' } }, result)
  end)

  ---@param prefix string
  ---@param items lsp.CompletionItem[]
  ---@param expected table[]
  local assert_completion_matches = function(prefix, items, expected)
    local result = complete(prefix .. '|', items)
    result = vim.tbl_map(function(x)
      return {
        abbr = x.abbr,
        word = x.word,
      }
    end, result.items)
    local sorter = function(a, b)
      return a.word > b.word
    end
    table.sort(expected, sorter)
Repository: neovim/neovim
File: src/nvim/lua/executor.c (C)

Code before:
  return 0;
}

int nlua_in_fast_event(lua_State *lstate)
{
  lua_pushboolean(lstate, in_fast_callback > 0);
  return 1;
}

static bool viml_func_is_fast(const char *name)
{
  const EvalFuncDef *const fdef = find_internal_func(name);
  if (fdef) {
    return fdef->fast;
  }
  // Not a Vimscript function
  return false;
}

int nlua_call(lua_State *lstate)
{
  Error err = ERROR_INIT;
  size_t name_len;
  const char *name = luaL_checklstring(lstate, 1, &name_len);
  if (!nlua_is_deferred_safe() && !viml_func_is_fast(name)) {
    size_t length = strlen(name) + strlen("Vimscript function ") + 1;
    char *str = xmalloc(length);
    vim_snprintf(str, length, "Vimscript function %s", name);
    int ret = luaL_error(lstate, e_fast_api_disabled, str);
    xfree(str);
    return ret;
  }

  int nargs = lua_gettop(lstate) - 1;
  if (nargs > MAX_FUNC_ARGS) {
    return luaL_error(lstate, "Function called with too many arguments");
  }

  typval_T vim_args[MAX_FUNC_ARGS + 1];
  int i = 0;  // also used for freeing the variables
  for (; i < nargs; i++) {
    lua_pushvalue(lstate, i + 2);
    if (!nlua_pop_typval(lstate, &vim_args[i])) {
      api_set_error(&err, kErrorTypeException,
                    "error converting argument %d", i + 1);
      goto free_vim_args;
    }
  }

  // TODO(bfredl): this should be simplified in error handling refactor
  force_abort = false;

Review comment (suggestion):
sizeof works on static strings 
```suggestion
    size_t length = strlen(name) + sizeof("Vimscript function ") + 1;
```

Code after:
      .v_type = VAR_STRING,
      .vval.v_string = "lua_debug> ",
    },
    {
      .v_type = VAR_UNKNOWN,
    },
  };
  while (true) {
    lua_settop(lstate, 0);
    typval_T input;
    get_user_input(input_args, &input, false, false);
    msg_putchar('\n');  // Avoid outputting on input line.
    if (input.v_type != VAR_STRING
        || input.vval.v_string == NULL
        || *input.vval.v_string == NUL
        || strcmp(input.vval.v_string, "cont") == 0) {
      tv_clear(&input);
      return 0;
    }
    if (luaL_loadbuffer(lstate, input.vval.v_string,
                        strlen(input.vval.v_string), "=(debug command)")) {
      nlua_error(lstate, _("E5115: Loading Lua debug string: %.*s"));
    } else if (nlua_pcall(lstate, 0, 0)) {
      nlua_error(lstate, _("E5116: Calling Lua debug string: %.*s"));
    }
    tv_clear(&input);
  }
  return 0;
}

int nlua_in_fast_event(lua_State *lstate)
{
  lua_pushboolean(lstate, in_fast_callback > 0);
  return 1;
}

static bool viml_func_is_fast(const char *name)
{
  const EvalFuncDef *const fdef = find_internal_func(name);
  if (fdef) {
    return fdef->fast;
  }
  // Not a Vimscript function
  return false;
}

int nlua_call(lua_State *lstate)
{
  Error err = ERROR_INIT;
  size_t name_len;
  const char *name = luaL_checklstring(lstate, 1, &name_len);
Repository: neovim/neovim
File: src/nvim/lua/executor.c (C)

Code before:

int nlua_in_fast_event(lua_State *lstate)
{
  lua_pushboolean(lstate, in_fast_callback > 0);
  return 1;
}

static bool viml_func_is_fast(const char *name)
{
  const EvalFuncDef *const fdef = find_internal_func(name);
  if (fdef) {
    return fdef->fast;
  }
  // Not a Vimscript function
  return false;
}

int nlua_call(lua_State *lstate)
{
  Error err = ERROR_INIT;
  size_t name_len;
  const char *name = luaL_checklstring(lstate, 1, &name_len);
  if (!nlua_is_deferred_safe() && !viml_func_is_fast(name)) {
    size_t length = strlen(name) + strlen("Vimscript function ") + 1;
    char *str = xmalloc(length);
    vim_snprintf(str, length, "Vimscript function %s", name);
    int ret = luaL_error(lstate, e_fast_api_disabled, str);
    xfree(str);
    return ret;
  }

  int nargs = lua_gettop(lstate) - 1;
  if (nargs > MAX_FUNC_ARGS) {
    return luaL_error(lstate, "Function called with too many arguments");
  }

  typval_T vim_args[MAX_FUNC_ARGS + 1];
  int i = 0;  // also used for freeing the variables
  for (; i < nargs; i++) {
    lua_pushvalue(lstate, i + 2);
    if (!nlua_pop_typval(lstate, &vim_args[i])) {
      api_set_error(&err, kErrorTypeException,
                    "error converting argument %d", i + 1);
      goto free_vim_args;
    }
  }

  // TODO(bfredl): this should be simplified in error handling refactor
  force_abort = false;
  suppress_errthrow = false;
  did_throw = false;

Review comment (suggestion):
```suggestion
    vim_snprintf(str, length, "Vimscript function \"%s\"", name);
```

Code after:
    },
    {
      .v_type = VAR_UNKNOWN,
    },
  };
  while (true) {
    lua_settop(lstate, 0);
    typval_T input;
    get_user_input(input_args, &input, false, false);
    msg_putchar('\n');  // Avoid outputting on input line.
    if (input.v_type != VAR_STRING
        || input.vval.v_string == NULL
        || *input.vval.v_string == NUL
        || strcmp(input.vval.v_string, "cont") == 0) {
      tv_clear(&input);
      return 0;
    }
    if (luaL_loadbuffer(lstate, input.vval.v_string,
                        strlen(input.vval.v_string), "=(debug command)")) {
      nlua_error(lstate, _("E5115: Loading Lua debug string: %.*s"));
    } else if (nlua_pcall(lstate, 0, 0)) {
      nlua_error(lstate, _("E5116: Calling Lua debug string: %.*s"));
    }
    tv_clear(&input);
  }
  return 0;
}

int nlua_in_fast_event(lua_State *lstate)
{
  lua_pushboolean(lstate, in_fast_callback > 0);
  return 1;
}

static bool viml_func_is_fast(const char *name)
{
  const EvalFuncDef *const fdef = find_internal_func(name);
  if (fdef) {
    return fdef->fast;
  }
  // Not a Vimscript function
  return false;
}

int nlua_call(lua_State *lstate)
{
  Error err = ERROR_INIT;
  size_t name_len;
  const char *name = luaL_checklstring(lstate, 1, &name_len);
  if (!nlua_is_deferred_safe() && !viml_func_is_fast(name)) {
    size_t length = MIN(strlen(name), 100) + sizeof("Vimscript function \"\"");