Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do BufEnter for directories. #1375

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,19 @@ read_buffer(
* it can be changed there. */
if (!readonlymode && !bufempty())
changed();
else if (retval != FAIL)
else if (retval == OK)
unchanged(curbuf, FALSE);

#ifdef FEAT_AUTOCMD
if (retval == OK)
{
# ifdef FEAT_EVAL
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
curbuf, &retval);
# else
apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
apply_autocmds(EVENT_STDINREADPOST, NULL, NULL, FALSE, curbuf);
# endif
}
#endif
}
return retval;
Expand Down Expand Up @@ -294,7 +297,7 @@ open_buffer(
#endif
)
changed();
else if (retval != FAIL && !read_stdin && !read_fifo)
else if (retval == OK && !read_stdin && !read_fifo)
unchanged(curbuf, FALSE);
save_file_ff(curbuf); /* keep this fileformat */

Expand Down Expand Up @@ -328,7 +331,7 @@ open_buffer(
# endif
#endif

if (retval != FAIL)
if (retval == OK)
{
#ifdef FEAT_AUTOCMD
/*
Expand Down
2 changes: 1 addition & 1 deletion src/ex_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ do_filter(
if (otmp != NULL)
{
if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM,
eap, READ_FILTER) == FAIL)
eap, READ_FILTER) != OK)
{
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
if (!aborting())
Expand Down
2 changes: 1 addition & 1 deletion src/ex_docmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8857,7 +8857,7 @@ ex_read(exarg_T *eap)
eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0);

}
if (i == FAIL)
if (i != OK)
{
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
if (!aborting())
Expand Down
6 changes: 3 additions & 3 deletions src/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ filemess(
* READ_KEEP_UNDO don't clear undo info or read it from a file
* READ_FIFO read from fifo/socket instead of a file
*
* return FAIL for failure, OK otherwise
* return FAIL for failure, NOTDONE for directory (failure), or OK
*/
int
readfile(
Expand Down Expand Up @@ -456,7 +456,7 @@ readfile(
filemess(curbuf, fname, (char_u *)_("is not a file"), 0);
msg_end();
msg_scroll = msg_save;
return FAIL;
return S_ISDIR(perm) ? NOTDONE : FAIL;
}
#endif
#if defined(MSWIN)
Expand Down Expand Up @@ -7136,7 +7136,7 @@ buf_reload(buf_T *buf, int orig_mode)
#endif
if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0,
(linenr_T)0,
(linenr_T)MAXLNUM, &ea, flags) == FAIL)
(linenr_T)MAXLNUM, &ea, flags) != OK)
{
#if defined(FEAT_AUTOCMD) && defined(FEAT_EVAL)
if (!aborting())
Expand Down
2 changes: 1 addition & 1 deletion src/memline.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ ml_recover(void)
line_count = pp->pb_pointer[idx].pe_line_count;
if (readfile(curbuf->b_ffname, NULL, lnum,
pp->pb_pointer[idx].pe_old_lnum - 1,
line_count, NULL, 0) == FAIL)
line_count, NULL, 0) != OK)
cannot_open = TRUE;
else
lnum += line_count;
Expand Down