aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r--src/nvim/fileio.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 282e25e10e..25c99af41b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -176,7 +176,7 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr)
///
/// @return FAIL for failure, NOTDONE for directory (failure), or OK
int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip,
- linenr_T lines_to_read, exarg_T *eap, int flags)
+ linenr_T lines_to_read, exarg_T *eap, int flags, bool silent)
{
int fd = 0;
int newfile = (flags & READ_NEW);
@@ -472,10 +472,12 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
return FAIL;
}
}
- if (dir_of_file_exists(fname)) {
- filemess(curbuf, sfname, (char_u *)new_file_message(), 0);
- } else {
- filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0);
+ if (!silent) {
+ if (dir_of_file_exists(fname)) {
+ filemess(curbuf, sfname, (char_u *)new_file_message(), 0);
+ } else {
+ filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0);
+ }
}
// Even though this is a new file, it might have been
// edited before and deleted. Get the old marks.
@@ -658,7 +660,7 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
// Autocommands may add lines to the file, need to check if it is empty
wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY);
- if (!recoverymode && !filtering && !(flags & READ_DUMMY)) {
+ if (!recoverymode && !filtering && !(flags & READ_DUMMY) && !silent) {
if (!read_stdin && !read_buffer) {
filemess(curbuf, sfname, (char_u *)"", 0);
}
@@ -1788,7 +1790,7 @@ failed:
return OK; // an interrupt isn't really an error
}
- if (!filtering && !(flags & READ_DUMMY)) {
+ if (!filtering && !(flags & READ_DUMMY) && !silent) {
add_quoted_fname((char *)IObuff, IOSIZE, curbuf, (const char *)sfname);
c = false;
@@ -5191,7 +5193,7 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options)
curbuf->b_flags |= BF_CHECK_RO; // check for RO again
keep_filetype = true; // don't detect 'filetype'
if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0,
- (linenr_T)MAXLNUM, &ea, flags) != OK) {
+ (linenr_T)MAXLNUM, &ea, flags, false) != OK) {
if (!aborting()) {
semsg(_("E321: Could not reload \"%s\""), buf->b_fname);
}