diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-12-01 22:26:36 -0800 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-12-01 22:35:15 -0800 |
commit | b1991f66d5845ccb72c73fdf39153a0e1fbb1124 (patch) | |
tree | dd62308f90e4282a46094493d5e167aab8526ff1 /src/nvim/ex_cmds2.c | |
parent | bd43e011b5b0feba644ec5feae6c174def31a9e4 (diff) | |
download | rneovim-b1991f66d5845ccb72c73fdf39153a0e1fbb1124.tar.gz rneovim-b1991f66d5845ccb72c73fdf39153a0e1fbb1124.tar.bz2 rneovim-b1991f66d5845ccb72c73fdf39153a0e1fbb1124.zip |
API: rename nvim_source => nvim_exec
- Eliminate nvim_source_output(): add boolean `output` param to
nvim_exec() instead.
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r-- | src/nvim/ex_cmds2.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index bda7b4e8b5..8479c15b40 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -3047,6 +3047,9 @@ static char_u *get_str_line(int c, void *cookie, int indent, bool do_concat) return (char_u *)xstrdup(buf); } +/// Executes lines in `src` as Ex commands. +/// +/// @see do_source() int do_source_str(const char *cmd, const char *traceback_name) { char_u *save_sourcing_name = sourcing_name; @@ -3055,7 +3058,7 @@ int do_source_str(const char *cmd, const char *traceback_name) if (save_sourcing_name == NULL) { sourcing_name = (char_u *)traceback_name; } else { - snprintf((char *)sourcing_name_buf, sizeof sourcing_name_buf, + snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf), "%s called at %s:%"PRIdLINENR, traceback_name, save_sourcing_name, save_sourcing_lnum); sourcing_name = sourcing_name_buf; @@ -3070,24 +3073,20 @@ int do_source_str(const char *cmd, const char *traceback_name) current_sctx.sc_sid = SID_STR; current_sctx.sc_seq = 0; current_sctx.sc_lnum = save_sourcing_lnum; - int retval = FAIL; - do_cmdline(NULL, get_str_line, (void *)&cookie, - DOCMD_VERBOSE | DOCMD_NOWAIT | DOCMD_REPEAT); - retval = OK; - if (got_int) { - EMSG(_(e_interr)); - } - + int retval = do_cmdline(NULL, get_str_line, (void *)&cookie, + DOCMD_VERBOSE | DOCMD_NOWAIT | DOCMD_REPEAT); current_sctx = save_current_sctx; sourcing_lnum = save_sourcing_lnum; sourcing_name = save_sourcing_name; return retval; } -/// Read the file "fname" and execute its lines as EX commands. +/// Reads the file `fname` and executes its lines as Ex commands. /// /// This function may be called recursively! /// +/// @see do_source_str +/// /// @param fname /// @param check_other check for .vimrc and _vimrc /// @param is_vimrc DOSO_ value |